Structured error returned by all Tink API functions.
Fields
:status— HTTP status code (e.g. 401, 429).nilfor network errors.:code— Tink error code string (e.g."AUTHENTICATION_ERROR","NOT_FOUND"):message— Human-readable error message:request_id— Value ofX-Tink-Request-IDresponse header — include this when reporting issues to Tink support:details— Raw decoded response body for inspection
Common error codes (from Tink docs)
| Status | Code | Meaning |
|---|---|---|
| 400 | BAD_REQUEST | Malformed request body or params |
| 401 | AUTHENTICATION_ERROR | Missing or invalid credentials |
| 401 | UNAUTHORIZED | Token expired or revoked |
| 403 | FORBIDDEN | Missing required scope |
| 404 | NOT_FOUND | Resource does not exist |
| 409 | CONFLICT | Resource already exists |
| 422 | UNPROCESSABLE_ENTITY | Valid request but business logic rejection |
| 429 | TOO_MANY_REQUESTS | Rate limit exceeded |
| 500 | INTERNAL_SERVER_ERROR | Tink server error |
| 503 | SERVICE_UNAVAILABLE | Tink service temporarily unavailable |
nil | NETWORK_ERROR | Connection / timeout failure |
nil | DECODE_ERROR | Invalid JSON in response body |
Pattern matching
case Tink.Accounts.list(client) do
{:ok, accounts} -> handle(accounts)
{:error, %Tink.Error{status: 401}} -> refresh_and_retry()
{:error, %Tink.Error{status: 403, code: code}} -> handle_missing_scope(code)
{:error, %Tink.Error{status: 429}} -> back_off_and_retry()
{:error, %Tink.Error{status: nil, code: "NETWORK_ERROR"}} -> handle_network_failure()
{:error, %Tink.Error{request_id: rid} = err} ->
Logger.error("Tink error request_id=#{rid}: #{Exception.message(err)}")
end
Summary
Functions
Returns true if the error is an authentication/authorization error.
Build a JSON decode error.
Build a structured error from an HTTP response.
Build a network-level error (no HTTP response received).
Returns true if the resource was not found.
Returns true if the error is retryable (429, 503, or network failure).
Types
@type t() :: %Tink.Error{ __exception__: true, code: String.t() | nil, details: map() | nil, message: String.t(), request_id: String.t() | nil, status: non_neg_integer() | nil }
Functions
Returns true if the error is an authentication/authorization error.
Build a JSON decode error.
@spec from_response(non_neg_integer(), map(), String.t() | nil) :: t()
Build a structured error from an HTTP response.
Tries the following keys in order to find the error code:
errorCode, error, code
Tries the following keys for the message:
errorMessage, error_description, message
Build a network-level error (no HTTP response received).
Returns true if the resource was not found.
Returns true if the error is retryable (429, 503, or network failure).