Documentation › Help
Troubleshooting
What to do on 401, 403, 404, 409, 412, 422, 429, a webhook that does not arrive and a stuck invoice.
Each problem ends with the next step. If none of them solves it, send
support the X-Request-Id of the call.
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 was not revoked (dashboard, Integrações › Chaves de API (Integrations › API keys));
- the address has
/api:https://api.sudrel.com.br/api/v1/....
I got 403
The key cannot do this. Two causes:
- Test key (
sdr_test_) in 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 a key without restriction.
I got 404 for an invoice or company that exists
It exists in the other environment. The test key sees only 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 in each one. Fix it and issue again. See
Readiness.
I got 202
It is not an error. The invoice is transmitindo and Sudrel is still 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 thenfse_idin the error.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, and 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 NFS-e refused it. Readcodigo_oficialandnfse.rejeicao.explicacao, fix it and issue a new invoice.tipo_invalidoin/valoror in a tax rate: send it as text,"1500.00".
I got 429
More than 120 requests in the minute on this key. Wait for the next minute and repeat. If it happens all the time, replace repeated queries with webhooks and single invoices with batches.
The webhook did not arrive
- Check that the webhook subscribes to the event type (
GET /v1/webhooks/{id}) and that it 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 failures. 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. Reserializing the JSON changes the bytes. - The HMAC key is the secret as text, exactly as it came at creation.
- Use
X-Sudrel-Signature-V2: the HMAC is of"<t>.<corpo>", not just the body. - During a secret rotation two
v1=values come: one match is enough. - Check the server clock: the recommended tolerance is 5 minutes.
The invoice seems stuck
GET /v1/nfse/{id}: seestatusand the timeline ineventos.transmitindowithaviso.codigo = "processamento_prolongado": Sudrel is still handling it. Do not issue again.aguardando_confirmacao: it is waiting for you inPOST /v1/nfse/{id}/confirmacao.falha_transmissao: readfalha.dps_enviadabefore anything else.- See the service situation on the status page.
I cannot find a call I made
Search for the X-Request-Id (or requisicao_id) in Integrações › Log da
API (Integrations › API log), in the dashboard. The request and the response stay there for 30 days.