Documentation › Help
Troubleshooting
What to do about 401, 403, 404, 409, 412, 422 and 429 responses, missing webhooks and stalled invoices.
Each problem ends with the next step. If none of them solves it, send support
the call's X-Request-Id.
I got 401
The key did not arrive or is not valid. Check that:
- the header is
Authorization: Bearer sdr_..., with the space afterBearer; - the key has not been revoked (dashboard, Integrações › Chaves de API);
- the URL includes
/api:https://api.sudrel.com.br/api/v1/....
I got 403
The key is not allowed to do this. Two causes:
- Test key (
sdr_test_) on a production-only operation: creating or changing a company, uploading a certificate, reading received documents. Use asdr_live_key. - Key restricted to one company accessing another (
acesso_negado) or managing webhooks (chave_restrita). Use an unrestricted key.
I got 404 for an invoice or company that exists
It exists in the other environment. The test key only sees test invoices, and the production key only production ones. Check the key prefix.
I got 412
The company cannot issue: readiness has an item in bloqueio. The body carries
the list in itens, with correcao on each. Fix it and issue again. See
Readiness.
I got 202
It is not an error. The invoice is transmitindo and Sudrel keeps handling
it. Wait for the webhook or query GET /v1/nfse/{id}. Do not issue again.
I got 409
Read codigo:
referencia_duplicada: the invoice already exists. Query it by the error'snfse_id.idempotencia_conflito: the sameIdempotency-Keywas used for another body. Generate one key per invoice.conflito: the sameIdempotency-Keyis still in progress. Wait a few seconds and repeat.referencia_ambigua: the reference exists in two companies. Repeat with?empresa_id=.
See Idempotency.
I got 422
Read codigo, then erros (each with campo, mensagem and
correcao):
validacao: the JSON has an error and nothing was created. Fix the items inerros.nfse_rejeitada: the Sistema Nacional refused it. Readcodigo_oficialandnfse.rejeicao.explicacao, fix it and issue a new invoice.tipo_invalidoon/valoror a rate: send it as a string,"1500.00".
I got 429
More than 120 requests in the minute on this key. Wait for the minute to roll over and repeat. If it happens all the time, replace repeated polling with webhooks and single invoices with batches.
The webhook did not arrive
- Check that the webhook is subscribed to the event type
(
GET /v1/webhooks/{id}) and isativo. - Check the environment: a webhook created with the test key only receives test events.
- See the attempts in
GET /v1/webhooks/{id}/entregas: the HTTP status your server returned, ornullwhen it did not even connect. - Your server must respond 2xx within 10 seconds. Redirects (3xx) are not followed and count as a failure. Internal network addresses are refused.
- Send a test:
POST /v1/webhooks/{id}/teste. - Recover what you missed:
POST /v1/webhooks/{id}/reenvio, or readGET /v1/eventos.
The webhook signature does not match
- Compute the HMAC over the raw body, the exact bytes, before any
JSON.parse. Re-serializing the JSON changes the bytes. - The HMAC key is the secret as text, exactly as it came on creation.
- Use
X-Sudrel-Signature-V2: the HMAC is of"<t>.<corpo>", not just the body. - During secret rotation two
v1=come: one match is enough. - Check the server clock: the recommended tolerance is 5 minutes.
The invoice seems stuck
GET /v1/nfse/{id}: checkstatusand the timeline ineventos.transmitindowithaviso.codigo = "processamento_prolongado": Sudrel is still handling it. Do not issue again.aguardando_confirmacao: it is waiting for you atPOST /v1/nfse/{id}/confirmacao.falha_transmissao: readfalha.dps_enviadabefore anything else.- Check the service status on the status page.
I cannot find a call I made
Look up the X-Request-Id (or requisicao_id) in Integrações › Log da
API (Integrations › API log), in the dashboard. The request and the response
are kept there for 30 days.