Transactions. /transactions/sync is Plaid's recommended surface: keep one cursor per Item, call sync when the SYNC_UPDATES_AVAILABLE webhook arrives, apply added, modified and removed, then persist next_cursor. sync-all-transactions runs the has_more loop for you, including Plaid's rule that a pagination error restarts the loop from the first cursor. /transactions/get, refresh and recurring streams are here too.

Values

DEFAULT_MAX_PAGES

DEFAULT_MAX_PAGES: Int 100

DEFAULT_MAX_RESTARTS

DEFAULT_MAX_RESTARTS: Int 3

MUTATION_DURING_PAGINATION

MUTATION_DURING_PAGINATION: Str "TRANSACTIONS_SYNC_MUTATION_DURING_PAGINATION"

Functions

build-sync-request

fn (access-token: Str, cursor: Str?, params: Map): Map

The /transactions/sync body: access_token, cursor (omitted when null or empty, meaning "from the beginning"), and params count (1-500, default 100) and options (include_original_description, personal_finance_category_version, days_requested, account_id). Exposed for testing.

Example

::plaid::transactions/build-sync-request("access-sandbox-123", "", {count: 50})  // {access_token: "access-sandbox-123", count: 50}

get-recurring-transactions

fn (access-token: Str): Map
fn (access-token: Str, account-ids: Vec?, options: Map?): Map
fn (access-token: Str, account-ids: Vec?, options: Map?, opts: Map): Map

POST /transactions/recurring/get: inflow and outflow streams (subscriptions, payroll, ...) detected from the Item's history. Options: personal_finance_category_version. Pass account_ids in the 3-arity form. Returns {inflow_streams, outflow_streams, updated_datetime}.

Example

access-token ::hot::ctx/get("plaid.access-token")
out ::plaid::transactions/get-recurring-transactions(access-token, ["acc_123"], null)
map(out.outflow_streams, %.description)

get-transactions

fn (access-token: Str, start-date: Str, end-date: Str): Map
fn (access-token: Str, start-date: Str, end-date: Str, options: Map?): Map
fn (access-token: Str, start-date: Str, end-date: Str, options: Map?, opts: Map): Map

POST /transactions/get: transactions between two YYYY-MM-DD dates, offset-paginated. Options (Plaid's options object): account_ids, count (default 100, max 500), offset, include_original_description, days_requested. Returns {transactions, total_transactions, accounts, item}. Prefer sync for keeping a copy up to date.

Example

access-token ::hot::ctx/get("plaid.access-token")
out ::plaid::transactions/get-transactions(access-token, "2026-01-01", "2026-03-31", {count: 500})
out.total_transactions

merge-sync-page

fn (acc: Map, page: Map): Map

Fold one sync page into an accumulated result: concatenates added/modified/removed, keeps the latest accounts, next_cursor, has_more and transactions_update_status, counts pages. Exposed for testing.

Example

acc {added: [], modified: [], removed: [], accounts: [], pages: 0}
merged ::plaid::transactions/merge-sync-page(acc, {added: [{transaction_id: "t1"}], next_cursor: "c2", has_more: false})
merged.added  // [{transaction_id: "t1"}]
merged.pages  // 1

refresh-transactions

fn (access-token: Str): Map
fn (access-token: Str, opts: Map): Map

POST /transactions/refresh: ask Plaid to check the institution now (an add-on product). New data arrives through the usual SYNC_UPDATES_AVAILABLE webhook.

Example

access-token ::hot::ctx/get("plaid.access-token")
::plaid::transactions/refresh-transactions(access-token)

sync-all-transactions

fn (access-token: Str, cursor: Str?): Map
fn (access-token: Str, cursor: Str?, params: Map): Map
fn (access-token: Str, cursor: Str?, params: Map, opts: Map): Map

Sync until has_more is false and return the combined changes: {added, modified, removed, accounts, next_cursor, has_more, pages, transactions_update_status}. Persist next_cursor only after you've applied the changes. Params: count and options as in sync-transactions, max-pages (default 100; if hit, the result comes back with has_more true and a valid cursor to resume from), max-restarts (default 3) for TRANSACTIONS_SYNC_MUTATION_DURING_PAGINATION restarts.

Example

cursors ::hot::store/Map({name: "plaid-cursors"})
item-id "item_123"
access-token ::hot::ctx/get("plaid.access-token")
cursor ::hot::store/get(cursors, item-id)
changes ::plaid::transactions/sync-all-transactions(access-token, cursor, {count: 500})
// apply changes.added / changes.modified / changes.removed, then:
::hot::store/put(cursors, item-id, changes.next_cursor)

sync-all-with

fn (fetch: Fn, cursor: Str?, params: Map): Map

The has_more loop of sync-all-transactions over any fetch function (cursor) -> page or Err. Exposed for testing with a stubbed fetch.

Example

fetch (cursor) { {added: [{transaction_id: "t1"}], modified: [], removed: [], next_cursor: "c2", has_more: false} }
out ::plaid::transactions/sync-all-with(fetch, null, {})
out.next_cursor  // "c2"
out.pages  // 1

sync-transactions

fn (access-token: Str, cursor: Str?): Map
fn (access-token: Str, cursor: Str?, params: Map): Map
fn (access-token: Str, cursor: Str?, params: Map, opts: Map): Map

POST /transactions/sync: one page of changes since cursor (null on the first call). Returns {added, modified, removed, next_cursor, has_more, accounts, transactions_update_status}. Params: count, options. Most callers want sync-all-transactions.

Example

access-token ::hot::ctx/get("plaid.access-token")
page ::plaid::transactions/sync-transactions(access-token, null, {count: 100})
page.next_cursor