Skip to navigation

Upload a bank statement

View as Markdown

One file per request, multipart/form-data, 10 MB maximum.

camt.053 XML — the owning account is resolved from the IBAN in the statement header, creating the account if the workspace does not have it yet (subject to the plan’s bank-account limit); bank_account_id is ignored. Import is synchronous, so the response already carries transactions_created and transactions_skipped, and period_from/period_to come from the statement header. Re-uploading the same statement is safe: already-known transactions are reported as skipped rather than duplicated.

PDF — bank_account_id names the target bank account; it may be omitted only when the workspace has exactly one bank account or a default one. Cash registers are not valid targets. extract controls AI extraction on a PDF. Defaults to true whenever quota covers it (and the first read of each calendar month is free on bank-fed accounts). When omitted and quota is exhausted, the statement is archived unread (extraction_status: manual, extraction_skipped_reason: quota). When set explicitly to true and quota is exhausted, the request returns 429. Because a PDF’s covered period is not knowable up front, you may state it with period_from/period_to.

Requires the manage:bank_accounts scope — a write-scoped key cannot upload.

Authentication

AuthorizationBearer

JWT issued via POST /api/v1/auth/sign_in. Used by mobile and SPA clients. Revoked tokens are rejected.

OR
AuthorizationBearer

Lucanto API key. Two prefixes:

  • lct_pat_<random><checksum> — personal access token (owner: User)
  • lct_live_<random><checksum> — workspace token, live data

Issue keys at /settings/api_keys (personal) or /:workspace_id/settings/api_keys (workspace). Plaintext token is shown once and never again.

Path parameters

workspace_idlongRequired>=1
Workspace ID. The numeric ID shown in your URLs.

Headers

Idempotency-KeystringOptional<=255 characters

Client-supplied unique key (recommended: UUID v4) for safe retries. Within 24 hours, repeating the same key with the same request (method, path, query, body) replays the original response instead of re-executing the action — once the action has run, a 5xx included; a request stopped before it ran is not stored. Reusing a key with a different request returns 422 idempotency_key_conflict (IETF draft §2.7).

Request

This endpoint expects a multipart form containing a file.
filefileRequired

The statement file — .xml (camt.053) or .pdf, 10 MB maximum.

bank_account_idlong or stringOptional
Target account for a PDF. Ignored for XML, which identifies its own account. Omit only when the workspace has a single or default bank account.
extractbooleanOptional

Run AI extraction on a PDF. Defaults to true whenever quota covers it (the first read each month is free on bank-fed accounts). When omitted and quota is exhausted, the PDF is archived unread rather than refused. When explicitly true, an over-quota upload returns 429.

period_fromdateOptional
Period the PDF covers, first day. Ignored for XML.
period_todateOptional
Period the PDF covers, last day. Ignored for XML.

Response

Created. For a PDF queued for extraction the statement exists but is still being read — extraction_status is pending.

idlong
public_idstringRead-onlyformat: "^[a-z]+_[0-7][0-9a-hjkmnp-tv-z]{25}$"

Stable public identifier of this record. Never changes once assigned. Its prefix names the entity: doc_ document (invoice, proforma, credit note, quote, sales order), exp_ expense, cnt_ contact, prj_ project, ba_ bank account or cash register, txn_ transaction, lon_ loan, bst_ bank statement. Accepted in place of the numeric id in this resource’s path parameters and in request fields that reference it (customer_id, bank_account_id, …).

bank_account_idlong
file_typeenum
Allowed values:
sourceenum

psd2 — downloaded by a bank connection. manual — uploaded, whether through the app or this API.

Allowed values:
extraction_statusenum

AI extraction state, PDF only. manual means no extraction was ever requested — the normal terminal state for an archived PDF and for every XML statement, whose transactions come from parsing, not AI.

Allowed values:
created_atdatetime
updated_atdatetime
bank_accountobjectOptional

Slim embed of the owning account — identity only, no balances.

period_fromdate or nullOptional
First day covered by the statement. Read from the camt.053 header for XML, supplied by the caller for PDF, null when neither applies.
period_todate or nullOptional

Last day covered by the statement. Same semantics as period_from.

original_filenamestring or nullOptional
extraction_skipped_reasonenum or nullOptional

Why AI extraction was not run on an uploaded PDF. quota means extraction was omitted because AI extraction quota was exhausted (the statement was archived unread). null when extraction ran, was explicitly turned off (extract: false), or for XML statements.

Allowed values:
extraction_errorstring or nullOptional
Why extraction failed
extraction_completed_atdatetime or nullOptional
transactions_createdinteger or nullOptional

Transactions this statement produced. Populated on import; 0 for an archived PDF until extraction completes.

transactions_skippedinteger or nullOptional
Rows recognised as already present and therefore not duplicated.
entry_countsmap from strings to integersOptional

Rows in the AI-extraction staging area, grouped by status, e.g. {"imported": 42, "pending": 3}.

Only PDF statements that went through extraction have these — an extracted PDF stages its rows for review before they become transactions. XML statements are always {}: camt.053 parsing creates transactions directly, with no staging step, so transactions_created / transactions_skipped is where an XML import reports itself.

reconciliation_modeenum or nullOptional

What the statement is for. import — its rows become transactions. compare — the account already receives its transactions from the bank (PSD2), so the statement only checks the sync: see comparison. null — not decided yet.

Allowed values:
comparisonobject or nullOptional

null unless reconciliation_mode is compare. Computed from the account’s state at request time. An XML statement’s matched count and the transactions it claims come from its comparison, stored when the file was read; only the split of its unmatched rows by the sync coverage (missing, awaiting_bank, fetchable, before_sync) is recomputed.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error