Guides
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.br | https://extratos.efi.mimicr.dev |
1. Get a token
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
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:
periodicidade | Each file covers |
|---|---|
diario | The previous day |
semanal | The previous week, Monday to Sunday |
mensal | The 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:
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):
npx mimicr action efi extratos.generate_now comprimir=false
4. List and download
curl --url https://extratos.efi.mimicr.dev/v1/extrato-cnab/arquivos \ --header 'Authorization: Bearer <token>'
[
{ "nome": "EXTRATO_3575442_20261021_223457.RET", "data_geracao": "2026-10-22T01:34:57.289Z", "periodo_inicio": "2026-10-21", "periodo_fim": "2026-10-21" }
]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.
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)
| Record | Content |
|---|---|
| 0, file header | Bank 364, CNPJ, branch and account, company name, EFI S.A., generation date and time, sequence number (NSA) |
| 1, batch header | Operation E, service 04, layout 033, opening balance with date, D/C and position (P partial or F final), currency BRL |
| 3, segment E | Entry date, amount, D or C, FEBRABAN category, history and the transaction identifier |
| 5, batch trailer | Closing balance, record count, sum of debits and of credits |
| 9, file trailer | Batch 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:
| History | Type | Category |
|---|---|---|
PIX RECEBIDO | C | 209 |
PIX REPASSE SPLIT | D | 120 |
DEVOLUCAO PIX | D | 103 |
PIX ENVIADO | D | 120 |
DEVOLUCAO PIX RECEBIDA | C | 204 |
PIX OPEN FINANCE, PIX AUTOMATICO OF | C | 209 |
DEVOLUCAO OPEN FINANCE | D | 103 |
PAGAMENTO DE CONTA | D | 112 |
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": "..."}:
mensagem | When |
|---|---|
Arquivo não encontrado | Download of an unknown name |
O campo periodicidade deve ser diario, semanal ou mensal | Invalid periodicity |
O campo <campo> é obrigatório | Missing field when scheduling or updating |
Os campos envia_email e comprimir_arquivos devem ser booleanos | Wrong types |
Já existe uma recorrência com periodicidade diario | A second schedule for the same periodicity |
Recorrência não encontrada | Updating a periodicity that isn't scheduled |
A periodicidade do corpo deve ser a mesma do identificador | Body and path differ |
O campo status deve ser ativo ou inativo | Invalid status |
Conta inválida | gerar-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}.