TF Fiscal

Other fiscal documents

MDF-e Manifest

5 endpoints

The MDF-e API (model 58, layout PL-MDFe 3.00) allows you to issue, query, cancel and close transport manifests. The MDF-e aggregates NF-es and/or CT-es linked to a transport operation, supporting 4 modes: road, air, waterway and rail. All operational information (driver, vehicle, contracting party, CIOT, toll voucher, payment) goes in the body of the /create — there are no inclusion/amendment events after issuance.

EndpointMethodDescription
/api/mdfe/createPOSTIssue MDF-e
/api/mdfe/consultPOSTQuery the status of the MDF-e
/api/mdfe/cancelPOSTCancel MDF-e (up to 24h after authorization)
/api/mdfe/closePOSTClose MDF-e (after finishing the trip)
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. 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

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringUnix timestamp in seconds (5-minute window)

Body — root

FieldTypeDescription
ide *objectIdentification of the MDF-e
emit *objectIssuer data
infModal *objectMode information (only ONE of the four: rodo, aereo, aquav, ferrov)
infDoc *objectLinked fiscal documents
tot *objectCargo totalizers
prodPredobjectPredominant product of the cargo
segarrayInsurance information
lacresarraySeals of the MDF-e
autXMLarrayCNPJs/CPFs authorized to access the XML
infAdicobjectAdditional information (tax authority and taxpayer)
infRespTecobjectTechnical responsible (CNPJ, contact, email, etc.)

ide — Identification

