Guides
Statements

CNAB 240 statements

Schedule statement generation, list and download the account's CNAB 240 files, and understand the layout and the errors.

The Statements API (Extratos) delivers the Efí account statement as CNAB 240 files (bank reconciliation), generated daily, weekly or monthly. There is no webhook: you schedule, then list and download.

Efí (homologation)Mimicr
https://extratos-h.api.efipay.com.brhttps://extratos.efi.mimicr.dev

1. Get a token

bash
curl --request POST \
  --url https://extratos.efi.mimicr.dev/v1/oauth/token \
  --header 'Authorization: Basic <base64(client_id:client_secret)>' \
  --header 'Content-Type: application/json' \
  --data '{ "grant_type": "client_credentials" }'

Scopes: gn.cnab-statement.statement.write, gn.cnab-statement.statement.read and gn.cnab-statement.keys.write. Reference: Get a token (Statements).

2. Schedule

bash
curl --request POST \
  --url https://extratos.efi.mimicr.dev/v1/extrato-cnab/agendar \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "periodicidade": "diario", "envia_email": true, "comprimir_arquivos": false }'

The response is 201 with the plain text Recorrência criada com sucesso. There is one schedule per periodicity:

periodicidadeEach file covers
diarioThe previous day
semanalThe previous week, Monday to Sunday
mensalThe previous month

To change a schedule, use Update a schedule: the path identifier is the periodicity itself (/v1/extrato-cnab/agendar/diario), every field is required and status: inativo pauses generation. List schedules shows the current ones. In Mimicr envia_email is stored, but no e-mail goes out.

3. Wait for the period to close

A file is only generated when its period ends. In Mimicr, the first one is for the first period that ends after the schedule was created. To see today's daily file without waiting until tomorrow, advance the sandbox clock:

bash
npx mimicr clock efi +1d

For an ad hoc file with today's entries so far, without a schedule, use the extratos.generate_now action (Mimicr only; Efí only delivers closed periods):

bash
npx mimicr action efi extratos.generate_now comprimir=false

4. List and download

bash
curl --url https://extratos.efi.mimicr.dev/v1/extrato-cnab/arquivos \
  --header 'Authorization: Bearer <token>'
json
[
  { "nome": "EXTRATO_3575442_20261021_223457.RET", "data_geracao": "2026-10-22T01:34:57.289Z", "periodo_inicio": "2026-10-21", "periodo_fim": "2026-10-21" }
]
bash
curl --url https://extratos.efi.mimicr.dev/v1/extrato-cnab/download/EXTRATO_3575442_20261021_223457.RET \
  --header 'Authorization: Bearer <token>' \
  --output extrato.RET

The name follows Mimicr's pattern, EXTRATO_<conta>_<AAAAMMDD>[_<AAAAMMDD>].RET (Efí doesn't document its own); treat it as opaque. With comprimir_arquivos: true the download is a .zip (application/zip) with the .RET inside; otherwise text/plain in ISO-8859-1. References: List files and Download a file.

The file

Each line has 240 positions, ending in CRLF. The content is built at download time from the period's movements, the same ones that make up the sandbox balance.

text
36400000         2948858770001503575442             0000100000003575442 EXEMPLOS EFI   ...   (file header)
36400011E0440033 2948858770001503575442             0000100000003575442 EXEMPLOS EFI   ...   (batch header)
3640001300001E   ...                                                                         (segment E, one per entry)
36400015         2948858770001503575442             ...                                      (batch trailer)
36499999         000001000004000001   ...                                                    (file trailer)
RecordContent
0, file headerBank 364, CNPJ, branch and account, company name, EFI S.A., generation date and time, sequence number (NSA)
1, batch headerOperation E, service 04, layout 033, opening balance with date, D/C and position (P partial or F final), currency BRL
3, segment EEntry date, amount, D or C, FEBRABAN category, history and the transaction identifier
5, batch trailerClosing balance, record count, sum of debits and of credits
9, file trailerBatch and record counts

Amounts have 16 integer digits and 2 implied decimals; dates are DDMMAAAA. Daily and ad hoc files carry position P (partial) balances, as at Efí; weekly and monthly ones, F (final).

Entries in Mimicr's statement:

HistoryTypeCategory
PIX RECEBIDOC209
PIX REPASSE SPLITD120
DEVOLUCAO PIXD103
PIX ENVIADOD120
DEVOLUCAO PIX RECEBIDAC204
PIX OPEN FINANCE, PIX AUTOMATICO OFC209
DEVOLUCAO OPEN FINANCED103
PAGAMENTO DE CONTAD112

The history codes and descriptions are Mimicr's: Efí's manual documents the layout, not the codes.

SFTP keys

Generate SFTP keys creates a key pair and returns {"privateKey": "-----BEGIN PRIVATE KEY-----..."}; the previous key stops working. Mimicr has no SFTP server, so the key is only for testing the flow.

Errors

Every Statements API error is 400 with {"mensagem": "..."}:

mensagemWhen
Arquivo não encontradoDownload of an unknown name
O campo periodicidade deve ser diario, semanal ou mensalInvalid periodicity
O campo <campo> é obrigatórioMissing field when scheduling or updating
Os campos envia_email e comprimir_arquivos devem ser booleanosWrong types
Já existe uma recorrência com periodicidade diarioA second schedule for the same periodicity
Recorrência não encontradaUpdating a periodicity that isn't scheduled
A periodicidade do corpo deve ser a mesma do identificadorBody and path differ
O campo status deve ser ativo ou inativoInvalid status
Conta inválidagerar-chaves with a conta that isn't the sandbox's

Authentication uses 401 invalid_client, 401 invalid_token and 403 insufficient_scope, like the other APIs. Unknown route: 404 {"mensagem": "Rota não encontrada: …"}. Chaos for the extratos area can return 500, 503 or 429 with {mensagem}.