TF Fiscal
Documentation

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.

StepEndpointNotes
1 Register companyPOST /openapi/v2/empresasReturns empresaId, dceHabilitado and nfseHabilitado; 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). 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 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
NFS-e—emissaoNFSe (serieDps and the other profile defaults) at registration or through an update with id, or maintained by operationsambienteEmissao10018004
  • emissaoNFeProduto, emissaoDCe and emissaoNFSe are 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 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. 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:

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. 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).

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.

json
"emissaoNFSe": {
"serieDps": "1",
"sequencialDps": 1,
"regimeApuracaoSn": 1,
"regimeEspecialTributacao": 0
}
FieldTypeRequiredDescription
serieDpsstring(1-5 digits)NoDPS / RPS series used when issuing. Every invoice uses this value; the issuance does not take a series of its own. Without this field, 1
sequencialDpsintegerNoNumber 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
regimeApuracaoSnintegerRequired for ME/EPPHow 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
regimeEspecialTributacaointegerNoWhether 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 is false and issuance returns 10018005.
  • 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 and nfseHabilitado reflects 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 without regimeApuracaoSn, non-Simples company with regimeApuracaoSn.
  • An NFS-e-only company may omit emissaoNFeProduto (no model 55 series is created) and is not required to carry inscricaoEstadual.
  • The São Paulo municipal registration (CCM) is taken from the top-level inscricaoMunicipal and is not repeated in this block.
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 (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.