How to query database entries by unique_id property in Notion API

I’m trying to use the new unique_id feature in Notion databases but I can’t figure out how to filter records using this property type. When I make an API request to search for a specific unique_id value, I keep getting errors.

Here’s what I’m attempting:

{
  "filter": {
    "property": "RecordID",
    "number": {
        "equals": 157
    }
  }
}

The API returns an error: [400] Could not find property with name or id: RecordID even though that’s the correct property name in my database. I’ve double checked the spelling and it matches exactly. Has anyone successfully filtered by unique_id properties? What’s the proper syntax for this type of query?

You’re using the wrong filter syntax. Unique_id properties need the unique_id filter type, not number. Here’s what works:

{
  "filter": {
    "property": "RecordID",
    "unique_id": {
      "equals": 157
    }
  }
}

I hit this same wall when I started using unique_id properties. Notion’s API treats them as their own thing even though they look like regular numbers in the interface. Also make sure you’re on the latest API version - unique_id support is pretty new. Still getting property name errors? Try the property ID instead of the name. Sometimes there’s weird formatting or hidden characters the UI doesn’t show.

That property name error usually means the API isn’t reading your database schema right. I’ve hit this before with unique_id properties - turned out I was getting a cached version of the database structure. Pull the database schema first using the retrieve database endpoint to see exactly what property name and ID Notion wants. Sometimes the property gets created with a different internal name than what shows in the UI. Also check if your integration can actually access that property - I’ve seen partial permissions throw weird error messages like this instead of just saying “permission denied.”

hmm, also make sure you don’t have spaces in the property name. it can be tricky! I had a similar issue where it looked fine but was causing errors. good luck!