Guides
API Pix webhooks and errors

Pix webhooks

Register webhooks per key and per account, understand the /pix suffix, the payloads, the retries and how to resend.

The API Pix reports by webhook everything that happens with the money: received Pix, sent Pix, refunds made and received and, in Pix Automático, changes to recurrences and recurring charges.

Where to register

WebhookRegistrationDelivered toEvents
Per keyPUT /v2/webhook/:chavewebhookUrl + /pixReceived Pix, sent Pix (paying key) and refunds
RecurrencesPUT /v2/webhookrecwebhookUrl + /recRecurrence status changes
Recurring chargesPUT /v2/webhookcobrwebhookUrl + /cobrChanges to recurring charges and their attempts

One URL can serve several keys; each key has a single URL, and a new PUT replaces it.

Registration

bash
curl --request PUT \
  --url https://pix.efi.mimicr.dev/v2/webhook/<chave> \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "webhookUrl": "https://sua-app.dev/webhooks/efi" }'

Before saving, Mimicr sends POST https://sua-app.dev/webhooks/efi (without the suffix) with {"evento": "teste_webhook", "data_criacao": "…"}. The URL must answer 2xx. Otherwise:

nomemensagem
valor_invalidoInvalid URL, or "A URL do webhook deve usar o protocolo HTTPS"
webhook_invalido"A URL informada respondeu com o código HTTP 500" (or another code)
webhook_invalido"A URL informada atingiu o tempo limite de resposta"
webhook_invalido"A requisição na URL informada falhou com o erro: ECONNREFUSED"
chave_nao_encontradaThe key does not belong to the account

At the real Efí, registration also tests mTLS: a first POST without a certificate must be refused and a second one, with Efí's certificate, accepted (or you send x-skip-mtls-checking: true). Mimicr does no mTLS: a single test POST is enough, the header is ignored and http://localhost is accepted.

The /pix suffix

Efí appends /pix to the end of the registered URL. To avoid the suffix, end the URL with ?ignorar=: the /pix text becomes the parameter's value (https://sua-app.dev/webhook?ignorar=/pix).

Payloads

Received Pix:

json
{
  "pix": [
    {
      "endToEndId": "E09089356202610212340oZXrYiuEIGF",
      "txid": "f57c97eae45caa148f94074813876865",
      "chave": "d01efe21-d811-41a0-9634-6bb4e7802852",
      "valor": "5.00",
      "horario": "2026-10-21T23:40:03.282Z",
      "infoPagador": "Pagamento automático de homologação",
      "gnExtras": { "pagador": { "nome": "EFI SA - INSTITUICAO DE PAGAMENTO", "cnpj": "09089356000118", "codigoBanco": "09089356" }, "tarifa": "0.05" }
    }
  ]
}

gnExtras.pagador and gnExtras.tarifa only come when turned on in Save settings; with split, gnExtras.split comes. Pix without a txid are only notified with notificar.pixSemTxid: true. In Mimicr the fee is 1% of the amount, at least R$ 0.01.

Refund (one webhook per refund, with the original Pix and the refund that changed):

json
{
  "pix": [
    {
      "endToEndId": "E09089356202610212340oZXrYiuEIGF",
      "txid": "f57c97eae45caa148f94074813876865",
      "chave": "d01efe21-d811-41a0-9634-6bb4e7802852",
      "valor": "5.00",
      "horario": "2026-10-21T23:40:03.282Z",
      "devolucoes": [
        { "id": "D001", "rtrId": "D09089356202610212340HpsrIQO2Rcf", "valor": "1.00", "natureza": "ORIGINAL", "horario": { "solicitacao": "2026-10-21T23:40:17.898Z", "liquidacao": "2026-10-21T23:40:21.002Z" }, "status": "DEVOLVIDO" }
      ]
    }
  ]
}

Sent Pix (on the paying key): tipo: "SOLICITACAO", status REALIZADO or NAO_REALIZADO and gnExtras.idEnvio; when rejected, gnExtras.erro carries the SPI code and reason. See Pix send.

Pix Automático: {"recs": [...]} on /rec and {"cobsr": [...]} on /cobr, with status, atualizacao and, on charges, tentativas and pix. See Pix Automático.

Delivery and retries

  • POST with Content-Type: application/json, unsigned. Any 2xx is success.
  • Without a 2xx, Efí tries again: 9 attempts in total, the first immediate and the next after 5, 5, 5, 10, 20, 40, 80 and 160 minutes. Mimicr follows the same table, on the sandbox clock.
  • Efí waits up to 60 s for the response; Mimicr waits 10 s.
  • Every delivery is recorded in the console and in the control API's GET /v1/efi/deliveries, with status, attempts and the last response.

To skip the retries, advance the clock (npx mimicr clock efi +30m) or resend a delivery with POST /v1/efi/deliveries/{id}/resend.

Resend through the API

POST /v2/gn/webhook/reenviar is disabled in Efí's homologation and answers 500 WebhooksErroInterno; Mimicr does the same. Use the resend of the console or the control API.

Wait for a webhook in tests

bash
npx mimicr wait efi delivery kind=pix event=PIX_RECEBIDO
npx mimicr wait efi delivery kind=envio ref=envio0001
npx mimicr wait efi delivery kind=cobr status=success

kind is pix, devolucao, devolucao_recebida, envio, rec or cobr. See Sandbox control.