Sudrel API
Dashboard Create API key

Documentation › Testing

Guides

Failure simulator

Trigger timeouts, rejections, Sefin outages and transmission failures with your test key.

Only with the sdr_test_ key. Send the X-Sudrel-Simular header on POST /v1/nfse (or the simular field in each item of POST /v1/lotes). The simulated invoice goes through the SAME states, events, webhooks and timeline as a real invoice, but never goes to the Sefin, not even to the test environment: Sudrel is the one responding. It does not consume the company's numbering (the DPS goes out in series 49998), the access key starts with seven zeros, the PDF is stamped SIMULAÇÃO and the resource carries simulacao with the scenario. With the production key, a simulation request is 422 simulacao_so_no_sandbox.

Real timings are accelerated for simulated invoices: the 2 minutes until recovery asks about the DPS become 5 seconds, the 30 minutes for the prolonged processing warning become 20 seconds, and the 7 days until falha_transmissao become 1 minute.

Scenario What you see
autorizada_lenta With the default wait (10 s), 202 with transmitindo; authorized in about 15 s. Webhook NFSE_AUTORIZADA.
rejeicao:<codigo> 422 with the invoice rejeitada, rejeicao.codigo_oficial equal to the requested code and rejeicao.explicacao when it is in the catalog (e.g. rejeicao:E0240). Webhook NFSE_REJEITADA.
timeout_depois_autorizada 202 with transmitindo. The transmission "drops", recovery queries the DPS, finds the invoice and it becomes autorizada, just ONE, without resending. Timeline: envio (technical error), consulta_dps (found), recuperada. Webhook NFSE_AUTORIZADA.
sefin_fora 202 with transmitindo, and it stays transmitindo while the "Sefin is down". The DPS query says it did not arrive, the invoice is resent and authorized (envio, consulta_dps, reenfileirada, envio). The API has no "scheduled" status: the wait shows as transmitindo.
processamento_prolongado 202. After about 20 s the invoice gets aviso: { codigo: "processamento_prolongado" } and the NFSE_PROCESSAMENTO_PROLONGADO webhook fires, once; it stays transmitindo and is then authorized.
falha_transmissao_nao_enviada 422 with falha_transmissao and falha.dps_enviada: "nao": the invoice stopped before sending. Webhook NFSE_FALHA_TRANSMISSAO.
falha_transmissao_desconhecido 202. The prolonged processing warning at 20 s and, about 1 minute later, falha_transmissao with falha.dps_enviada: "desconhecido": the case where you must check the Emissor Nacional before issuing again. Webhook NFSE_FALHA_TRANSMISSAO.
aguardando_confirmacao 202 with aguardando_confirmacao and the NFSE_AGUARDANDO_CONFIRMACAO webhook. Once confirmed at POST /v1/nfse/{id}/confirmacao, the invoice is authorized.

NF-e

On POST /v1/nfe, with the sdr_test_ key. The simulated invoice never goes to SEFAZ, not even to homologação: Sudrel is the one responding, and simulacao carries the scenario. It uses a number from the company's homologação series, which is not voided.

Scenario What you see
timeout_depois_autorizada 202 with transmitindo or aguardando_confirmacao. The SEFAZ response "gets lost", Sudrel queries the key and the invoice becomes autorizada, just ONE, without resending. Webhook NFE_AUTORIZADA.
denegada 422 nfe_denegada with codigo_oficial 302. Webhook NFE_DENEGADA.
rejeicao:<cStat> 422 nfe_rejeitada with the requested cStat (no code: 225) and the explanation when it is in the catalog (e.g. rejeicao:778). Webhook NFE_REJEITADA.
sefaz_indisponivel The first attempt fails before going out; the next one authorizes. 202 and then autorizada.
duplicidade_204 SEFAZ responds duplicate (204); querying the key finds the authorized invoice. Just one invoice.
uf_indisponivel The state's SEFAZ is down for 2 minutes, with no active SVC. The invoice follows the company's contingency policy: with esperar (default) it stays transmitindo with falha_envio.motivo: uf_indisponivel and goes out when the state is back.
uf_indisponivel_svc_ativo The state is down for 2 minutes with SVC activated. With the svc policy, the invoice is authorized in SVC (contingencia.modo: svc_rs or svc_an, key with tpEmis 6 or 7).
epec_pendente Forces EPEC and the state does not come back: the invoice stays contingencia_epec, with the EPEC protocol and deadline and the contingency DANFE.
epec_rejeitado Forces EPEC; the state comes back after 2 minutes and rejects the NF-e (467, data differing from the EPEC). contingencia.situacao: epec_rejeitado says how to fix it.

DC-e

In POST /v1/dce, with the sdr_test_ key. Simulated DC-e never reaches SEFAZ, and simulacao contains the scenario.

Scenario What you see
timeout_depois_autorizada 202 with aguardando_confirmacao. Sudrel queries the access key and the DC-e becomes autorizada, only ONE, without resending. Webhook DCE_AUTORIZADA.
rejeicao:<cStat> 422 dce_rejeitada with the requested cStat (without a code, 225). Webhook DCE_REJEITADA.
sefaz_indisponivel The first attempt fails before sending; the next is authorized.
duplicidade_452 SEFAZ returns duplicate (452); querying the key finds the authorized DC-e. Only one declaration.
emitente_contribuinte_icms 422 dce_rejeitada with codigo_oficial 812: SEFAZ blocked the CNPJ because it is an ICMS taxpayer (rule C02-30).