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:
CollectionEndpoint
LedgersPOST /ledgers/filter
BalancesPOST /balances/filter
TransactionsPOST /transactions/filter
IdentitiesPOST /identities/filter

Request format

Send a POST request with a JSON body containing your filters, sorting, and pagination options:
curl -X POST "https://YOUR_BLNK_INSTANCE_URL/transactions/filter" \
  -H "X-Blnk-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": [
      { "field": "status", "operator": "eq", "value": "APPLIED" },
      { "field": "currency", "operator": "in", "values": ["USD", "EUR"] }
    ],
    "sort_by": "created_at",
    "sort_order": "desc",
    "include_count": true,
    "limit": 20,
    "offset": 0
  }'
ParameterTypeRequiredDescription
filtersarrayYesArray of filter objects
sort_bystringNoField to sort by (default: created_at)
sort_orderstringNoSort direction: asc or desc (default: desc)
include_countbooleanNoInclude total count in response (default: false)
limitintegerNoMax records to return (default: 20, max: 100)
offsetintegerNoRecords to skip (default: 0)

Response format

The response format depends on whether include_count is enabled.
{
  "data": [
    {
      "transaction_id": "txn_abc123",
      "amount": 15000,
      "currency": "USD",
      "status": "APPLIED",
      "source": "bln_source123",
      "destination": "bln_dest456",
      "created_at": "2024-01-15T10:30:00Z"
    }
  ],
  "total_count": 150
}
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:
FieldTypeRequiredDescription
fieldstringYesThe field to filter on
operatorstringYesThe comparison operator
valueanyFor single-value opsThe value to compare against
valuesarrayFor in/between opsArray of values (for those operators)

Supported operators

Blnk provides a range of operators to match, compare, and filter your data precisely:
OperatorDescriptionExample
eqEqual to{"field": "status", "operator": "eq", "value": "APPLIED"}
neNot equal to{"field": "status", "operator": "ne", "value": "VOID"}
gtGreater than{"field": "amount", "operator": "gt", "value": 1000}
gteGreater than or equal{"field": "amount", "operator": "gte", "value": 1000}
ltLess than{"field": "amount", "operator": "lt", "value": 5000}
lteLess than or equal{"field": "amount", "operator": "lte", "value": 5000}
inIn a set of values{"field": "currency", "operator": "in", "values": ["USD", "EUR"]}
betweenBetween two values{"field": "amount", "operator": "between", "values": [1000, 5000]}
likePattern match (case-sensitive){"field": "name", "operator": "like", "value": "%savings%"}
ilikePattern match (case-insensitive){"field": "name", "operator": "ilike", "value": "%USD%"}
isnullField is null{"field": "identity_id", "operator": "isnull"}
isnotnullField is not null{"field": "identity_id", "operator": "isnotnull"}
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:
ParameterValuesDefaultDescription
sort_byAny indexed fieldcreated_atField to sort by
sort_orderasc, descdescSort direction
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:
ParameterDefaultMaxDescription
limit20100Max records to return
offset0-Records to skip
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.
FieldTypeDescription
transaction_idstringUnique transaction identifier
referencestringCustom reference
amountnumberTransaction amount
currencystringCurrency code
statusstringQUEUED, APPLIED, INFLIGHT, VOID
sourcestringSource balance ID
destinationstringDestination balance ID
created_attimestampCreation time
descriptionstringTransaction description
balance_idstringRelated balance (for internal mapping)
meta_data.*anyCustom metadata fields

Filtering metadata

To filter on custom metadata, use dot notation for the field name:
curl -X POST "https://YOUR_BLNK_INSTANCE_URL/transactions/filter" \
  -H "X-Blnk-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": [
      { "field": "meta_data.customer_type", "operator": "eq", "value": "premium" }
    ]
  }'

Error handling

Invalid filters return a 400 Bad Request:
{
  "error": "invalid field 'amount_string' for collection 'transactions'"
}
Common issues:
  • Invalid field name for the collection
  • Unsupported operator
  • Incorrect value type for the field
  • Missing required filter properties

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.
Tip: Connect to Blnk Cloud to see your Core data.You can view your transactions, manage identities, create custom reports, invite other team members to collaborate, and perform operations on your Core — all in one dashboard.Check out Blnk Cloud →