/api/nfs/company/createRegister 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
tokenstring | string | Integrator B2B token |
signstring | string | MD5 signature |
timestampstring | string | Unix timestamp in seconds |
Body
cnpj*string | string | Company CNPJ (digits only) |
name*string | string | Corporate name |
cep*string | string | Postal code (digits only). The system looks up the IBGE code of the city from it; that city determines the NFS-e issuance channel (Paulistana for São Paulo or the national system) |
address*string | string | Street |
house_*string | string | Address number |
town*string | string | Neighborhood |
city*string | string | City |
state*string | string | State abbreviation (2 letters, e.g. "SP") |
cert_*string | string | Contents of the A1 certificate file (.pfx/.p12), Base64-encoded (the data:...;base64, form is also accepted).The certificate must open with cert_pwd and must not be expired |
cert_string | string | Deprecated — rejected from 2026-09-01. Certificate HTTPS URL |
cert_*string | string | Digital certificate password |
im*string | string | Municipal registration (Inscrição Municipal) |
codigo_*string | string | IBGE code (7 digits) of the issuing city. In the national system it is used as the place of issuance and the place of service in the DPS; it does not determine the issuance channel |
codigo_*string | string | Default service code, used when the issuance request omits codigo_servico.National system: national tax code (cTribNac, 6 digits); São Paulo: municipal service code (5 digits). Non-digit characters are removed at issuance |
aliasstring | string | Trade name |
iestring | string | State registration |
invoice_string | string | Tax regime. Stored only; it does not affect NFS-e issuance |
unitstring | string | Unit / branch |
emailstring | string | Contact email. In the national system it is written to the service provider data of the DPS |
telefonestring | string | Phone. In the national system it is written to the service provider data of the DPS |
complementostring | string | Address complement |
cnae_string | string | Default CNAE, used when the issuance request omits cnae.Used by the national system only |
serie_int | int | NFS-e series. When omitted or 0, series 1 is used |
number_int | int | Starting number: the first NFS-e of the company in the series uses this number, and later ones are incremented from it. It takes effect only while no number has been allocated yet for the company and series (the numbering counter does not exist; failed issuance requests also allocate numbers); an existing counter is never changed and numbering never goes back. When not set or not greater than 1, numbering starts at 1 |
regime_int | int | Special tax regime code, written to regEspTrib in the DPS of the national system. Default 0 (none) |
optante_bool | bool | Whether the company is a Simples Nacional taxpayer. National system: true writes opSimpNac = 3 (ME/EPP), false writes opSimpNac = 1 (not in Simples Nacional). Default false |
* 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
| Message | Cause |
|---|---|
| O campo cnpj é obrigatório | A 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-e | im 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-dd | The certificate has expired |
| Não foi possível consultar o CEP informado; a empresa não foi atualizada | When 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
{
"cnpj": "43649380000100",
"name": "EMPRESA EXEMPLO LTDA",
"alias": "Exemplo",
"ie": "ISENTO",
"invoice_type": "simples_nacional",
"email": "contato@empresa.com",
"telefone": "11999999999",
"cep": "03027020",
"address": "Rua Exemplo",
"house_number": "86",
"complemento": "Andar 2",
"town": "Centro",
"city": "São Paulo",
"state": "SP",
"cert_content": "MIIOkAIBAzCC...(Base64)",
"cert_pwd": "senha-do-certificado",
"im": "12345678",
"codigo_municipio_nfse": "3550308",
"codigo_servico_nfse": "07498",
"cnae_nfse": "6201501",
"serie_nfse": 1,
"number_nfse": 1,
"regime_especial_tributacao": 0,
"optante_simples_nacional": true
}
{
"success": true,
"message": "Empresa cadastrada para NFS-e",
"data": {
"company_id": 12345,
"token": "token-dedicado-da-empresa"
}
}