Tink.Connector (Tink v1.0.0)

Copy Markdown View Source

Connector API — manual account and transaction ingestion.

Use this when you already hold bank data and want to push it into Tink's enrichment pipeline without using Tink Link aggregation.

Requires accounts:write and transactions:write scopes on an application-level (client credentials) client.

Example

{:ok, client} = Tink.Auth.client_credentials(scope: "accounts:write transactions:write")

Tink.Connector.upsert_accounts(client, "ext-user-123", [
  %{
    "externalId" => "acc-001",
    "name"       => "Current Account",
    "type"       => "CHECKING",
    "balance"    => %{"amount" => %{"currencyCode" => "GBP", "value" => 1500.0}}
  }
])

{:ok, op} = Tink.Connector.upsert_transactions(client, "ext-user-123", [
  %{
    "externalId"        => "tx-001",
    "accountExternalId" => "acc-001",
    "description"       => "Spotify",
    "amount"            => %{"currencyCode" => "GBP", "value" => -9.99},
    "dates"             => %{"booked" => "2024-01-15"}
  }
])

# Poll the async ingestion operation
{:ok, _} = Tink.Connector.poll_operation(client, op["operationId"])

Summary

Functions

Batch delete transactions via v2 connector API. Requires transactions:write.

Batch update transactions via v2 connector API. Requires transactions:write.

Delete accounts by external ID via v2 connector API. Requires accounts:write.

Delete transactions for a user by external ID list (v1). Requires transactions:write.

Delete all data for a connector user. Requires accounts:write.

Get the status of an async connector operation. Requires transactions:write.

Poll a connector operation until it completes or times out.

Upsert a single account by external ID (v1). Requires accounts:write.

Upsert a batch of accounts for a user (v1). Requires accounts:write.

Upsert accounts via v2 connector API. Requires accounts:write.

Upsert a single transaction by external ID (v1). Requires transactions:write.

Upsert a batch of transactions for a user (v1). Requires transactions:write.

Upsert transactions via v2 connector API. Requires transactions:write.

Functions

batch_delete_transactions(client, external_ids)

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

Batch delete transactions via v2 connector API. Requires transactions:write.

batch_update_transactions(client, transactions)

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

Batch update transactions via v2 connector API. Requires transactions:write.

delete_accounts(client, external_ids)

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

Delete accounts by external ID via v2 connector API. Requires accounts:write.

delete_transactions(client, external_user_id, external_ids)

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

Delete transactions for a user by external ID list (v1). Requires transactions:write.

delete_user(client, external_user_id)

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

Delete all data for a connector user. Requires accounts:write.

get_operation(client, operation_id)

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

Get the status of an async connector operation. Requires transactions:write.

poll_operation(client, operation_id, opts \\ [])

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

Poll a connector operation until it completes or times out.

Options

  • :timeout_ms — default 30_000
  • :interval_ms — default 1_000

upsert_account(client, external_user_id, external_account_id, params)

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

Upsert a single account by external ID (v1). Requires accounts:write.

upsert_accounts(client, external_user_id, accounts)

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

Upsert a batch of accounts for a user (v1). Requires accounts:write.

upsert_accounts_v2(client, accounts)

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

Upsert accounts via v2 connector API. Requires accounts:write.

upsert_transaction(client, external_user_id, external_tx_id, params)

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

Upsert a single transaction by external ID (v1). Requires transactions:write.

upsert_transactions(client, external_user_id, transactions)

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

Upsert a batch of transactions for a user (v1). Requires transactions:write.

upsert_transactions_v2(client, transactions)

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

Upsert transactions via v2 connector API. Requires transactions:write.