We use cookies and similar technologies, including Google Analytics and the Meta Pixel, to improve your experience, measure site traffic and understand signup campaigns. By clicking "Accept", you agree to this use.

Learn more about our privacy practices
Corvo
Português

NF-e: files and webhooks

Download the authorized XML and the DANFE, and receive the nfe.* webhook events.

Files

After the authorization, Corvo builds the authorized XML (nfeProc) and the DANFE (the printable PDF) and sets documentsReady: true on the note. Before that, asking for a file answers 409 DOCUMENTS_NOT_READY.

  • GET /v1/invoices/:id/xml and GET /v1/invoices/:id/pdf answer the file itself.
  • POST /v1/invoices/:id/download-url with { "format": "xml" | "pdf" } answers a temporary link (downloadUrl, expiresAt). Another format answers NFE_DOWNLOAD_FORMAT_INVALID.
  • The monthly package for the accountant (GET /v1/companies/:id/invoice-package) also carries the NF-e and the NFC-e of the month (folders nfe/ and nfce/, with nfe-resumo.csv).

Send the e-mail again

POST /v1/invoices/:id/email sends an authorized NF-e or NFC-e again, with the XML and the DANFE (the DANFCE for a NFC-e). It goes to the e-mail of the recipient, or to the address you send in { "email": "someone@example.com" }. The same Idempotency-Key is one send. A note that is not authorized yet or has no files ready answers 409 DOCUMENTS_NOT_READY; a cancelled one, 409 INVOICE_CANCELLED_NO_EMAIL; no address at all, 422 CUSTOMER_EMAIL_MISSING. In the dashboard, the button is **Resend e-mail** on the note page.

Copy a note

In the dashboard, **Copy** on the note page (or in the list) opens the form already filled with the recipient, items, payments, nature of operation and additional information of that note. You review it and issue: the new note has its own number, key and the date of the moment. Only a normal NF-e is copied (never a return or a complement), and prices are copied as they were, so check them before issuing. Through the agent, nfe_repeat does the same with invoice_id, type (nfe or nfce) and an idempotency_key, and answers NFE_REPEAT_NOT_NORMAL for a note that is not a normal sale.

Webhooks

NF-e events use the same webhook registration and signature as the NFS-e ones (see Webhooks). The data carries documentType: "nfe" and documentId instead of invoiceId; the NFS-e events do not change. List the deliveries of a note with the documentId.

EventWhen
nfe.document.authorizedThe SEFAZ authorized the note.
nfe.document.rejected · nfe.document.deniedThe SEFAZ refused or denied it.
nfe.document.failedA failure that needs your look.
nfe.document.reconciliation_required · nfe.document.manual_reviewNo answer, being checked; or the check could not confirm.
nfe.document.cancelled · nfe.document.cancellation_rejectedCancellation registered or refused.
nfe.document.correctedA correction letter was registered.
nfe.document.documents_readyThe XML and the DANFE are ready to download.
nfe.document.email_sent · nfe.document.email_failedThe e-mail to the recipient went or failed.
nfe.inutilization.completed · nfe.inutilization.rejectedAn inutilization was accepted or refused.
nfe.contingency.entered · nfe.contingency.exitedThe NF-e of a state started, or stopped, going out through the SVC. The data carries uf, tpAmb, authority (SVCAN or SVCRS) and dhCont; there is no documentId.

When the SEFAZ of the state is down (SVC)

If the SEFAZ of the state of the company stops answering while the rest of the government still does, Corvo sends the NF-e through the **SEFAZ Virtual de Contingência** (SVC-AN or SVC-RS, depending on the state). It is automatic: you do nothing and the request does not change.

  • Only a note that **was never sent** changes: it gets a new key (tpEmis 6 or 7) with the same number and series. A note that may already have reached its SEFAZ keeps its key and waits for it; Corvo checks it by key and never numbers it again.
  • The note is valid. The response shows emissionType 6 (SVC-AN) or 7 (SVC-RS), contingencyAt and contingencyReason; the DANFE says "EMITIDA EM CONTINGÊNCIA SVC".
  • If it is Corvo's own network that cannot reach the government, the SVC does not help (it is a government host too) and the note waits as usual.
  • The NFS-e and the NFC-e do not use the SVC. Inutilization is only made at the SEFAZ of the state.