Skip to main content

Endpoint

POST /accounts/filter
Filters accounts using a JSON request body. This endpoint provides more advanced filtering capabilities than the GET endpoint, including complex queries and result counting.

Request Body

filters
array
required
Array of filter objects to apply. Each filter specifies a field, operator, and value
limit
integer
default:"20"
The maximum number of accounts to return
offset
integer
default:"0"
The number of accounts to skip
include_count
boolean
default:"false"
Whether to include the total count of matching records in the response

Response

When include_count is false, returns an array of account objects. When include_count is true, returns an object with data and total_count.
data
array
Array of account objects matching the filter criteria
total_count
integer
Total number of accounts matching the filter (only when include_count: true)

Example Request

{
  "filters": [
    {
      "field": "currency",
      "operator": "eq",
      "value": "USD"
    },
    {
      "field": "created_at",
      "operator": "gte",
      "value": "2024-01-01"
    }
  ],
  "limit": 20,
  "offset": 0,
  "include_count": true
}

Example Response (with count)

{
  "data": [
    {
      "account_id": "acc_789ghi",
      "name": "Main Account",
      "number": "1234567890",
      "bank_name": "Blnk Bank",
      "currency": "USD",
      "balance_id": "bln_321xyz",
      "identity_id": "idt_123abc",
      "ledger_id": "ldg_456def",
      "created_at": "2024-03-04T12:00:00Z",
      "meta_data": {
        "account_type": "savings"
      }
    }
  ],
  "total_count": 145
}

Example Response (without count)

[
  {
    "account_id": "acc_789ghi",
    "name": "Main Account",
    "number": "1234567890",
    "bank_name": "Blnk Bank",
    "currency": "USD",
    "balance_id": "bln_321xyz",
    "identity_id": "idt_123abc",
    "ledger_id": "ldg_456def",
    "created_at": "2024-03-04T12:00:00Z",
    "meta_data": {
      "account_type": "savings"
    }
  }
]

Complex Filter Examples

Multiple Currency Filter

{
  "filters": [
    {
      "field": "currency",
      "operator": "in",
      "value": ["USD", "EUR", "GBP"]
    }
  ],
  "limit": 50
}

Date Range with Pattern Matching

{
  "filters": [
    {
      "field": "created_at",
      "operator": "gte",
      "value": "2024-01-01"
    },
    {
      "field": "created_at",
      "operator": "lte",
      "value": "2024-12-31"
    },
    {
      "field": "bank_name",
      "operator": "ilike",
      "value": "%main%"
    }
  ],
  "limit": 100,
  "include_count": true
}

Error Responses

error
string
Error message describing what went wrong

Common Errors

  • 400 Bad Request: Invalid filter syntax or unsupported operator

Build docs developers (and LLMs) love