TF Fiscal

Core APIs

NFS-e Service Invoices

6 endpoints

The NFS-e API allows issuing, canceling and querying Electronic Service Invoices. The system automatically detects the company's municipality and routes to the correct API:

  • Sao Paulo (SP) - Issuance via Nota Fiscal Paulistana (SOAP)
  • Other municipalities - Issuance via National API (ADN/SEFIN)

The integrator does not need to worry about which API to use - just send the data and the system routes automatically by the IBGE code of the municipality registered in the company.

EndpointMethodDescription
/api/nfse/createPOSTIssue NFS-e
/api/nfse/cancelPOSTCancel NFS-e
/api/nfse/get_danfsePOSTGet DANFSE (PDF)
/api/nfse/get_xmlPOSTDownload XML
POST/api/nfs/company/create

Register NFS-e company

Registers (or updates) a company for NFS-e issuance. If the CNPJ already exists for the user, only the NFS-e fields and certificate are updated; otherwise a new company is created and a dedicated token is returned. Note the path: /api/nfs/... (no "e"), different from the other NFS-e endpoints.

Required headers

HeaderTypeDescription
tokenstringIntegrator B2B token
signstringMD5 signature
timestampstringUnix timestamp in seconds

Body

FieldTypeDescription
cnpj *stringCompany CNPJ (digits only)
name *stringCorporate name
cep *stringPostal code (digits only)
address *stringStreet
house_number *stringAddress number
town *stringNeighborhood
city *stringCity
state *stringState (2 digits, e.g. "SP")
cert_content *stringContents of the A1 certificate file (.pfx/.p12), Base64-encoded
cert_filestringDeprecated — rejected from 2026-09-01. Certificate HTTPS URL
cert_pwd *stringDigital certificate password
im *stringMunicipal registration (Inscrição Municipal)
codigo_municipio_nfse *stringIBGE code of the issuing municipality
codigo_servico_nfse *stringDefault service code (LC 116)
aliasstringTrade name
iestringState registration
invoice_typestringTax regime
unitstringUnit / branch
emailstringContact email
telefonestringPhone
complementostringAddress complement
cnae_nfsestringDefault activity CNAE
serie_nfseintInitial NFS-e series
number_nfseintInitial NFS-e number
regime_especial_tributacaointSpecial tax regime code
optante_simples_nacionalboolOpting in to Simples Nacional

* Required field.

Note: The returned token must be used in the other NFS-e calls (/api/nfse/create, /cancel, /get_danfse, /get_xml). If the company already exists, the message will be "Empresa atualizada para NFS-e" and the returned token is the existing token.

POST/api/nfse/create

Issue NFS-e

Required Headers

HeaderTypeDescription
tokenstringCompany token
signstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringUnix timestamp in seconds (5-minute window)

Main Fields

FieldTypeDescription
ambientestring"1" = Production, "2" = Staging
idstringExternal reference ID (optional)
descricao_servicostringService description (required)
valor_servicodecimalTotal service value in R$ (required)
aliquota_issdecimalISS tax rate in % (e.g.: 2.90)
iss_retidobooleanfalse = Not withheld, true = Withheld by payer
valor_issdecimalISS value override. If greater than 0, overrides the automatic calculation (base_calculo x aliquota_iss div 100). Default: calculated automatically
codigo_servicostringService code. If empty, uses company default
cnaestringCNAE. If empty, uses company default
tomadorobjectService payer data (required)

Payer Fields

FieldTypeDescription
cnpjstringPayer CNPJ (numbers only)
cpfstringPayer CPF (use cnpj OR cpf)
namestringName/Company name (required)
emailstringPayer email
telefonestringPhone
cepstringZip code (required)
enderecostringStreet address (required)
numerostringNumber (required)
complementostringAddress complement
bairrostringNeighborhood (required)
citystringCity
ufstringState (2 digits)
codigo_municipiostringIBGE municipality code
POST/api/nfse/cancel

Cancel NFS-e

Required Headers

HeaderTypeDescription
tokenstringCompany token
signstringMD5 signature
timestampstringUnix timestamp in seconds

Fields

FieldTypeDescription
chavestringNFS-e verification code (required)
motivostringCancellation reason (required; for the National standard it must be 15 to 255 characters long)
c_motivostringCancellation justification code (optional, National standard): "1" = Issuance error (default), "2" = Service not provided, "9" = Other
POST/api/nfse/get_danfse

Get NFS-e PDF

Required Headers

HeaderTypeDescription
tokenstringCompany token
signstringMD5 signature
timestampstringUnix timestamp in seconds

Fields

FieldTypeDescription
chavestringNFS-e verification code (required)

Note: For Paulistana (SP), returns the direct PDF URL from the city hall. For National API, returns the PDF in base64.

POST/api/nfse/get_xml

Download NFS-e XML

Required Headers

HeaderTypeDescription
tokenstringCompany token
signstringMD5 signature
timestampstringUnix timestamp in seconds

Fields

FieldTypeDescription
chavestringNFS-e verification code (required)

dpsXml: Link (OSS URL) to the XML sent to the city hall/ADN. nfseXml: Link to the return XML with the issuance result. The XMLs are uploaded to OSS on the first request and the URL is cached.

GET/api/nfse/get_list

List NFS-e (paginated)

Lists the company's NFS-e with pagination. Parameters are passed via query string (not in the body). The time filter is optional, but if used, both start_create_time and end_create_time are required.

Required headers

HeaderTypeDescription
tokenstringIssuing company token
signstringMD5 signature (path includes the query string)
timestampstringUnix timestamp in seconds

Query string

ParameterTypeDescription
page *intPage number (≥ 1)
page_size *intPage size (1–50)
start_create_timelongUnix timestamp in milliseconds — start (requires end_create_time)
end_create_timelongUnix timestamp in milliseconds — end
statusstringFilter by status. Values: "autorizada", "cancelada", "pendente", "rejeitada"

* Required field.