Tink.Transactions (Tink v1.0.0)

Copy Markdown View Source

Transaction data access. Requires transactions:read scope.

Pagination

Use stream/2 for memory-efficient processing of large datasets, or list_all/2 to collect everything eagerly:

# Lazy stream — processes pages on demand
Tink.Transactions.stream(client, booked_date_gte: "2024-01-01")
|> Stream.filter(&(&1["status"] == "BOOKED"))
|> Enum.take(1000)

# Eager collect
{:ok, all} = Tink.Transactions.list_all(client)

Summary

Functions

Bulk categorize multiple transactions. Requires transactions:categorize.

Get a single transaction by ID. Requires transactions:read.

Get transactions similar to a given transaction. Requires transactions:read.

List transactions with cursor pagination. Returns one page.

Collect all transactions across all pages eagerly. Use stream/2 for large datasets.

Full-text search over transactions. Requires transactions:read.

Stream all transactions lazily across all pages. Never buffers all pages in memory.

Transaction autocomplete / suggestions. Requires transactions:read.

Update a transaction (custom category, tags, notes). Requires transactions:write.

Functions

categorize_multiple(client, categorizations)

@spec categorize_multiple(Tink.Client.t(), [map()]) ::
  {:ok, map()} | {:error, Tink.Error.t()}

Bulk categorize multiple transactions. Requires transactions:categorize.

Example

Tink.Transactions.categorize_multiple(client, [
  %{"id" => "tx-001", "categoryId" => "cat-expenses"},
  %{"id" => "tx-002", "categoryId" => "cat-income"}
])

get(client, transaction_id)

@spec get(Tink.Client.t(), String.t()) :: {:ok, map()} | {:error, Tink.Error.t()}

Get a single transaction by ID. Requires transactions:read.

get_similar(client, transaction_id, opts \\ [])

@spec get_similar(Tink.Client.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Tink.Error.t()}

Get transactions similar to a given transaction. Requires transactions:read.

list(client, opts \\ [])

@spec list(
  Tink.Client.t(),
  keyword()
) :: {:ok, map()} | {:error, Tink.Error.t()}

List transactions with cursor pagination. Returns one page.

Options

  • :page_size — results per page (consult your Tink dashboard/docs for the current maximum on /data/v2/transactions; the related /enrichment/v1/transactions endpoint defaults to 10 and caps at 100 per request)
  • :page_token — cursor from previous nextPageToken
  • :account_id_in — list of account IDs to filter by
  • :booked_date_gte — ISO 8601 date, e.g. "2024-01-01"
  • :booked_date_lte — ISO 8601 date
  • :status_in — list of statuses: "BOOKED", "PENDING", "UNDEFINED"

list_all(client, opts \\ [])

@spec list_all(
  Tink.Client.t(),
  keyword()
) :: {:ok, list()} | {:error, Tink.Error.t()}

Collect all transactions across all pages eagerly. Use stream/2 for large datasets.

search(client, opts \\ [])

@spec search(
  Tink.Client.t(),
  keyword()
) :: {:ok, map()} | {:error, Tink.Error.t()}

Full-text search over transactions. Requires transactions:read.

Options

  • :query_string — free-text search
  • :limit — max results

stream(client, opts \\ [])

@spec stream(
  Tink.Client.t(),
  keyword()
) :: Enumerable.t()

Stream all transactions lazily across all pages. Never buffers all pages in memory.

suggest(client, query, opts \\ [])

@spec suggest(Tink.Client.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Tink.Error.t()}

Transaction autocomplete / suggestions. Requires transactions:read.

Options

  • :limit — max suggestions

update(client, transaction_id, params)

@spec update(Tink.Client.t(), String.t(), map()) ::
  {:ok, map()} | {:error, Tink.Error.t()}

Update a transaction (custom category, tags, notes). Requires transactions:write.

Common params: %{"categoryId" => "...", "notes" => "...", "tags" => ["..."]}.