TF Fiscal

MDF-e Manifest

POST/api/mdfe/create

Issue MDF-e

Issues an MDF-e from the submitted body. The fields cMDF, cDV, cUF, dhEmi, mod, tpEmis, procEmi, verProc are calculated automatically by the server. The client sends only the business fields. When no definitive response is obtained after the request is sent (for example, on a timeout), the server queries the MDF-e by its access key: if it is authorized, success is returned; if it still cannot be confirmed, a failure is returned together with chMDFe. In that case, /api/mdfe/consult must be called first to query that key before the MDF-e is issued again. The fields serie and nMDF are optional: they are allocated automatically when omitted (or set to 0), but are honored when sent (useful for skipping the numbering, e.g. after a duplicate at the tax authority).

Required headers

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

Body — root

ide*objectobjectIdentification of the MDF-e
emit*objectobjectIssuer data
infModal*objectobjectMode information (only ONE of the four: rodo, aereo, aquav, ferrov)
infDoc*objectobjectLinked fiscal documents
tot*objectobjectCargo totalizers
prodPredobjectobjectPredominant product of the cargo
segarrayarrayInsurance information: [{ infResp{ respSeg*, CNPJ|CPF }, infSeg{ xSeg, CNPJ }, nApol, nAver[] }] — respSeg: 1=MDF-e issuer, 2=Contracting party of the transport service.
lacresarrayarraySeals of the MDF-e: [{ nLacre }].
autXMLarrayarrayCNPJs/CPFs authorized to access the XML: [{ CNPJ } | { CPF }], up to 10.
infAdicobjectobjectAdditional information: { infAdFisco, infCpl } (information of interest to the tax authority / complementary information from the taxpayer).
infRespTecobjectobjectTechnical contact.

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

Examples

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