Guides
API Pix errors
The three error formats of Efí's API Pix, where each one shows up and the most common codes.
Efí's API Pix has no single error envelope. Depending on the endpoint, the error comes in one of three formats, and your integration must handle all three. Mimicr returns the same format Efí uses on each endpoint.
1. {nome, mensagem}
Efí's classic format, used on cob, loc, received Pix, refunds, per-key webhooks, Pix send, random keys and settings:
{ "nome": "cobranca_nao_encontrada", "mensagem": "Nenhuma cobrança encontrada para o txid informado" }Schema errors carry erros, in AJV style:
{
"nome": "json_invalido",
"mensagem": "Valores ou tipos de campo inválidos",
"erros": [{ "chave": "pattern", "caminho": ".body.valor.original", "mensagem": "deve corresponder ao padrão \"^\\d{1,10}\\.\\d{2}$\"" }]
}On these endpoints, "not found" is 400, not 404: cobranca_nao_encontrada, location_nao_encontrada, pix_nao_encontrado and devolucao_nao_encontrada.
2. BACEN's problem+json
Used on cobv, batches, split, MED, reports, receipts, QR code detail and payment, sent Pix queries and all of Pix Automático:
{
"type": "https://pix.bcb.gov.br/api/v2/error/CobVOperacaoInvalida",
"title": "Cobrança inválida.",
"status": 400,
"detail": "A requisição que busca alterar ou criar uma cobrança com vencimento não respeita o _schema_ ou está semanticamente errada.",
"violacoes": [{ "razao": "O objeto cobv.devedor não respeita o _schema_.", "propriedade": "cobv.devedor" }]
}The last part of type identifies the error (NaoEncontrado, AcessoNegado, RecOperacaoInvalida…) and violacoes tells which field failed.
3. OAuth
Used on the token and for missing scopes:
{ "error": "insufficient_scope", "error_description": "Access token has insufficient scope" }Most common codes
| Status | Error | Where |
|---|---|---|
| 400 | json_invalido | Body outside the schema (format 1) |
| 400 | chave_invalida | Key that is not the account's on cob or send |
| 400 | valor_invalido | Amount, expiration, CPF/CNPJ, list dates or webhook URL |
| 400 | webhook_invalido | The webhook URL did not answer the test with 2xx |
| 400 | status_cobranca_invalido | Revising a cob that is not ATIVA |
| 400 | CobVOperacaoInvalida, RecOperacaoInvalida, CobROperacaoInvalida, SolicRecOperacaoInvalida | Validation in format 2 |
| 401 | invalid_client, invalid_token | Credentials or token |
| 403 | insufficient_scope | Token without the endpoint's scope |
| 403 | AcessoNegado | Authorization rule (for example, same-ownership send in homologation) |
| 404 | NaoEncontrado, PixEnviadoNaoEncontrado | Resource does not exist (format 2) |
| 404 | chave_favorecido_nao_encontrada | The payee's key does not exist |
| 409 | txid_duplicado, devolucao_id_duplicado, id_envio_duplicado | Id already used |
| 422 | pagamento_negado | Send above R$ 20.00 in homologation |
| 429 | balde_fichas_vazio | Too many sends in the last minute |
| 500 | WebhooksErroInterno | POST /v2/gn/webhook/reenviar in homologation |
Every reference page lists the endpoint's errors. Examples: Create a charge, Create a due-date charge and Send a Pix.
Infrastructure failures
With controlled chaos on, any endpoint may be slow or answer 500, 503 or 429 before or after processing. The bodies are Efí's: 500 erro_interno_servidor and 429 "Limite de Requisições Excedido" in format 1, 503 ServicoIndisponivel in format 2. Treat 5xx as "uncertain outcome": query the resource (for example, GET /v2/gn/pix/enviados/id-envio/:idEnvio) before repeating. See Sandbox control.