How to query database records by unique_id property in Notion API

I’m trying to filter records in my Notion database using the unique_id property type that was recently added. I can create the unique_id field just fine, but I can’t figure out how to search for specific records using this field.

When I make an API request to query the database, I’m getting an error. Here’s what I’m trying:

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

This returns an error: [400] Could not find property with name or id: RecordID even though RecordID is definitely the correct name of my unique_id property in the database.

Has anyone successfully filtered by unique_id properties? What’s the right syntax for this?

had this exact issue last week! the unique_id property uses unique_id in the filter, not number. change your filter to "unique_id": {"equals": 45} instead - that’ll fix the 400 error.

The unique_id property caught me off guard too. Check your actual database config - sometimes the display name doesn’t match what the API wants. Also, unique_id values have to be assigned by Notion itself. If you’re filtering by a value that doesn’t exist or wasn’t generated properly, you’ll get weird errors. Try a simple database query without filters first to see what unique_id values actually exist. Once you confirm they’re there, use the unique_id filter type like aroberts said. The property name issue might be spaces or special characters that don’t show in the UI but break API calls.

That 400 error means Notion isn’t recognizing your property name. Check that “RecordID” matches exactly what’s in your database - the API is case-sensitive. I’d use the property ID instead of the name since IDs never change. Just make a GET request to grab the database schema first and you’ll see all the property IDs. Also, unique_id properties only take integers, so double-check your data type. I ran into the same thing when I started using unique_id fields - switching to property IDs fixed most of my filtering headaches.