Skip to main content
Available in version 0.13.2 and later.
Blnk’s Filter API lets you retrieve exactly the data you need from any collection. Use server-side filters with a clean JSON interface to build precise, composable queries. The Filter API is available for all collections: ledgers, balances, transactions, and identities.

Filter endpoints

Each collection has a dedicated filter endpoint:

Request format

Send a POST request with a JSON body containing your filters, sorting, and pagination options:

Response format

The response format depends on whether include_count is enabled.
If include_count is true, an additional query will run to fetch the total count, which may impact performance on large datasets.

Filter object

Each filter in the filters array follows this structure:

Supported operators

Blnk provides a range of operators to match, compare, and filter your data precisely:
For like and ilike operators, use % as a wildcard. %savings% matches any value containing “savings”. For isnull/isnotnull, the value property is ignored.

Sorting

Control how results are ordered using the sort_by and sort_order parameters:
Only indexed fields (e.g., created_at, balance_id, etc.) are sortable. Sorting on non-indexed fields returns a 400 error.
For information on which fields are indexed and how to add custom indexes, see Performance Tuning.

Pagination

Manage large result sets with pagination:
To iterate through all pages, increment the offset by your limit value with each request. For example, with limit=50: page 1 uses offset=0, page 2 uses offset=50, page 3 uses offset=100, and so on.

Filterable fields

Each collection exposes specific fields you can filter on. Select a tab below to see the available fields for each collection.

Filtering metadata

To filter on custom metadata, use dot notation for the field name:
Response

Error handling

Structured errors are available from Blnk Core 0.15.0 and later.
Invalid filter requests return 400 Bad Request with error_detail.code set to GEN_BAD_REQUEST. The error message includes details about the field, operator, or value that failed validation.
400 Bad Request
To resolve the error: For the full error catalogue, see API error codes.

Best practices

  1. Use specific filters: The more specific your filters, the faster your queries. Combine multiple filters to narrow results.
  2. Paginate large results: Always use pagination when expecting many results. This improves performance and reduces response times.
  3. Use include_count sparingly: Only request counts when necessary, as it adds overhead on large datasets.
  4. Use appropriate operators: Use eq for exact matches, ilike for case-insensitive searches, and in for multiple values.
  5. Consider Typesense for complex queries: For advanced operations like grouping, joins, or full-text search, consider using the Search API instead.
  6. Optimize indexes: For frequently filtered or sorted fields, ensure proper indexes are in place. See Performance Tuning for details.

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool. To ask questions or discuss issues, please contact us or join our Discord community.