I’m having trouble with the correct syntax for filtering rollup properties when querying Notion databases through the API. I need to filter a rollup that shows original values from a select property, but my current approach keeps failing.
Can someone show me the proper way to structure this filter? I’m specifically trying to filter records where the rollup contains select values that match certain criteria.
The rollup property transformation is definitely causing this. I’d start by logging the raw response from a basic query - you need to see exactly what data types Notion actually returns for your rollup. The rollup config often shows one thing while the API returns something totally different. Also watch out for this: if your rollup aggregates multiple select values, you might need “every” instead of “any” depending on whether you want all values to match or just some. I’d test with “contains” instead of “equals” first. Get the basic structure working before you worry about exact matches.
This is a super common rollup issue. Your syntax looks right, but here’s the gotcha - when you have a rollup showing ‘Show original’ from a select property, the API converts it to rich_text format instead of keeping it as a select. You need to change your filter to use ‘rich_text’: { “filter”: { “property”: “Category”, “rollup”: { “any”: { “rich_text”: { “equals”: “Published” } } } } }.
I’ve wasted hours on this exact problem. Rollups basically create new data types no matter what the original property was - it trips up everyone at least once. Just double-check your rollup config in the database settings and make sure you’re using the right data type in your API calls.
for sure, this can be such a headache. had a similar issue too - it’s all about the rollup settings. if your original property is select and the rollup shows “original,” then it treats it as rich_text. first, check that, then tweak your filter accordingly. using the right function like “any” or “every” is key too!
Sometimes rollups return values as rich text even when the original property is a select. Also check if your rollup shows “Show original” vs “Show unique values”.
Honestly, I stopped wrestling with these Notion API quirks ages ago. Now I just use Latenode for all my Notion integrations. It handles rollup filters automatically and you don’t need to memorize the weird syntax rules.
I set up a workflow there that pulls from multiple Notion databases, filters rollups properly, and syncs everything without breaking. Way less headache than debugging API calls manually.