Skip to main content

Async Reports

Statement and transaction reports are generated asynchronously. You start a job, poll it until it finishes, then download the resulting file(s). Reports for large periods are split into multiple parts and may be produced in more than one file format.

There are two report types, each with an identical lifecycle:

Report typeBase pathWhat it contains
statements/v2/account/reports/statementsAll balance changes (the same data as Account Statement)
transactions/v2/account/reports/transactionsTicket/transaction history, with rich filters

All endpoints below authenticate as the current account (same Bearer token as the rest of the /v2/account API). Identity is always taken from the token — any userId in a request body is ignored. Pass subAccountId to scope a report to a sub-account.

Lifecycle

POST   /v2/account/reports/{type}              → 202  { jobId, status: "running" }
GET /v2/account/reports/{type}/{jobId} → 200 { status, fileUrls, ... } (poll until "success")
GET /v2/account/reports/{type}/{jobId}/download?format=&part= → 302 redirect to presigned S3 URL
GET /v2/account/reports/{type} → 200 { reports: [...] } (list past jobs)

Job status is one of: queued, running, success, failed.

1. Generate a report

POST /v2/account/reports/statements

FieldTypeRequiredDescription
periodStartStringYesStart of the period. YYYY-MM-DD or RFC3339 (e.g. 2025-06-01).
periodEndStringYesEnd of the period (see Period rules).
formatStringNoOne of ofx, xlsx, pdf, csv, json. Default xlsx.
maxStatementsPerFileNumberNoSplit output into files of at most N rows. 1500000.
descriptionStringNoFilters entries by description (partial, case-insensitive match). See Statement description filter.
subAccountIdStringNoGenerate the report for a sub-account instead of the main account.

Statement description filter

description is a substring filter — it is not a fixed list, so any text is accepted and matches entries whose description contains it. Statement entry descriptions follow the shape:

[DEBIT|CREDIT] <event>: <detail>

The vast majority of entries are ticket movements. Useful substrings to filter on:

SubstringMatches
BurnTicket inputs (the token burned to pay a ticket).
deliveryTicket outputs (the token delivered by a ticket).
markupMarkup deliveries.
rebateRebate deliveries.
transfer failedDeliveries re-credited after an off-chain transfer failed (also Pix failed).
conversionToken conversions (e.g. USDT → USDC).
EoD settlementEnd-of-day settlement mints/burns.
USDM yieldDaily USDM yield distributions.

Common full descriptions (token varies — BRLA, USDC, USDT, EURC):

  • [DEBIT] Process ticket input: Burn BRLA for ticket payment
  • [CREDIT] Process ticket output: BRLA delivery
  • [CREDIT] Process ticket output: USDC markup delivery
  • [CREDIT] Process ticket output: BRLA delivery because Pix failed
  • [DEBIT] Process ticket input and output: Burn USDT for ticket payment

POST /v2/account/reports/transactions

FieldTypeRequiredDescription
periodStartStringYesStart of the period. YYYY-MM-DD or RFC3339.
periodEndStringYesEnd of the period (see Period rules).
formatStringNoOne of xlsx, csv, json. Default xlsx.
maxRecordsPerFileNumberNoSplit output into files of at most N records. 1500000.
includeSubAccountsBooleanNoInclude all sub-account transactions in the report.
subAccountIdStringNoScope the report to a single sub-account.
statusStringNoFilter by transaction status.
hasFailureReasonStringNo"true" / "false".
endToEndIdStringNoFilter by PIX end-to-end ID.
cpTaxIdStringNoFilter by counterparty tax ID.
minAmountIn / maxAmountInNumberNoFilter by inbound amount range.
minAmountOut / maxAmountOutNumberNoFilter by outbound amount range.
coinIn / coinOutStringNoFilter by input/output coin (e.g. BRLA, USDC).
walletIn / walletOutStringNoFilter by input/output wallet address.
operationTypeStringNoFilter by operation type.

cUrl Example

curl -X POST "https://api.sandbox.avenia.io:10952/v2/account/reports/transactions" \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"periodStart": "2025-06-01",
"periodEnd": "2025-06-30",
"format": "csv",
"includeSubAccounts": true,
"coinOut": "BRLA"
}'

Response — 202 Accepted

{
"jobId": "b3f1c9e2-8a4d-4e77-9c21-1a2b3c4d5e6f",
"status": "running",
"message": "Report generation started"
}

jobIds (a { format: jobId } map) may also be present when a request produces more than one job. Use jobId to poll and download.

2. Poll job status

GET /v2/account/reports/{type}/{jobId}

curl -X GET "https://api.sandbox.avenia.io:10952/v2/account/reports/transactions/b3f1c9e2-8a4d-4e77-9c21-1a2b3c4d5e6f" \
-H "Authorization: Bearer <YOUR_TOKEN>"

Poll until status is success (or failed). Once succeeded, fileUrls lists every produced file, grouped by extension and split into parts.

{
"jobId": "b3f1c9e2-8a4d-4e77-9c21-1a2b3c4d5e6f",
"status": "success",
"period": "2025-06-01 to 2025-06-30",
"generatedAt": "2025-07-01T03:12:44Z",
"fileUrls": [
{
"extension": "csv",
"parts": [
{
"partNumber": 1,
"url": "https://s3.eu-west-1.amazonaws.com/...&X-Amz-Signature=...",
"sizeBytes": 148213,
"recordCount": 2944
}
]
}
],
"s3Prefix": "production/.../2025/07/01/..."
}

When a job fails, status is failed and errorMessage explains why.

The presigned url values in fileUrls are short-lived. If they expire, either poll again for fresh URLs or use the download endpoint below.

3. Download a file

GET /v2/account/reports/{type}/{jobId}/download

Redirects (302) to a freshly presigned S3 URL. Follow the redirect to fetch the file.

Query paramRequiredDescription
formatConditionalFile extension to download. Required when the job produced more than one format.
partNoPart number for multipart reports. Default 1.
curl -L "https://api.sandbox.avenia.io:10952/v2/account/reports/transactions/b3f1c9e2-8a4d-4e77-9c21-1a2b3c4d5e6f/download?format=csv&part=1" \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-o report.csv

4. List past reports

GET /v2/account/reports/{type}

Query paramDescription
statusFilter by job status.
limitMaximum number of jobs to return.
{
"reports": [
{
"jobId": "b3f1c9e2-8a4d-4e77-9c21-1a2b3c4d5e6f",
"reportType": "transactions",
"outputFormat": "csv",
"periodStart": "2025-06-01",
"periodEnd": "2025-06-30",
"status": "success",
"fileUrls": [ { "extension": "csv", "parts": [ /* ... */ ] } ],
"createdAt": "2025-07-01T03:11:02Z",
"updatedAt": "2025-07-01T03:12:44Z"
}
]
}

Period rules

The requested period must describe fully-closed UTC days so the dataset is complete and reconcilable:

  • periodStart cannot be in the future.
  • periodEnd must be before today's midnight UTC — you cannot report on the current (still-open) day.
  • The period cannot exceed 12 months.

Quota

Each account may start up to 20 report requests per day. Requests beyond the quota are rejected.