Guides
API Pix webhooks and errors

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:

json
{ "nome": "cobranca_nao_encontrada", "mensagem": "Nenhuma cobrança encontrada para o txid informado" }

Schema errors carry erros, in AJV style:

json
{
  "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:

json
{
  "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:

json
{ "error": "insufficient_scope", "error_description": "Access token has insufficient scope" }

Most common codes

StatusErrorWhere
400json_invalidoBody outside the schema (format 1)
400chave_invalidaKey that is not the account's on cob or send
400valor_invalidoAmount, expiration, CPF/CNPJ, list dates or webhook URL
400webhook_invalidoThe webhook URL did not answer the test with 2xx
400status_cobranca_invalidoRevising a cob that is not ATIVA
400CobVOperacaoInvalida, RecOperacaoInvalida, CobROperacaoInvalida, SolicRecOperacaoInvalidaValidation in format 2
401invalid_client, invalid_tokenCredentials or token
403insufficient_scopeToken without the endpoint's scope
403AcessoNegadoAuthorization rule (for example, same-ownership send in homologation)
404NaoEncontrado, PixEnviadoNaoEncontradoResource does not exist (format 2)
404chave_favorecido_nao_encontradaThe payee's key does not exist
409txid_duplicado, devolucao_id_duplicado, id_envio_duplicadoId already used
422pagamento_negadoSend above R$ 20.00 in homologation
429balde_fichas_vazioToo many sends in the last minute
500WebhooksErroInternoPOST /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.