Companies
Lifecycle of an issuing company on TF Fiscal, how one company serves NF-e, CT-e and DC-e, tax regime derivation, DC-e enablement and the related error codes.
What a company is
A company (empresa) is the legal entity on whose behalf documents are issued: the seller of a marketplace, a carrier, or an integrator issuing for itself. Every company is identified by the empresaId returned by Register company, which is the path variable of every issuance, query and cancellation endpoint.
| Step | Endpoint | Notes |
|---|---|---|
| 1 Register company | POST /openapi/v2/empresas | Returns empresaId and dceHabilitado; a body carrying id updates an existing company |
| 2 Link certificate | POST /openapi/v1/empresas/{empresaId}/certificadoDigital | A1 certificate (.pfx / .p12) and its password; multipart or JSON + Base64 |
| 3 Register webhook | POST /openapi/v1/webhooks | One callback URL per application, shared by every document type |
Lifecycle
- Registration: a successful call to Register company places the company in the platform approval queue. Registering the same CNPJ again returns
10003002; reuse the originalempresaIdor send an update withid. - Certificate: link the A1 certificate. The certificate must belong to the company CNPJ (
10003010), be valid (10003011) and differ from the currently active one (10003012); a wrong password returnsCER0005. A successful upload replaces the previous certificate. - Approval: operations approve the company. The company can issue only after operations approve it and the certificate is linked. Issuing before that returns
10004004for NF-e (DCe00008for DC-e,10017004for CT-e). Check approval progress with platform operations. - Environment: every company has one current environment, test
Homologacaoor productionProducao. Newly registered companies start in test; switching to production is an operations action with no API. The environment value in every issuance request (ambienteEmissaofor NF-e and CT-e,ambientefor DC-e) must match the company's current environment; a mismatch returns10004030(NF-e),10017010(CT-e) orDCe00004(DC-e), a hard guard against test documents being issued into production. See Environments.
Note: an update (body carrying
id) never resubmits the company for review and never changes its status or environment.
One company, three document types
The same empresaId, the same certificate and the same webhook serve every document type. What differs is the number series each type needs:
| Document type | Model | Series configured through | Environment field | Not issuable code |
|---|---|---|---|---|
| NF-e | 55 | emissaoNFeProduto.ambienteProducao (sequencialNFe / serieNFe) at registration | ambienteEmissao | 10004004 |
| CT-e | 57 | Configured on the platform side; registration has no CT-e block. Without a series, or with several enabled and none chosen, issuance returns 10017007 | ambienteEmissao | 10017004 |
| DC-e | 99 | emissaoDCe.ambienteProducao (tipoEmitente, sequencialDCe / serieDCe, siteMarketplace) at registration or through an update with id | ambiente | DCe00008 |
emissaoNFeProdutoandemissaoDCeare each optional, at least one is required. An NF-e-only company sends the former, a DC-e-only company may omit it (no model 55 series is created), and sending both enables both types. Omitting both returns 40010001001.- The series and the next number submitted at registration are the ones used for issuance; afterwards the platform manages the sequence.
- CT-e issuance additionally requires the CNPJ to be enabled for CT-e at the state tax authority; without it SEFAZ rejects with
230 - IE do emitente não cadastrada, which the platform cannot resolve.
Tax regime derivation
The company regime is derived from two booleans sent at registration and cannot be changed through an update:
mei | optanteSimplesNacional | Regime |
|---|---|---|
true | any | MEI |
false | true | Simples Nacional |
false | false | Regular regime |
The regime drives which tax code family an NF-e item may use (CSOSN for Simples / MEI, CST for the regular regime); see NF-e. inscricaoEstadual is mandatory on this platform: missing it returns 10003006.
Enabling DC-e
DC-e (model 99) is enabled by the emissaoDCe block:
"emissaoDCe": {"ambienteProducao": {"tipoEmitente": "Marketplace","sequencialDCe": 1,"serieDCe": "1","siteMarketplace": "https://loja.exemplo.com.br"}}
tipoEmitenteisMarketplace(a platform issuing on behalf of non-taxpayer sellers / individuals) orOwnIssuer(a company issuing for itself).Carriercan be registered but issuance is rejected with10019013until the new schema package is published.siteMarketplaceis required forMarketplace.- A company registered without
emissaoDCeis not enabled for DC-e: registration still succeeds, the response carriesdceHabilitado=falseand issuance returnsDCe00004. Check that field right after registering. - To enable DC-e later, resend the registration payload with
idand theemissaoDCeblock. The model 99 series only moves up:sequencialDCemay raise the next number but never lower it (40010001001), and switchingserieDCewhile the old series is still enabled is refused (40010001001, go through operations).
Related error codes
| codigo | HTTP | Scenario | Action |
|---|---|---|---|
10003002 | 400 | CNPJ already registered | The company exists: use the original empresaId or update with id |
10003000 | 404 | empresaId does not exist or does not belong to this application | Check the empresaId |
10003006 | 400 | Registration data missing the IE | Provide inscricaoEstadual |
10003010 / 10003011 / 10003012 | 400 | Certificate CNPJ mismatch / expired / identical to the current one | Use the correct certificate |
10003035 | 400 | Invalid Base64 or certificate above 1MB (JSON shape) | Fix the encoding or the file |
CER0005 | 400 | Certificate password mismatch | Check the password |
GW001 | 400 | Registration: city / state cannot be resolved to an IBGE code | Check the UF and city name |
10004004 | 400 | Company not issuable (not yet approved or certificate not ready) | Wait for approval / link the certificate |
10004030 | 400 | ambienteEmissao does not match the company's current environment | Submit under the company environment or ask operations to switch it |
10001001 | 400 | Field validation failed, or registration / update contract error (both configuration blocks missing, update changing cnpj / municipality, lowering the DC-e series cursor, switching series) | Fix per mensagem |
The full list is in Error codes.
