TF Fiscal

NFS-e Service Invoices

POST/api/nfs/company/create

Register NFS-e company

Registers (or updates) a company for NFS-e issuance. If a company with the same CNPJ already exists under the header token, that company is updated: the mandatory NFS-e fields (im, codigo_municipio_nfse, codigo_servico_nfse), the certificate and its password are always updated; the optional NFS-e fields (cnae_nfse, serie_nfse, number_nfse, regime_especial_tributacao, optante_simples_nacional) are updated only when present in the request and otherwise keep their stored values. When cep differs from the stored one, the address (cep, address, house_number, town, city, state and, when provided, complemento) and the IBGE city code are updated from the new CEP; the IBGE code determines the issuance channel (São Paulo or the national system). If the new CEP cannot be looked up, an error is returned and the company is not updated. The name is not updated. Otherwise a new company is created and a token dedicated to it is returned. Note the path: /api/nfs/... (no "e"), different from the other NFS-e endpoints.

Required headers

tokenstringstringIntegrator B2B token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body

cnpj*stringstringCompany CNPJ (digits only)
name*stringstringCorporate name
cep*stringstringPostal code (digits only).
address*stringstringStreet
house_number*stringstringAddress number
town*stringstringNeighborhood
city*stringstringCity
state*stringstringState abbreviation (2 letters, e.g.
cert_content*stringstringContents of the A1 certificate file (.pfx/.p12), Base64-encoded (the data:...;base64, form is also accepted).
cert_filestringstringDeprecated — rejected from 2026-09-01.
cert_pwd*stringstringDigital certificate password
im*stringstringMunicipal registration (Inscrição Municipal)
codigo_municipio_nfse*stringstringIBGE code (7 digits) of the issuing city.
codigo_servico_nfse*stringstringDefault service code, used when the issuance request omits codigo_servico.
aliasstringstringTrade name
iestringstringState registration
invoice_typestringstringTax regime.
unitstringstringUnit / branch
emailstringstringContact email.
telefonestringstringPhone.
complementostringstringAddress complement
cnae_nfsestringstringDefault CNAE, used when the issuance request omits cnae.
serie_nfseintintNFS-e series.
number_nfseintintStarting number: the first NFS-e of the company in the series uses this number, and later ones are incremented from it.
regime_especial_tributacaointintSpecial tax regime code, written to regEspTrib in the DPS of the national system.
optante_simples_nacionalboolboolWhether the company is a Simples Nacional taxpayer.

 * Required field.

Note: The returned token is used in the other NFS-e endpoints (/api/nfse/create, /cancel, /get_danfse, /get_xml, /get_list). If the company already exists, the message is "Empresa atualizada para NFS-e" and the returned token is the existing token. The default NFS-e ISS rate cannot be set through this endpoint.

Common errors

MessageCause
O campo cnpj é obrigatórioA required field is empty. name, cep, address, house_number, town, city, state, cert_pwd, codigo_municipio_nfse and codigo_servico_nfse return a message in the same format
O campo im (Inscrição Municipal) é obrigatório para NFS-eim not provided
Informe cert_content (conteúdo do certificado)Neither cert_content nor cert_file was provided
cert_content não é um certificado válido (esperado Base64) / cert_content 不是合法的证书内容(应为 Base64)cert_content cannot be decoded as Base64
cert_file foi descontinuado; envie o certificado em cert_content ...The discontinued cert_file was used
Certificado ou senha incorretos / 证书或密码不正确The certificate cannot be opened with cert_pwd
Certificado vencido em yyyy-MM-dd / 证书已过期:yyyy-MM-ddThe certificate has expired
Não foi possível consultar o CEP informado; a empresa não foi atualizadaWhen updating an existing company, the CEP differs from the stored one and the new CEP could not be looked up

Examples

# sign = md5(token + path + body + timestamp)
# Template generated from the endpoint path; replace the placeholders
curl -X POST "https://api.tffiscal.com/api/nfs/company/create" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json