Skip to content

Search Allocations

client.transactions.searchAllocations(TransactionSearchAllocationsParams { filter } body, RequestOptionsoptions?): TransactionSearchAllocationsResponse { data }
POST/transactions/allocations/search

Searches transaction allocations.

ParametersExpand Collapse
body: TransactionSearchAllocationsParams { filter }
filter: Filter

Filter for searching transaction allocations.

invoice_id: InvoiceID { any }

Invoice ID filter.

any: Array<string>

Match allocations where invoice_id is any of these values, using OR logic.

ReturnsExpand Collapse
TransactionSearchAllocationsResponse { data }
data: Array<Data>

List of allocation search results.

id: string

FRAGMENT generated unique ID.

amount: string

Allocated amount, as a non-negative string in the smallest currency unit, such as cents for USD.

invoice_id: string

Invoice the allocation is applied against.

posted: string

Timestamp when the parent transaction was posted. Uses ISO 8601 format.

formatdate-time
transaction: Transaction { id, external_id }

Transaction the allocation is applied to.

id: string

FRAGMENT generated unique ID.

external_id: string

User-provided unique ID.

type: "invoice_payin" | "invoice_payout"

Type of allocation.

Accepts one of the following:
"invoice_payin"
"invoice_payout"
user: User { id, external_id }

User associated with the allocation.

id: string

FRAGMENT generated unique ID.

external_id: string

User-provided unique ID.

Search Allocations

import Fragment from '@fragment-dev/ts-node';

const client = new Fragment();

const response = await client.transactions.searchAllocations({
  filter: { invoice_id: { any: ['inv_abc123'] } },
});

console.log(response.data);
{
  "data": [
    {
      "id": "alloc_abc123",
      "amount": "1000",
      "invoice_id": "inv_abc123",
      "posted": "2024-01-13T00:00:00Z",
      "transaction": {
        "id": "txn_dHhuX2ZyYWdfMDAx",
        "external_id": "bank_txn_123"
      },
      "type": "invoice_payin",
      "user": {
        "id": "user_abc123",
        "external_id": "user_ext_001"
      }
    }
  ]
}
Returns Examples
{
  "data": [
    {
      "id": "alloc_abc123",
      "amount": "1000",
      "invoice_id": "inv_abc123",
      "posted": "2024-01-13T00:00:00Z",
      "transaction": {
        "id": "txn_dHhuX2ZyYWdfMDAx",
        "external_id": "bank_txn_123"
      },
      "type": "invoice_payin",
      "user": {
        "id": "user_abc123",
        "external_id": "user_ext_001"
      }
    }
  ]
}