Guides
Boleto and Bolix
Authenticate on the Billing API, issue a boleto with a Pix QR Code and simulate payment, due date and write-off.
Efí's Billing API (API Cobranças) issues boletos, card charges, payment links, carnês and subscriptions. It has its own host, uses no certificate (mTLS) and answers in the {code, data} envelope. This guide covers the boleto, from token to payment.
| Efí (homologation) | Mimicr |
|---|---|
https://cobrancas-h.api.efipay.com.br | https://cobrancas.efi.mimicr.dev |
The credentials (Client_Id and Client_Secret) are those of the Efí sandbox in Mimicr; see the console or GET https://api.mimicr.dev/v1/efi.
1. Get a token
curl --request POST \
--url https://cobrancas.efi.mimicr.dev/v1/authorize \
--header 'Authorization: Basic <base64(client_id:client_secret)>' \
--header 'Content-Type: application/json' \
--data '{ "grant_type": "client_credentials" }'{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 600,
"expire_at": "1792629300075",
"token_type": "Bearer"
}The token is valid for 600 seconds and works only on the Billing API; get a new one when it expires. This response has no {code, data} envelope. Wrong credentials answer 401 with {"code": 3500008, "error": "unauthorized", ...}. Reference: Get a token (Billing).
2. Create the charge
The two-step flow creates the charge and then sets the payment method. Amounts are always integers in cents.
curl --request POST \
--url https://cobrancas.efi.mimicr.dev/v1/charge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"items": [{ "name": "Meu Produto", "value": 5990, "amount": 1 }],
"metadata": { "custom_id": "pedido-1042", "notification_url": "https://sua-app.dev/webhooks/efi" }
}'{ "code": 200, "data": { "charge_id": 1000001, "status": "new", "total": 5990, "custom_id": "pedido-1042", "created_at": "2026-10-21 21:25:00" } }With notification_url, every status change generates a notification (see Notifications). Reference: Create a charge.
3. Issue the boleto
curl --request POST \
--url https://cobrancas.efi.mimicr.dev/v1/charge/1000001/pay \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"payment": {
"banking_billet": {
"customer": { "name": "Gorbadoc Oldbuck", "cpf": "94271564656", "email": "oldbuck@efipay.com.br", "phone_number": "5144916523" },
"expire_at": "2026-10-26",
"configurations": { "fine": 200, "interest": 33 },
"message": "Pagável em qualquer banco"
}
}
}'{
"code": 200,
"data": {
"barcode": "36490.00001 01000.001600 41050.126113 1 16110000005990",
"pix": { "qrcode": "00020101021226940014BR.GOV.BCB.PIX2572qrcodespix.efi.mimicr.dev/bolix/v2/cobv/...", "qrcode_image": "data:image/svg+xml;base64,..." },
"link": "https://cobrancas.efi.mimicr.dev/emissao/72428de99f...",
"billet_link": "https://cobrancas.efi.mimicr.dev/emissao/72428de99f...",
"pdf": { "charge": "https://cobrancas.efi.mimicr.dev/emissao/72428de99f....pdf" },
"expire_at": "2026-10-26",
"charge_id": 1000001,
"status": "waiting",
"total": 5990,
"payment": "banking_billet"
}
}In Mimicr, every boleto is a Bolix: the linha digitável belongs to bank 364 (Efí), with valid check digits, and pix.qrcode is a Pix copia e cola. link and pdf open the test boleto. The status goes to waiting.
To do it all in one call, use Create a one-step charge with the same payment.
| Rule | Error |
|---|---|
name with first and last name, cpf with 11 digits (or juridical_person) | 3500034 validation_error |
expire_at today or later | 4600007 invalid_expire_at |
fine from 0 to 1000 (200 = 2%), daily interest from 1 to 33 | 3500034 |
| The charge already has a payment method | 3500030 payment_already_defined |
Discount (discount), conditional discount (conditional_discount) and days_to_write_off (default 89 in Mimicr) are in Set the payment method.
4. Simulate the payment
Efí offers no way to pay a boleto in homologation. In Mimicr, the payer and the bank live in the control API (or in the console, under Efí → Boletos, cartão e links):
curl --request POST \
--url https://api.mimicr.dev/v1/efi/actions/cobrancas.charge \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "id": "1000001", "action": "pagar" }'{ "ok": true, "action": "cobrancas.charge", "message": "Cobrança 1000001: paid.", "data": { "kind": "charge", "ref": "1000001", "status": "paid" } }With the CLI: npx mimicr action efi cobrancas.charge id=1000001 action=pagar. Paid after the due date, the amount includes fine and interest; until the conditional discount date, the discount. The paid notification carries value and received_by_bank_at.
Other cobrancas.charge actions for a boleto:
action | Effect |
|---|---|
pagar | The payer pays: paid (also from unpaid or canceled) |
identificar | Payment identified before it's credited (waiting or unpaid): identified, which becomes paid on its own within a few seconds (or right away, with pagar) |
vencer | Past the due date: unpaid |
expirar | Past the write-off period: expired |
baixa | Manual write-off: settled |
cancelar | Cancels: canceled |
Without actions, time acts too: a waiting boleto becomes unpaid the day after its due date and expired after days_to_write_off days. Advance the sandbox clock to see it (see Sandbox control).
Paying this boleto's linha digitável through the Bill payment API of the same sandbox also settles the charge, when the bill payment reaches LIQUIDADO (see Bill payment).
5. After issuing
| To | Use |
|---|---|
| Look it up | Get a charge, with history and the boleto |
| List by period | List charges with charge_type=billet |
| Postpone the due date | Update the boleto due date (waiting or unpaid) |
| Write off without money | Mark as paid: settled |
| Cancel | Cancel a charge (new, waiting, unpaid or link) |
Change custom_id or URL | Update charge metadata |
| Resend by e-mail | Resend the boleto (in Mimicr, no e-mail is sent) |
Boleto statuses and transitions:
new ──pay──▶ waiting ──pagar──▶ paid
├──identificar──▶ identified ──a few seconds──▶ paid
├──due date──▶ unpaid ──pagar──▶ paid
│ └──days_to_write_off──▶ expired
├──settle──▶ settled
└──cancel──▶ canceled ──pagar──▶ paid