Companies
Lifecycle of an issuing company on TF Fiscal, how one company serves NF-e, CT-e, DC-e and NFS-e, tax regime derivation, DC-e and NFS-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, dceHabilitado and nfseHabilitado; 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). See Environments.
Note: an update (body carrying
id) never resubmits the company for review and never changes its status or environment.
One company, four 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 |
| NFS-e | — | emissaoNFSe (serieDps and the other profile defaults) at registration or through an update with id, or maintained by operations | ambienteEmissao | 10018004 |
emissaoNFeProduto,emissaoDCeandemissaoNFSeare each optional, at least one is required. An NF-e-only company sends the first, a DC-e-only or NFS-e-only company may omit it (no model 55 series is created), and sending more than one enables the corresponding document types. Omitting all three 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. It also decides whether regimeApuracaoSn is required in the NFS-e profile, see below. inscricaoEstadual is mandatory to issue NF-e, CT-e and DC-e: missing it returns 10003006; an NFS-e-only company is not required to carry a state registration.
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 with10019013.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).
Enabling NFS-e
NFS-e is enabled by the emissaoNFSe block. Only with it does the company start issuing NFS-e and get its numbering sequence. Only data that does not change from one invoice to the next lives here: service code, CNAE, NBS, ISS rate, withholding and IBS/CBS follow the service being sold and go in the servico block of each issuance.
"emissaoNFSe": {"serieDps": "1","sequencialDps": 1,"regimeApuracaoSn": 1,"regimeEspecialTributacao": 0}
| Field | Type | Required | Description |
|---|---|---|---|
serieDps | string(1-5 digits) | No | DPS / RPS series used when issuing. Every invoice uses this value; the issuance does not take a series of its own. Without this field, 1 |
sequencialDps | integer | No | Number of the next invoice to issue, starting at 1. When migrating from another provider, send the highest number already used plus one so the numbering carries on where it stopped. Without this field, 1. Once the sequence exists, updates do not change it |
regimeApuracaoSn | integer | Required for ME/EPP | How Simples Nacional computes the tax: 1 federal and municipal under SN / 2 federal under SN with a fixed municipal amount / 3 federal under SN with normal municipal. Simples membership comes from the top-level optanteSimplesNacional / mei. Sending it for a non-Simples company is rejected |
regimeEspecialTributacao | integer | No | Whether a special tax treatment applies: 0 none / 1 cooperative act / 2 assessed basis / 3 municipal micro-enterprise / 4 notary and registry / 5 self-employed professional / 6 partnership of professionals. Without this field, 0 |
- The registration response now carries
nfseHabilitado:{ "empresaId": "…", "dceHabilitado": false, "nfseHabilitado": true }. Without the block it isfalseand issuance returns10018005. - On update (a body with
id) sending the block replaces the whole profile: omitted optionals fall back to their defaults; without the block the profile is untouched andnfseHabilitadoreflects the current state. Forcing the municipal standard is an operations action and does not go through this block. - Structural rules rejected at acceptance (400
10001001): ME/EPP withoutregimeApuracaoSn, non-Simples company withregimeApuracaoSn. - An NFS-e-only company may omit
emissaoNFeProduto(no model 55 series is created) and is not required to carryinscricaoEstadual. - The São Paulo municipal registration (CCM) is taken from the top-level
inscricaoMunicipaland is not repeated in this block.
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 (all three configuration blocks missing, update changing cnpj / municipality, lowering the DC-e series cursor, switching series, emissaoNFSe structural rules not met) | Fix per mensagem |
The full list is in Error codes.
