TF Fiscal

NFCom Telecom

POST/api/nfcom/create

Issue NFCom

Issues an NFCom from the submitted body. The client sends only the business data — the issuer block (emit) is built automatically from the registration of the token's company, and the technical access-key fields are calculated by the server. Credit is debited only in production (tpAmb=1) and when the NFCom is authorized. After authorization, the XML (nfcomProc) and the DANFE-COM (PDF) are generated and made available by URL.

Required headers

tokenstringstringToken of the issuing company
signstringstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringstringUnix timestamp in seconds (5-minute window)

Body — root

ideobjectobjectNFCom identification (environment, series, taxable event period)
dest*objectobjectRecipient / service taker data
assinanteobjectobjectService subscriber data.
det*arrayarrayBilled items — at least 1
totalobjectobjectTotals.
gFatobjectobjectInvoice data (billing period, due date, barcode)
infAdFiscostringstringInformation of interest to the tax authority
infCplarrayarrayComplementary information (list of texts)
autXMLarrayarrayCNPJs/CPFs authorized to access the XML (list of strings)
Required fields in the request: dest with xNome, one of CNPJ/CPF/idOutros and enderDest (xLgr, xBairro, cMun, xMun, CEP with 8 digits, UF); and at least 1 item in det with xProd, cClass (7 digits from the NFCom item classification table), vItem and vProd. All other fields are optional.

Filled in automatically by the server — you do not need to send them: mod (fixed at 62), cUF (derived from the company registration), cNF (7-digit numeric code), cDV (access key check digit), tpEmis (normal) and verProc. The complete emit block and the infNFComSupl (QR code) are also built by the server; emit.CRT is taken from the tax regime in the company registration (1, 2 or 3; 3 when no tax regime is configured; MEI companies cannot issue NFCom).

det[].pis / det[].cofins

cststringstringPIS/COFINS CST (01, 02, 06, 07, 08, 09, 49).
vBCstringstringCalculation base
pAliqstringstringRate (%)
valorstringstringTax value

The vPIS and vCOFINS totals are summed from the items' pis.valor and cofins.valor, and vICMSDeson and vFCP are summed from the items' ICMS groups, all calculated by the server; vFUST, vFUNTTEL and the withholding totals are 0.00.

 * Required field. In the recipient, at least one of CNPJ, CPF or idOutros is required. Monetary values and rates are sent as strings with a decimal point (e.g.: "99.90").

Response when the result is not confirmed

When the request was sent to the tax authority but no definitive answer was obtained (for example, a connection timeout or an HTTP error returned by the tax authority), the NFCom may already have been authorized. In this case the response returns success=false together with the chave, serie and number of this attempt; that number is not assigned to any other document. The status must first be confirmed by calling /api/nfcom/consult with the chave, before deciding whether to issue the document again.

Examples

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