Account reporting via camt.053 bank statements.
ClearBank generates ISO 20022 camt.053 statement files on request. Statements are paginated — request generation, then retrieve page-by-page.
Workflow
- Call
request_statement/2with your date range and account. - The response includes a
messageId. - Poll
get_statement_page/3with themessageIdand page numbers until you have all pages (checktotalPagesin the response).
Examples
{:ok, %{"messageId" => msg_id}} = ClearBank.Accounts.Reporting.request_statement(client,
account_id: "acct-uuid",
start_date: "2024-01-01",
end_date: "2024-01-31"
)
{:ok, page} = ClearBank.Accounts.Reporting.get_statement_page(client, msg_id, 1)
Summary
Functions
Fetches all pages of a statement and returns them as a list.
Downloads a specific page of a generated camt.053 statement.
Requests generation of a camt.053 statement.
Functions
@spec get_all_pages(ClearBank.Client.t(), String.t()) :: {:ok, [map()]} | {:error, term()}
Fetches all pages of a statement and returns them as a list.
Makes sequential HTTP calls until all pages are retrieved. For large statements, consider streaming page-by-page instead.
Examples
{:ok, all_pages} = ClearBank.Accounts.Reporting.get_all_pages(client, "msg-uuid")
@spec get_statement_page(ClearBank.Client.t(), String.t(), pos_integer()) :: ClearBank.HTTP.result()
Downloads a specific page of a generated camt.053 statement.
Examples
{:ok, page_data} = ClearBank.Accounts.Reporting.get_statement_page(client, "msg-uuid", 1)
@spec request_statement( ClearBank.Client.t(), keyword() ) :: ClearBank.HTTP.result()
Requests generation of a camt.053 statement.
Required params
:account_id- the real account UUID:start_date- ISO 8601 date string, e.g."2024-01-01":end_date- ISO 8601 date string, e.g."2024-01-31"
Optional params
:currency- ISO 4217 code (default:"GBP"):include_virtual- boolean, include virtual account transactions
Examples
{:ok, resp} = ClearBank.Accounts.Reporting.request_statement(client,
account_id: "acct-uuid",
start_date: "2024-01-01",
end_date: "2024-01-31",
currency: "GBP"
)