Using the filter API
The POST filter API is the most powerful way to query Ptolemy data. This guide covers practical examples for common filtering patterns: combining conditions, EAV field queries, tag filtering, and sorting.
Why POST filter instead of GET?
The GET list endpoints support basic query parameters but are limited to simple equality checks. The POST filter endpoints support:
lt, gte), set membership (in), substring (like), and null checks.field. prefix — not possible via GET params.POST /instruments/filter counts as one API call. If you find yourself making multiple GET requests to achieve the same result, switch to the filter endpoint.Simple equality filter
The simplest filter checks a single field for an exact value:
Top-level convenience fields like type_id are shorthand. You can also express them inside a filter block:
Range filter on EAV fields
Use the field. prefix to filter on custom field values. This example finds large-cap equities:
Filter by tag hierarchy
Use tagged_with_descendants to find instruments in a tag tree — this is the most common tag filter pattern:
Filter by set membership
The in operator matches any value in an array — useful for filtering by a known set of identifiers:
Count before fetching
Before paginating through a large result set, use the count endpoint to estimate how many records match your filter. This helps you plan batch sizes and set user expectations.
Full-text search
The instruments filter endpoint also supports a q field for full-text search across instrument name and identifier. Combine it with filter conditions for powerful queries:
identifier equality filter.