Skip to main content
POST
/
{collection}
/
filter
Search via DB
curl --request POST \
  --url http://localhost:5001/{collection}/filter \
  --header 'X-blnk-key: <api-key>'
Use Filter on the relevant service to query records in a collection. The Go SDK does not expose a unified Search.filter helper like the TypeScript SDK.
Call Filter on the service that owns the collection: client.Transaction.Filter, client.Ledger.Filter, client.LedgerBalance.Filter, or client.Identity.Filter.
1

Call the method

client.Transaction.Filter
result, resp, err := client.Transaction.Filter(
	blnkgo.FilterParams{
		Filters: []blnkgo.Filter{
			{
				Field: "status",
				Operator: blnkgo.OpEqual,
				Value: "APPLIED",
			},
		},
		SortBy: "created_at",
		SortOrder: "desc",
		IncludeCount: true,
		Limit: 20,
		Offset: 0,
	},
)
FieldTypeDescription
Filters[]blnkgo.FilterArray of filter conditions, each with a Field, Operator, and a Value or Values.
SortBystringField to sort by. Defaults to created_at.
SortOrderstringSort direction, asc or desc. Defaults to desc.
IncludeCountboolReturn TotalCount in the response. Defaults to false.
LimitintMaximum records to return. Defaults to 20, max 100.
OffsetintRecords to skip for pagination. Defaults to 0.
2

Use the filtered results

Read result.Data for matching records. Use result.TotalCount with Limit and Offset to paginate when IncludeCount is true.
3

Response

200 OK
{
  "data": [
    {
      "transaction_id": "txn_c4e70eb8-e4d6-4e04-a2e2-92a43b969e0c",
      "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 IncludeCount is true.

How DB filtering works

Supported operators and field reference.

Search via DB

HTTP request and response schema.

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.