Query Records for Sync
UsePOST /api/v2/<record_type>/_query when you need filtered, sorted, paginated record reads.
Basic query
and.
Sort and paginate
next_cursor, send it back in the next request:
- Treat cursors as opaque strings.
- Do not parse or modify cursor values.
- Cursors are tied to the filter and sort used to create them.
- If a cursor becomes invalid, restart the query from the first page.
Composite filters
Useor and not blocks for more complex queries.
Operator guide
| Operator family | Operators | Typical fields |
|---|---|---|
| Equality | eq, ne, in, not_in | IDs, strings, emails, select values, stages, references |
| String matching | contains, starts_with, ends_with | Text, email, URL, phone values |
| Ordering | gt, gte, lt, lte, between | Number, currency, percent, timestamp, date, time |
| Empty checks | exists, not_exists | Any nullable field |
invalid_filter_operator or invalid_filter_field.
Common sync pattern
- Query by
updated_atfrom your last successful sync timestamp. - Sort by
updated_atascending. - Process every page until
next_cursorisnull. - Persist the latest processed
updated_atand record ID in your own system. - On failure, restart from the last checkpoint instead of trying to reuse an old cursor indefinitely.
Common errors
| Error code | Usually means | How to recover |
|---|---|---|
invalid_filter_field | Field does not exist or is not filterable | Check /_schema/{record_type} |
invalid_filter_operator | Operator is not valid for that field type | Use an operator compatible with the value type |
invalid_filter_value | Value shape does not match the operator or field | Coerce the value before sending |
filter_depth_exceeded | Dot-path traversal is too deep | Reduce the relationship path depth |
sort_too_many_fields | Too many explicit sort fields | Use no more than three explicit sort fields |
unsortable_field | Field is not sortable | Choose a sortable field from schema |
invalid_cursor | Cursor was malformed, expired, or used with changed filters/sort | Restart pagination |
limit_out_of_range | limit is outside the accepted range | Use 1 through 500 |