Search

Search via DB

Filter ledgers, balances, transactions, and identities with the TypeScript SDK.

POST/{collection}/filter

Use blnk.Search.filter to filter records in a collection.

Call the method

const response = await blnk.Search.filter(
  {
    filters: [
      {
        field: 'status',
        operator: 'eq',
        value: 'APPLIED',
      },
    ],
    logical_operator: 'and',
    sort_by: 'created_at',
    sort_order: 'desc',
    include_count: true,
    limit: 20,
    offset: 0,
  },
  'transactions',
);
FieldTypeDescription
filtersobject[]Array of filter conditions, each with a field, operator, and a value or values.
logical_operatorstringCombine filters with and or or. Defaults to and.
sort_bystringField to sort by. Defaults to created_at.
sort_orderstringSort direction, asc or desc. Defaults to desc.
include_countbooleanReturn total_count in the response. Defaults to false.
limitnumberMaximum records to return. Defaults to 20, max 100.
offsetnumberRecords to skip for pagination. Defaults to 0.
collectionstringCollection to filter: ledgers, transactions, balances, or identities.

Use the filtered results

Read response.data.data for matching records. Use total_count with limit and offset to paginate when include_count is true.

Response

{
  "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
}
FieldTypeDescription
dataobject[]Array of matching records. Shape varies by collection.
total_countnumberTotal matching records. Only present when include_count is true.