TF Fiscal
Documentation

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.

StepEndpointNotes
1 Register companyPOST /openapi/v2/empresasReturns empresaId and dceHabilitado; a body carrying id updates an existing company
2 Link certificatePOST /openapi/v1/empresas/{empresaId}/certificadoDigitalA1 certificate (.pfx / .p12) and its password; multipart or JSON + Base64
3 Register webhookPOST /openapi/v1/webhooksOne callback URL per application, shared by every document type

Lifecycle

  1. Registration: a successful call to Register company places the company in the platform approval queue. Registering the same CNPJ again returns 10003002; reuse the original empresaId or send an update with id.
  2. 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 returns CER0005. A successful upload replaces the previous certificate.
  3. Approval: operations approve the company. The company can issue only after operations approve it and the certificate is linked. Issuing before that returns 10004004 for NF-e (DCe00008 for DC-e, 10017004 for CT-e). Check approval progress with platform operations.
  4. Environment: every company has one current environment, test Homologacao or production Producao. Newly registered companies start in test; switching to production is an operations action with no API. The environment value in every issuance request (ambienteEmissao for NF-e and CT-e, ambiente for DC-e) must match the company's current environment; a mismatch returns 10004030 (NF-e), 10017010 (CT-e) or DCe00004 (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 typeModelSeries configured throughEnvironment fieldNot issuable code
NF-e55emissaoNFeProduto.ambienteProducao (sequencialNFe / serieNFe) at registrationambienteEmissao10004004
CT-e57Configured on the platform side; registration has no CT-e block. Without a series, or with several enabled and none chosen, issuance returns 10017007ambienteEmissao10017004
DC-e99emissaoDCe.ambienteProducao (tipoEmitente, sequencialDCe / serieDCe, siteMarketplace) at registration or through an update with idambienteDCe00008
  • emissaoNFeProduto and emissaoDCe are 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 400 10001001.
  • 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:

meioptanteSimplesNacionalRegime
trueanyMEI
falsetrueSimples Nacional
falsefalseRegular 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:

json
"emissaoDCe": {
"ambienteProducao": {
"tipoEmitente": "Marketplace",
"sequencialDCe": 1,
"serieDCe": "1",
"siteMarketplace": "https://loja.exemplo.com.br"
}
}
  • tipoEmitente is Marketplace (a platform issuing on behalf of non-taxpayer sellers / individuals) or OwnIssuer (a company issuing for itself). Carrier can be registered but issuance is rejected with 10019013 until the new schema package is published. siteMarketplace is required for Marketplace.
  • A company registered without emissaoDCe is not enabled for DC-e: registration still succeeds, the response carries dceHabilitado=false and issuance returns DCe00004. Check that field right after registering.
  • To enable DC-e later, resend the registration payload with id and the emissaoDCe block. The model 99 series only moves up: sequencialDCe may raise the next number but never lower it (400 10001001), and switching serieDCe while the old series is still enabled is refused (400 10001001, go through operations).
codigoHTTPScenarioAction
10003002400CNPJ already registeredThe company exists: use the original empresaId or update with id
10003000404empresaId does not exist or does not belong to this applicationCheck the empresaId
10003006400Registration data missing the IEProvide inscricaoEstadual
10003010 / 10003011 / 10003012400Certificate CNPJ mismatch / expired / identical to the current oneUse the correct certificate
10003035400Invalid Base64 or certificate above 1MB (JSON shape)Fix the encoding or the file
CER0005400Certificate password mismatchCheck the password
GW001400Registration: city / state cannot be resolved to an IBGE codeCheck the UF and city name
10004004400Company not issuable (not yet approved or certificate not ready)Wait for approval / link the certificate
10004030400ambienteEmissao does not match the company's current environmentSubmit under the company environment or ask operations to switch it
10001001400Field 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.