FieldTypeDescription
tpAmb *intEnvironment: 1=production, 2=homologation
tpEmit *intIssuer type: 1=carrier, 2=own cargo, 3=transport service provider
modal *stringMode: "1"=road, "2"=air, "3"=waterway, "4"=rail
UFIni *stringState (UF) where the trip starts (2 letters)
UFFim *stringState (UF) where the trip ends
infMunCarrega[] *arrayLoading municipalities: [{ cMunCarrega, xMunCarrega }]
infPercurso[]arrayStates (UFs) of the route: [{ UFPer }]
tpTranspstringCarrier type (road)
dhIniViagemstringTrip start date/time (ISO 8601)
indCanalVerdestringGreen channel indicator
indCarregaPosteriorstringLater loading indicator
serieintMDF-e series (3 digits of the access key). Optional — auto-allocated (the company's MDF-e series) when omitted or 0; respected when sent
nMDFintMDF-e number (part of the access key). Optional — auto-incremented by the server when omitted or 0; respected when sent (useful for skipping numbering, e.g.: after a duplicate)

emit — Issuer

FieldTypeDescription
CNPJ ⚠stringCNPJ of the issuer (14 digits)
CPF ⚠stringCPF of the issuer (11 digits)
IEstringState Registration
xNome *stringCompany name
xFantstringTrade name
enderEmitobjectAddress: { xLgr, nro, xCpl, xBairro, cMun, xMun, CEP, UF, fone, email }

infModal — Road Mode (modal="1")

FieldTypeDescription
rodo.veicTracao *objectTraction vehicle: { placa, tara, RENAVAM, capKG, capM3, tpRod, tpCar, UF, condutor[], prop }
rodo.veicTracao.condutor[] *arrayDrivers: [{ xNome, CPF }] — minimum 1
rodo.veicReboque[]arrayTrailer vehicles (same structure as veicTracao without driver)
rodo.infANTTobjectANTT information: { RNTRC, infCIOT[], valePed, infContratante[], infPag[] }
rodo.codAgPortostringPort scheduling code
rodo.lacRodo[]arraySeals of the mode: [{ nLacre }]

infModal — Air Mode (modal="2")

FieldTypeDescription
aereo.nac *stringAircraft nationality mark
aereo.matr *stringAircraft registration
aereo.nVoo *stringFlight number
aereo.cAerEmb *stringIATA code of the boarding airport
aereo.cAerDes *stringIATA code of the destination airport
aereo.dVoo *stringFlight date (YYYY-MM-DD)

infModal — Waterway Mode (modal="3")

FieldTypeDescription
aquav.irin *stringIRIN of the vessel
aquav.tpEmb *stringVessel type (2 digits). Use values ≥ 10 to avoid truncation of the internal Zeus byte (e.g.: "10", "11")
aquav.cEmbar *stringVessel code
aquav.xEmbar *stringVessel name
aquav.nViag *stringTrip number. Cannot start with zero (schema validation) — use "1", "100", etc.
aquav.cPrtEmb *stringBoarding port code
aquav.cPrtDest *stringDestination port code
aquav.prtTransstringTransshipment port
aquav.tpNavstringNavigation type
aquav.infTermCarreg[]arrayLoading terminals: [{ cTermCarreg, xTermCarreg }]
aquav.infTermDescarreg[]arrayUnloading terminals
aquav.infEmbComb[]arrayConvoy vessels: [{ cEmbComb, xBalsa }]
aquav.infUnidCargaVazia[]arrayEmpty cargo units
aquav.infUnidTranspVazia[]arrayEmpty transport units

infModal — Rail Mode (modal="4")

FieldTypeDescription
ferrov.trem *objectTrain data: { xPref, dhTrem, xOri, xDest, qVag }
ferrov.vag[] *arrayWagons: [{ pesoBC, pesoR, tpVag, serie, nVag, nSeq, TU }] — minimum 1. Zeus/tax authority restrictions: serie must have exactly 3 digits (use 100+, e.g.: "100"); nVag only accepts digits (long internally, e.g.: "100001"); nSeq optional 1-3 digits.

infDoc — Linked documents

FieldTypeDescription
infMunDescarga[] *arrayUnloading municipalities — minimum 1
infMunDescarga[].cMunDescarga *stringIBGE code of the municipality
infMunDescarga[].xMunDescarga *stringName of the municipality
infMunDescarga[].infNFe[]arrayLinked NF-es: [{ chNFe, SegCodBarras, indReentrega, infUnidTransp[], peri[] }]
infMunDescarga[].infCTe[]arrayLinked CT-es
infMunDescarga[].infMDFeTransp[]arrayTransport MDF-es (subcontracting)

prodPred — Predominant product

FieldTypeDescription
tpCarga *stringCargo type: "01"=solid bulk, "02"=liquid bulk, "03"=refrigerated, "04"=containerized, "05"=general cargo, "06"=neobulk, "07"=hazardous, "08"=pressurized bulk
xProd *stringDescription of the predominant product
cEANstringGTIN/EAN
NCMstringNCM
infLotacaoobjectFull load: { infLocalCarrega{CEP,latitude,longitude}, infLocalDescarrega{...} }

tot — Totalizers

FieldTypeDescription
vCarga *decimalTotal value of the cargo (> 0)
cUnid *stringUnit code: "01"=KG, "02"=TON
qCarga *decimalTotal quantity of the cargo (> 0)
qCTeintNumber of linked CT-es
qNFeintNumber of linked NF-es
qMDFeintNumber of linked MDF-es

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

POST/api/mdfe/consult

Query the status of the MDF-e

Queries the status of the MDF-e directly at the tax authority from the access key.

Required headers

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature
timestampstringUnix timestamp in seconds

Body

FieldTypeDescription
chMDFe *stringAccess key of the MDF-e (44 digits)

* Required field.

POST/api/mdfe/cancel

Cancel MDF-e

Cancels an authorized MDF-e. Window: up to 24 hours after authorization. Not allowed if the MDF-e has already been closed.

Required headers

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature
timestampstringUnix timestamp in seconds

Body

FieldTypeDescription
chMDFe *stringAccess key of the MDF-e (44 digits)
xJust *stringCancellation justification (minimum 15 characters per tax authority requirement)

* Required field.

POST/api/mdfe/close

Close MDF-e

Closes an MDF-e at the end of the trip. After closing, it is no longer possible to cancel. The fields dtEnc, cUF and cMun are optional — when omitted, the system infers them from the original MDF-e (current date, UF and municipality of the issuer).

Required headers

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature
timestampstringUnix timestamp in seconds

Body

FieldTypeDescription
chMDFe *stringAccess key of the MDF-e (44 digits)
dtEncstringClosing date (YYYY-MM-DD). Default: current date
cUFintIBGE code of the UF where the closing occurred. Default: UF of the issuer
cMunstringIBGE code of the municipality where the closing occurred. Default: municipality of the issuer

* Required field.

GET/api/mdfe/get_list

List MDF-e (paginated)

Lists the company's MDF-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: "Success" (authorized), "Canceled" (canceled), "Voided" (closed), "Processing" (processing), "Failed" (failed), "Unknown" (unknown)

* Required field.