Mono Colombia

Lists the transactions of every ledger account

Lists the transactions of every ledger account of the tenant in one feed: its subaccounts and its tenant-level accounts (root, current, fees). Each transaction carries the account_id of the account it belongs to, so both legs of a transfer between two of your accounts appear, one per account. A transaction is listed under its account only in the account's currency, and only when it was recorded on the ledger address the account has today, the one the account's own listing reads: one recorded on an address the tenant has no account for, or on an earlier address of an account, is not listed.

sort[field] selects how the feed is walked:

  • inserted (default, ascending by default): the order in which the ledger recorded the transactions. Use it to extract everything recorded since your last run in one pass: store the next_cursor of the last page and send it on the next run, even when has_more is false. It serves transactions about 2 minutes after the ledger records them, so a transaction committed late is never left behind a cursor; for subaccount transactions, the ledger_account_transaction_created webhook delivers them sooner. Once a page in ascending order reaches that delay, its next_cursor moves up to it, even when the page is empty, so the next run does not read the same range again. The transaction_at and origin_transaction_at filters are not accepted in this order.
  • transaction_at or origin_transaction_at (descending by default): the transactions by that date, with no delay. A walk in these orders does not come back for a transaction recorded after it passed that transaction's date, so use inserted to extract.

Pagination is by cursor only: next_cursor reads the next page of the same request and is rejected with invalid_cursor if it is sent with another sort or other filters. It is kept even when has_more is false, and it is null only when a first page outside ascending inserted order comes back empty. page_size can change between pages. There are no page numbers nor totals.

reverted_by_id and origin_state are read when the page is served: a transaction already read can be reversed or change its origin state later. A reversal arrives as its own transaction, whose reverts_id points to the transaction it reverts.

A page reads about 50,000 entries of the tenant's ledger in its order, within the range on the date it walks, and applies the other filters to them; in a date order it also reads every entry that shares the date where it starts or stops. When filters that match few transactions leave it short of page_size by then, it comes back short, or empty, with has_more: true and a next_cursor past what it read: keep reading while has_more is true. In a date order, a range on that same date, such as transaction_at in transaction_at order, bounds what the pages read, so set it to skip the history you do not need, for instance for accounts opened recently.

GET
/v1/ledger/transactions

Autorización

AutorizaciónBearer <token>

En: header

Parámetros de consulta

page_size?integer

Amount of registers that must be listed by page

Default10
Range10 <= value <= 500
Example10
cursor?string

The next_cursor of the previous page, to read the page after it.

sort?object

Sorts the feed. field defaults to inserted; type defaults to asc for inserted and to desc for the dates.

account_id?array<string>

Lists only the transactions of these accounts, at most 100. Each one must be an account of the tenant.

Itemsitems <= 100
account_type?array<string>

Lists only the transactions of accounts of these types.

currency?string

Lists only the transactions in this currency.

Value in"COP" | "USD" | "MXN" | "CLP" | "BRL" | "PEN" | "EUR" | "ARS" | "GTQ" | "PYG"
transaction_at?object

Filters the transactions by date time ranges when the transaction was actually performed

origin_transaction_at?object

Filters the transactions by date time ranges when the transaction was created

operation_type?array<string>|string

Filters by the four operations available (credit, debit, hold and release)

origin?array<string>|string

Filters by the following origins:

  • card_transaction
  • card_presentment_payment
  • subaccount_operation
  • payin
  • payout
  • fee
  • synced_bank_transaction

Cuerpo de la respuesta

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://api.sandbox.cuentamono.com/v1/ledger/transactions"
{
  "pagination": {
    "has_more": true,
    "next_cursor": "AQh3sNQ7c1lB0Y9jdC7bF0ZhAZq3oVhGcgCm6lYw8Xnf",
    "page_size": 100
  },
  "transactions": [
    {
      "account_id": "lacc_5tgliBmzjZ6mpQPRbQjfKj",
      "amount": {
        "amount": 100000000,
        "currency": "COP"
      },
      "description": "Purchase on ABC Commerce",
      "id": "ltx_5tgliBmzjZ6mpQPRbQjfKj",
      "id_in_origin": "ctx_02vc3Wvuv6WaaDM81m8Utv",
      "operation_type": "debit",
      "origin": "card_transaction",
      "origin_state": "approved",
      "origin_transaction_at": "2022-01-01T01:00:00Z",
      "reverted_by_id": "ltx_5tgliBmzjZ6mpQPRbQjfKj",
      "reverts_id": "ltx_5tgliBmzjZ6mpQPRbQjfKj",
      "transaction_at": "2022-01-01T01:00:00Z"
    }
  ]
}
{
  "code": "400 Bad Request",
  "errors": [
    {
      "error_code": "invalid_cursor",
      "message": "The cursor is malformed or was issued for another sort or other filters.",
      "path": null,
      "url": null
    }
  ],
  "id": "log_7MkWaFqvfosB8fzHhb1Eql",
  "message": "Malformed request"
}
{
  "code": "401 Unauthorized",
  "errors": [
    {
      "error_code": "missing_authorization_header",
      "message": "`Authorization` header is missing.",
      "path": null,
      "url": null
    }
  ],
  "id": "log_7MkWaFqvfosB8fzHhb1Eql",
  "message": "Authorization header is missing or invalid."
}
{
  "code": "403 Forbidden",
  "errors": [
    {
      "error_code": "not_authorized",
      "message": "Not authorized to have access to this resource.",
      "path": null,
      "url": null
    }
  ],
  "id": "log_7MkWaFqvfosB8fzHhb1Eql",
  "message": "Not authorized to have access to this resource"
}
{
  "code": "422 Unprocessable Content",
  "errors": [
    {
      "error_code": "invalid_account_id",
      "message": "An account id doesn't belong to the client's ledger accounts.",
      "path": "#/path/to/field",
      "url": null
    }
  ],
  "id": "log_7MkWaFqvfosB8fzHhb1Eql",
  "message": "Validation errors"
}