TF Fiscal

CT-e Transport

POST/api/cte/create

Issue CT-e

Issues a CT-e from the submitted body. The client sends only the business data; the technical access-key identification fields are calculated by the server (see the note below the ide table). Credit is debited only in production (tpAmb=1) and when the CT-e is authorized. When no definitive response is obtained after the request is sent (for example, on a timeout), the server queries the CT-e by its access key: if it is authorized, success is returned; if it still cannot be confirmed, a failure is returned together with chCTe. In that case, /api/cte/consult must be called first to query that key before the CT-e is issued again. The examples below cover the most common case: road mode (modal=01) and Normal CT-e (tpCTe=0).

Required headers

tokenstringstringToken of the issuing company
signstringstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringstringUnix timestamp in seconds (5-minute window)
Required fields in the request: ide (tpAmb, CFOP, natOp, modal, cMunIni, UFIni, cMunFim, UFFim); emit with CNPJ and xNome; rem with CNPJ or CPF; dest with CNPJ or CPF; vPrest.vTPrest > 0; imp (with one ICMS variant). For tpCTe=0 (Normal): infCTeNorm with infCarga (proPred + at least 1 infQ) and infModal (the mode corresponding to ide.modal; for modal=01, rodo.RNTRC is required; for modal=02, aereo.tarifa.CL is required). For tpCTe=1 (Supplement): infCteComp.chCTe. For tpCTe=3 (Replacement): infCTeNorm.infCteSub.chCte. All other fields are optional.

Body — root

ide*objectobjectCT-e identification
emit*objectobjectIssuer data (carrier)
rem*objectobjectCargo sender
dest*objectobjectCargo recipient
vPrest*objectobjectService provision values
imp*objectobjectTaxes (ICMS + tributes)
infCTeNorm*objectobjectNormal CT-e body — required when tpCTe=0 (Normal) or 3 (Replacement)
expedobjectobjectDispatcher (optional)
recebobjectobjectReceiver (optional)
complobjectobjectComplementary data (observations, flow, delivery)
infCteCompobjectobjectKey of the supplemented CT-e — required when tpCTe=1 (Supplement): { chCTe }.
autXMLarrayarrayCNPJs/CPFs authorized to access the XML: [{ CNPJ } | { CPF }]
infRespTecobjectobjectTechnical contact — filled in automatically by the server per UF

Filled in automatically by the server — you do not need to send them: mod (fixed at 57), cCT (8-digit numeric code), cDV (check digit), cUF (derived from the issuer's UF), dhEmi (current date/time), tpEmis (default 1=Normal), procEmi and verProc.

exped / receb — Dispatcher / Receiver (optional)

CNPJ/CPFstringstringDocument (one of the two)
IE,xNome,fone,emailstringstringState Registration, name, phone, e-mail
enderExped/enderRecebobjectobjectAddress (same generic structure below)
AddressobjectobjectenderEmit / enderReme / enderExped / enderReceb / enderDest

The versaoModal of infModal is always set to "4.00" by the server; values sent are ignored.

 * Required field. At least one of CNPJ or CPF is required in the group.

Examples

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