NFS-e API reference
Base URL: https://api.corvo.tech/v1. Authenticate with the X-API-Key header. Full contract in OpenAPI: https://corvo.tech/openapi.json. Each section links to the docs page with parameters and examples.
Companies
Details and examples| Method | Endpoint | Success | Description |
|---|---|---|---|
| POST | /v1/companies | 201 Created | Registers a company. |
| GET | /v1/companies | 200 OK | Lists the companies in the account/environment. |
| GET | /v1/companies/:id | 200 OK | Fetches a single company by id. |
| PATCH | /v1/companies/:id | 200 OK | Updates a company. Accepts the creation fields, all optional. Send simplesRate (and simplesIssRate, or null to remove it) to update the Simples rate, for example every month. |
| DELETE | /v1/companies/:id | 200 OK | Deletes a company (logical deletion). |
| GET | /v1/cnpj/:cnpj | 200 OK | Public registry data of a CNPJ (names, address, Simples Nacional, MEI, situation, activities/CNAE and suggestedServiceCode, a service code to suggest, never to apply without asking), to pre-fill a company or a customer form. Send the CNPJ with or without punctuation. 400 CNPJ_INVALID for a malformed CNPJ; 404 CNPJ_NOT_FOUND when the registry does not know the CNPJ; 503 CNPJ_LOOKUP_UNAVAILABLE when it has no answer right now. Needs nfse.companies.manage or nfse.invoices.issue; 20 requests per minute. |
| GET | /v1/companies/:id/dps-sequence | 200 OK | The DPS series and the last number used (0 when none yet). Needs nfse.companies.view. |
| PUT | /v1/companies/:id/dps-sequence | 200 OK | Continues the numbering from the last number the company issued elsewhere (see it in the last note, PDF or XML). The next invoice uses the following number. It only moves forward: a lower number answers 422 DPS_NUMBER_BELOW_CURRENT. Needs nfse.companies.manage. |
| GET | /v1/companies/:id/fiscal-profile | 200 OK | The fiscal profile history of the company (regime, Simples Nacional, special regime, IBS/CBS option) by validity period. Needs nfse.companies.view. |
| PUT | /v1/companies/:id/fiscal-profile | 200 OK | Opens a new validity period of the fiscal profile, from validFrom. Sending a state equal to the open one changes nothing, so the call is safe to repeat. Needs nfse.companies.manage. |
| POST | /v1/companies/:id/fiscal-profile/:profileId/approve | 201 Created | Marks a fiscal profile as reviewed and approved. Needs nfse.companies.manage. |
| GET | /v1/companies/:id/service-tax-profiles | 200 OK | The profiles effective on date (default: today in America/Sao_Paulo). Needs nfse.companies.view. |
| POST | /v1/companies/:id/service-tax-profiles | 201 Created | Adds a service to the catalog. Besides name, serviceCode and effectiveFrom you can send the classification (nbsCode, cst, classCode, operationIndicator), ISS (issTaxation, issRate, issWithholdingDefault) and withholdings (withholdingPolicy UNKNOWN, NONE_CONFIRMED or CONFIGURED, with withholdingRates in percent). Needs nfse.companies.manage. |
| PATCH | /v1/companies/:id/service-tax-profiles/:serviceId | 200 OK | Changes the listed fields of a profile; omitted fields stay. Needs nfse.companies.manage. |
| POST | /v1/companies/:id/service-tax-profiles/:serviceId/approve | 201 Created | Approves the saved classification of the service for this company. Needs nfse.companies.manage. |
| DELETE | /v1/companies/:id/service-tax-profiles/:serviceId | 200 OK | Deletes a profile that has expired and was never approved (422 otherwise). Needs nfse.companies.manage. |
| GET | /v1/companies/:companyId/accountant-package | 200 OK | The accountant e-mail and the last month sent. Needs nfse.companies.view. |
| PUT | /v1/companies/:companyId/accountant-package | 200 OK | Sets the accountant e-mail; null or blank turns the monthly send off. A new address gets a short hello (testEmailSent) so a wrong recipient is noticed. Needs nfse.companies.manage. |
| POST | /v1/companies/:companyId/accountant-package/send | 200 OK | Sends the package of a month now, even if it was already sent. status is sent (queued for e-mail, not proof of delivery) or skipped-test, skipped-no-email, skipped-empty, skipped-too-large, with nothing sent. 10 per hour. Needs nfse.companies.manage. |
| GET | /v1/companies/:companyId/accountant-package/sends | 200 OK | The last 12 attempts to send the package. Needs nfse.companies.view. |
Certificates
Details and examples| Method | Endpoint | Success | Description |
|---|---|---|---|
| POST | /v1/companies/:companyId/certificates | 201 Created | Uploads an A1 certificate (.p12/.pfx) for a company. The certificate is parsed, its validity is checked, and its CNPJ must match the company's. |
| GET | /v1/companies/:companyId/certificates | 200 OK | Lists the certificates of a company. |
| DELETE | /v1/companies/:companyId/certificates/:certId | 204 No Content | Revokes a certificate and updates the company's readiness. |
Invoices
Details and examples| Method | Endpoint | Success | Description |
|---|---|---|---|
| POST | /v1/invoices | 202 Accepted | Requests NFS-e issuance. Issuance is asynchronous: HTTP success means the request was registered/queued — it does not mean fiscal authorization. These examples use the CNPJ (companyTaxId) of a company registered with municipalityCode and defaultServiceCode. The issuer municipality always comes from the company. |
| POST | /v1/invoices/batches | 202 Accepted | Requests the issuance of **1 to 50 invoices in a single call**, for one company or for several. Each item has the same fields as POST /v1/invoices plus an optional idempotencyKey. Items are checked one by one: valid items are saved together in a single transaction, invalid items come back as rejected with the reason and are **not** saved. Issuance stays asynchronous, as in POST /v1/invoices. |
| POST | /v1/invoices/calculate | 200 OK | Calculates the taxes of an invoice **without issuing it**: it stores no invoice, uses no credit, reserves no DPS number, schedules nothing and does not call Sefin. Use it to check the fiscal setup and show the amount to the customer before POST /v1/invoices. |
| POST | /v1/invoices/:id/substitute | 202 Accepted | Issues a new invoice that replaces an authorized one. The original stays authorized until the Receita authorizes the substitute and only then becomes cancelled; if the Receita refuses, the original does not change. Customer, competence date and amount are copied from the original. |
| GET | /v1/customers | 200 OK | Lists the saved customers of the key's environment, most recently used first. search matches part of the name or the start of the CPF/CNPJ (punctuation is ignored). |
| GET | /v1/customers/:taxId | 200 OK | Gets a saved customer by CPF or CNPJ, with or without punctuation. Answers 404 when the document was never saved. |
| PATCH | /v1/customers/:taxId | 200 OK | Corrects the name, the email, the NF-e address, indIeDest or the state registration of a saved customer. Send only what changes; null removes a field. The correction applies to the next invoices. |
| DELETE | /v1/customers/:taxId | 200 OK | Forgets the saved customer. Invoices already issued do not change, and the name is no longer filled in. |
| GET | /v1/invoices | 200 OK | Lists invoices, newest first. |
| GET | /v1/invoices/external/:externalId | 200 OK | Finds an invoice by your own reference (the externalId sent when issuing). Same answer as GET /v1/invoices/:id, searching NFS-e, NF-e and NFC-e; type in the body says which one it is. |
| GET | /v1/invoices/:id | 200 OK | Fetches a single invoice by id. |
| GET | /v1/invoices/:id/xml | 200 OK | Downloads the XML of an authorized invoice. |
| GET | /v1/invoices/:id/pdf | 200 OK | Downloads the PDF of an authorized invoice. |
| GET | /v1/companies/:companyId/invoice-package | 200 OK | Downloads the month package for the accountant: a ZIP with xml/, pdf/ and resumo.csv. |
| GET | /v1/invoices/:id/events | 200 OK | Fetches the status history of an invoice, oldest first. Paginated like any list (limit, cursor). |
| POST | /v1/invoices/:id/download-url | 200 OK | Generates a short-lived signed URL for the invoice documents. |
| POST | /v1/invoices/:id/email | 202 Accepted | Requests email delivery of the invoice, by default to the address stored in customerSnapshot.email. Send { "email": "someone@example.com" } in the body to use another recipient (for example to resend to a corrected address). The invoice must be authorized with documents ready. |
| POST | /v1/invoices/:id/cancel | 200 OK / 202 Accepted | Cancels an invoice. A queued invoice (scheduled or not yet processed) is cancelled immediately; an authorized NFS-e moves to cancelling while event 101101 is sent to the Sefin. A processing invoice (being issued) registers the request: 202, still processing, with cancellationRequestedAt set. |
| GET | /v1/invoices/overview | 200 OK | Counts for the last 7 or 30 calendar days (America/Sao_Paulo, today included), the authorizations per day and the 5 most recent invoices. Needs nfse.invoices.view. |
| GET | /v1/fiscal-portal/status | 200 OK | Whether the national NFS-e portal is answering for the environment of the key. While available is false, invoices wait in the queue and are sent once it answers again. Needs nfse.invoices.view. |
| POST | /v1/invoices/review | 202 Accepted | Resolves up to 100 invoices in manual_review. retry sends the invoice again with the same DPS: the portal is asked about that DPS first, so it never issues a second NFS-e. discard rejects the invoice (and refunds its credit) only after the portal confirms the DPS was never registered; if the NFS-e exists, the invoice becomes authorized. Invoices not in manual_review are skipped. Follow the result by webhook. Needs nfse.invoices.issue. |
| GET | /v1/companies/:companyId/invoice-package/summary | 200 OK | How many authorized and cancelled invoices the competence month has, and their total, without building the ZIP. Use it to check the month fits the limit (limit, 500) before GET /v1/companies/:companyId/invoice-package. Needs nfse.invoices.view. |
| GET | /v1/companies/:companyId/service-favorites | 200 OK | The favorite services of the company; ?kind=product lists the saved products instead (see NF-e). Needs nfse.invoices.view or nfe.documents.view. |
| POST | /v1/companies/:companyId/service-favorites | 201 Created | Saves a favorite service, or a product with kind: "product" (see NF-e). Needs nfse.invoices.issue or nfe.documents.issue. |
| DELETE | /v1/companies/:companyId/service-favorites/:favoriteId | 200 OK | Removes a favorite service. Issued invoices are not changed. Needs nfse.invoices.issue. |
Import spreadsheet
Details and examples| Method | Endpoint | Success | Description |
|---|---|---|---|
| POST | /v1/imports | 202 Accepted | Uploads a spreadsheet (.csv or .xlsx, up to 2,000 rows and 10 MB) as multipart/form-data. Reading is **asynchronous**: the answer is the import to follow, with status: "processing". If the very same file was uploaded before for this company and environment, duplicate_of carries the earlier import (a warning, not a block). |
| GET | /v1/imports | 200 OK | Lists the recent imports of the environment, newest first, with their counters (at most 20). Useful to find an import again, for example one waiting for credits. |
| GET | /v1/imports/:id | 200 OK | Status and counters of one import. Poll it while status is processing or emitting. While reading, rows_expected is how many rows the file has and counters.total how many are already checked. |
| GET | /v1/imports/:id/rows | 200 OK | The rows of an import, **one page at a time** (never the whole sheet). Filter by status to list only the rows with problems (invalid) and read the reason in error_code and error_message. |
| PATCH | /v1/imports/:id/rows/:line | 200 OK | Corrects one row and checks it again, only while the import is ready. Send the changed fields in item. customer and service are merged field by field, so editing the e-mail keeps the name. companyId and companyTaxId cannot be changed. The answer is the row, valid or still invalid with the reason. A row already queued for issuing answers 409 with ERROR_IMPORT_STATE. |
| POST | /v1/imports/:id/emit | 202 Accepted | Issues every valid row, in chunks of 50, with one idempotency key per line: calling it twice never issues twice. If the plan limit or the credits run out, the remaining rows are left as awaiting_credits (not errors). After topping up, **call it again**: only those rows are sent. |
Webhooks
Details and examples| Method | Endpoint | Success | Description |
|---|---|---|---|
| GET | /v1/webhooks | 200 OK | Lists the webhook configurations of the account. |
| POST | /v1/webhooks | 201 Created | Registers a webhook configuration. |
| DELETE | /v1/webhooks/:id | 200 OK | Deletes a webhook configuration. |
| POST | /v1/webhooks/:id/test | 200 OK | Sends a webhook.test event — always with environment test — to the registered URL. |
| GET | /v1/webhooks/deliveries | 200 OK | Lists webhook deliveries, newest first. |
| GET | /v1/webhooks/deliveries/stats | 200 OK | Fetches delivery statistics for the recent window. |
| POST | /v1/webhooks/deliveries/:id/retry | 200 OK | Schedules a new delivery attempt for a failed delivery. |
Billing & quotas
Details and examples| Method | Endpoint | Success | Description |
|---|---|---|---|
| GET | /v1/billing/plan | 200 OK | Fetches the current plan and its consumption. |
| GET | /v1/billing/usage | 200 OK | Fetches quota availability for issuance. |
| POST | /v1/billing/upgrade | 200 OK | Schedules the switch to the target plan on the subscription. |
| POST | /v1/billing/downgrade | 200 OK | Schedules a plan change for the end of the period. |
| GET | /v1/plans | 200 OK | Lists the plans with their monthly price and allowance. |
| GET | /v1/plans/:slug | 200 OK | Fetches the price of one plan. |
| GET | /v1/plans/recommend | 200 OK | Cheapest way to cover N notes a month: a plan, a plan plus single notes, or single notes only. |
Errors
Details and examples| HTTP | Usage |
|---|---|
| 200 / 201 / 202 | Action completed / resource created / asynchronous processing accepted. |
| 204 | Operation completed with no body. |
| 400 | Invalid DTO, parameter, JSON, UUID, limit or cursor. |
| 401 / 403 | Missing or invalid authentication / access denied (scope, endpoint not enabled for API keys, blocked company). |
| 404 | Resource not found, including resources of another tenant. |
| 409 / 410 | Conflict (duplicate CNPJ, idempotency conflict, documents not ready yet) / resource retired. |
| 413 / 415 | Payload too large / unsupported encoding. |
| 422 | Fiscal validation in the domain or a rejected business rule (readiness, certificate, quota). |
| 429 | Rate limit or cooldown; honor Retry-After. |
| 500 / 502 / 503 / 504 | Internal error / invalid dependency / unavailability / timeout. |
| code | When it happens |
|---|---|
ERROR_VALIDATION | Invalid body or query; see details[]. |
ERROR_INVALID_LIMIT | limit outside 1–1000 or not an integer (400). |
ERROR_INVALID_CURSOR | Tampered cursor, or one from another collection, tenant or filter (400). |
ERROR_RATE_LIMIT_EXCEEDED | Request limit exceeded (429). |
ERROR_INSUFFICIENT_CREDITS / ERROR_QUOTA_EXCEEDED | Not enough credits or quota to issue. |
ERROR_COMPANY_NOT_READY / ERROR_COMPANY_BLOCKED | Company without an active certificate in live, or blocked. |
ERROR_IDEMPOTENCY_CONFLICT | Same Idempotency-Key with a different payload (409). |
ERROR_TAX_REGIME_NOT_SUPPORTED | Only MEI and Simples Nacional companies are supported (422). |
ERROR_VALIDATION with details[].code ERROR_DEDUCTION_NOT_ALLOWED_FOR_REGIME or ERROR_SIMPLES_SUBLIMIT_NOT_SUPPORTED | A deduction from the ISS base that a MEI or a Simples company cannot declare, or a Simples company above a sublimit (regApTribSN 2 or 3), which is not supported yet (422). |
ERROR_GONE | Retired operation, such as one-off credit purchases (410). |