/api/mdfe/createIssue 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
tokenstring | string | Token of the issuing company |
signstring | string | MD5 signature: MD5(token + path + body + timestamp) |
timestampstring | string | Unix timestamp in seconds (5-minute window) |
Body — root
ide*object | object | Identification of the MDF-e |
tpAmb*int | int | Environment: 1=production, 2=homologation |
tpEmit*int | int | Issuer type: 1=carrier, 2=own cargo, 3=transport service provider |
modal*string | string | Mode: "1"=road, "2"=air, "3"=waterway, "4"=rail |
UFIni*string | string | State (UF) where the trip starts (2 letters) |
UFFim*string | string | State (UF) where the trip ends |
infMunCarrega[]*array | array | Loading municipalities: [{ cMunCarrega, xMunCarrega }] |
infPercurso[]array | array | States (UFs) of the route: [{ UFPer }] |
tpTranspstring | string | Carrier type: "1"=ETC, "2"=TAC, "3"=CTC.Written to the MDF-e when sent |
dhIniViagemstring | string | Trip start date/time (ISO 8601, with time zone). Written to the MDF-e when sent |
indCanalVerdestring | string | Green channel indicator: the only accepted value is "1".Written to the MDF-e when sent |
indCarregaPosteriorstring | string | Later loading indicator (documents added by event after issuance): the only accepted value is "1".Written to the MDF-e when sent |
serieint | int | MDF-e series (3 digits of the access key). Optional — auto-allocated (the company's MDF-e series) when omitted or 0; respected when sent |
nMDFint | int | MDF-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*object | object | Issuer data |
CNPJstring | string | CNPJ of the issuer (14 digits) |
CPFstring | string | CPF of the issuer (11 digits) |
IEstring | string | State Registration |
xNome*string | string | Company name |
xFantstring | string | Trade name |
enderEmitobject | object | Address: { xLgr, nro, xCpl, xBairro, cMun, xMun, CEP, UF, fone, email } |
infModal*object | object | Mode information (only ONE of the four: rodo, aereo, aquav, ferrov) |
rodoobject | object | |
veicTracao*object | object | Traction vehicle: { placa, tara, RENAVAM, capKG, capM3, tpRod, tpCar, UF, condutor[], prop }.prop (vehicle owner, when the vehicle does not belong to the issuer): { CPF|CNPJ, RNTRC, xNome, IE, UF, tpProp }, tpProp: "0"=TAC aggregate, "1"=TAC independent, "2"=Others |
condutor[]*array | array | Drivers: [{ xNome, CPF }] — minimum 1 |
veicReboque[]array | array | Trailer vehicles (up to 3): [{ placa, tara, capKG*, capM3, RENAVAM, cInt, tpCar, UF, prop }], same structure as veicTracao without driver and without tpRod.Written to the MDF-e when sent |
infANTTobject | object | ANTT information: { RNTRC, infCIOT[]{ CIOT, CPF|CNPJ }, valePed{ disp[]{ CNPJForn, CNPJPg|CPFPg, nCompra, vValePed, tpValePed }, categCombVeic }, infContratante[]{ xNome, CPF|CNPJ|idEstrangeiro }, infPag[] }.Written to the MDF-e when sent. infPag[]: { xNome, CPF|CNPJ|idEstrangeiro, Comp[]{ tpComp, vComp, xComp }, vContrato, indPag, infPrazo[]{ nParcela, dVenc, vParcela }, infBanc{ codBanco, codAgencia | CNPJIPEF | PIX } }, indPag: "0"=Cash payment, "1"=Installments. The following fields are currently not written to the MDF-e; sending them has no effect: infContratante[].infContrato, infPag[].vAdiant, indAntecipaAdiant, tpAntecip, indAltoDesemp |
codAgPortostring | string | Port scheduling code. Written to the MDF-e when sent |
lacRodo[]array | array | Seals of the road mode: [{ nLacre }].Written to the MDF-e when sent |
aereoobject | object | |
nac*string | string | Aircraft nationality mark |
matr*string | string | Aircraft registration |
nVoo*string | string | Flight number |
cAerEmb*string | string | IATA code of the boarding airport |
cAerDes*string | string | IATA code of the destination airport |
dVoo*string | string | Flight date (YYYY-MM-DD) |
aquavobject | object | |
irin*string | string | IRIN of the vessel |
tpEmb*string | string | Vessel type (2 digits). The server handles this field as a number, so values below 10 lose the leading zero; use values of 10 or higher (e.g. "10", "11") |
cEmbar*string | string | Vessel code |
xEmbar*string | string | Vessel name |
nViag*string | string | Trip number. Cannot start with zero (schema validation) — use "1", "100", etc. |
cPrtEmb*string | string | Boarding port code |
cPrtDest*string | string | Destination port code |
prtTransstring | string | Transshipment port |
tpNavstring | string | Navigation type: "0"=Interior, "1"=Coastal.Written to the MDF-e when sent |
infTermCarreg[]array | array | Loading terminals (up to 5): [{ cTermCarreg, xTermCarreg }].Written to the MDF-e when sent |
infTermDescarreg[]array | array | Unloading terminals (up to 5): [{ cTermDescarreg, xTermDescarreg }].Written to the MDF-e when sent |
infEmbComb[]array | array | Convoy vessels (up to 30): [{ cEmbComb, xBalsa }].Written to the MDF-e when sent |
infUnidCargaVazia[]array | array | Empty cargo units: [{ idUnidCargaVazia, tpUnidCargaVazia }], tpUnidCargaVazia: "1"=Container, "2"=ULD."3" (pallet) and "4" (other) are not currently supported. Written to the MDF-e when sent |
infUnidTranspVazia[]array | array | Empty transport units. Currently not written to the MDF-e; sending it has no effect |
ferrovobject | object | |
trem*object | object | Train data: { xPref, dhTrem, xOri, xDest, qVag } |
vag[]*array | array | Wagons: [{ pesoBC, pesoR, tpVag, serie, nVag, nSeq, TU }] — minimum 1.Value restrictions: serie must have exactly 3 digits (use 100 or higher, e.g. "100"); nVag accepts digits only (e.g. "100001"); nSeq is optional, 1–3 digits. |
infDoc*object | object | Linked fiscal documents |
infMunDescarga[]*array | array | Unloading municipalities — minimum 1 |
cMunDescarga*string | string | IBGE code of the municipality |
xMunDescarga*string | string | Name of the municipality |
infNFe[]array | array | Linked NF-es: [{ chNFe, SegCodBarras, indReentrega, infUnidTransp[], peri[] }].The only accepted value of indReentrega is "1"; infUnidTransp[]: { tpUnidTransp, idUnidTransp, lacUnidTransp[]{ nLacre }, infUnidCarga[]{ tpUnidCarga, idUnidCarga, lacUnidCarga[]{ nLacre }, qtdRat }, qtdRat }; peri[]: { nONU, xNomeAE, xClaRisco, grEmb, qTotProd, qVolTipo } |
infCTe[]array | array | Linked CT-es: [{ chCTe, SegCodBarras, indReentrega, infUnidTransp[], peri[], infEntregaParcial{ qtdTotal, qtdParcial } }], with the same substructures as infNFe.Written to the MDF-e when sent; the count is included in tot.qCTe |
infMDFeTransp[]array | array | Transport MDF-es (subcontracting): [{ chMDFe, indReentrega, infUnidTransp[], peri[] }].Written to the MDF-e when sent; the count is included in tot.qMDFe |
tot*object | object | Cargo totalizers |
vCarga*decimal | decimal | Total value of the cargo (> 0) |
cUnid*string | string | Unit code: "01"=KG, "02"=TON |
qCarga*decimal | decimal | Total quantity of the cargo (> 0) |
qCTeint | int | Calculated by the server from the number of infCTe entries in infDoc; values sent are ignored |
qNFeint | int | Calculated by the server from the number of infNFe entries in infDoc; values sent are ignored |
qMDFeint | int | Calculated by the server from the number of infMDFeTransp entries in infDoc; values sent are ignored |
prodPredobject | object | Predominant product of the cargo |
tpCarga*string | string | Cargo type: "01"=solid bulk, "02"=liquid bulk, "03"=refrigerated, "04"=containerized, "05"=general cargo, "06"=neobulk, "07"=hazardous, "08"=pressurized bulk |
xProd*string | string | Description of the predominant product |
cEANstring | string | GTIN/EAN |
NCMstring | string | NCM |
infLotacaoobject | object | Full load: { infLocalCarrega{ CEP | latitude, longitude }, infLocalDescarrega{ CEP | latitude, longitude } }, with coordinates using a decimal point (e.g."-23.5505"). Written to the MDF-e when sent |
segarray | array | Insurance information: [{ infResp{ respSeg*, CNPJ|CPF }, infSeg{ xSeg, CNPJ }, nApol, nAver[] }] — respSeg: 1=MDF-e issuer, 2=Contracting party of the transport service.Written to the MDF-e when sent |
lacresarray | array | Seals of the MDF-e: [{ nLacre }].Written to the MDF-e when sent |
autXMLarray | array | CNPJs/CPFs authorized to access the XML: [{ CNPJ } | { CPF }], up to 10.Written to the MDF-e when sent |
infAdicobject | object | Additional information: { infAdFisco, infCpl } (information of interest to the tax authority / complementary information from the taxpayer).Written to the MDF-e when sent |
infRespTecobject | object | Technical contact. Filled in automatically by the server according to the company's state; values sent are ignored |
* 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
{
"ide": {
"tpAmb": 2,
"tpEmit": 2,
"modal": "1",
"UFIni": "SP",
"UFFim": "ES",
"infMunCarrega": [
{ "cMunCarrega": "3550308", "xMunCarrega": "SAO PAULO" }
],
"infPercurso": [
{ "UFPer": "MG" }
]
},
"emit": {
"CNPJ": "12345678000199",
"IE": "123456789012",
"xNome": "TRANSPORTADORA EXEMPLO LTDA",
"enderEmit": {
"xLgr": "RUA EXEMPLO",
"nro": "100",
"xBairro": "CENTRO",
"cMun": "3550308",
"xMun": "SAO PAULO",
"UF": "SP"
}
},
"infModal": {
"versaoModal": "3.00",
"rodo": {
"veicTracao": {
"placa": "ABC1D23",
"tara": 8000,
"condutor": [
{ "xNome": "João da Silva", "CPF": "12345678909" }
],
"tpRod": "01",
"tpCar": "01"
}
}
},
"infDoc": {
"infMunDescarga": [
{
"cMunDescarga": "3205200",
"xMunDescarga": "Vila Velha",
"infNFe": [
{ "chNFe": "35260512345678000199550010000000011000000018" }
]
}
]
},
"prodPred": {
"tpCarga": "05",
"xProd": "CARGA GERAL"
},
"tot": {
"vCarga": 50000.00,
"cUnid": "01",
"qCarga": 1500.00
}
}
{
"ide": {
"tpAmb": 2,
"tpEmit": 2,
"modal": "2",
"UFIni": "SP",
"UFFim": "RJ",
"infMunCarrega": [
{ "cMunCarrega": "3550308", "xMunCarrega": "SAO PAULO" }
]
},
"emit": {
"CNPJ": "12345678000199",
"IE": "123456789012",
"xNome": "TRANSPORTADORA AEREA EXEMPLO LTDA",
"enderEmit": {
"xLgr": "AV AEROPORTO",
"nro": "5000",
"xBairro": "CUMBICA",
"cMun": "3550308",
"xMun": "SAO PAULO",
"UF": "SP"
}
},
"infModal": {
"versaoModal": "3.00",
"aereo": {
"nac": "PT",
"matr": "ABC1234",
"nVoo": "AB1234",
"cAerEmb": "GRU",
"cAerDes": "GIG",
"dVoo": "2026-05-21"
}
},
"infDoc": {
"infMunDescarga": [
{
"cMunDescarga": "3304557",
"xMunDescarga": "Rio de Janeiro",
"infNFe": [
{ "chNFe": "35260512345678000199550010000000011000000018" }
]
}
]
},
"prodPred": {
"tpCarga": "05",
"xProd": "CARGA GERAL"
},
"tot": {
"vCarga": 25000.00,
"cUnid": "01",
"qCarga": 500.00
}
}
{
"ide": {
"tpAmb": 2,
"tpEmit": 2,
"modal": "3",
"UFIni": "SP",
"UFFim": "PA",
"infMunCarrega": [
{ "cMunCarrega": "3548500", "xMunCarrega": "SANTOS" }
]
},
"emit": {
"CNPJ": "12345678000199",
"IE": "123456789012",
"xNome": "NAVEGACAO EXEMPLO LTDA",
"enderEmit": {
"xLgr": "AV PORTUARIA",
"nro": "200",
"xBairro": "PORTO",
"cMun": "3548500",
"xMun": "SANTOS",
"UF": "SP"
}
},
"infModal": {
"versaoModal": "3.00",
"aquav": {
"irin": "1234567",
"tpEmb": "10",
"cEmbar": "1234",
"xEmbar": "EMBARCACAO EXEMPLO",
"nViag": "1",
"cPrtEmb": "BRSSZ",
"cPrtDest": "BRBEL"
}
},
"infDoc": {
"infMunDescarga": [
{
"cMunDescarga": "1501402",
"xMunDescarga": "Belém",
"infNFe": [
{ "chNFe": "35260512345678000199550010000000011000000018" }
]
}
]
},
"prodPred": {
"tpCarga": "01",
"xProd": "GRAOS DE SOJA"
},
"tot": {
"vCarga": 500000.00,
"cUnid": "02",
"qCarga": 50.00
}
}
{
"ide": {
"tpAmb": 2,
"tpEmit": 2,
"modal": "4",
"UFIni": "MG",
"UFFim": "SP",
"infMunCarrega": [
{ "cMunCarrega": "3106200", "xMunCarrega": "BELO HORIZONTE" }
]
},
"emit": {
"CNPJ": "12345678000199",
"IE": "123456789012",
"xNome": "FERROVIA EXEMPLO LTDA",
"enderEmit": {
"xLgr": "AV FERROVIARIA",
"nro": "300",
"xBairro": "INDUSTRIAL",
"cMun": "3106200",
"xMun": "BELO HORIZONTE",
"UF": "MG"
}
},
"infModal": {
"versaoModal": "3.00",
"ferrov": {
"trem": {
"xPref": "F123",
"dhTrem": "2026-05-21T08:00:00-03:00",
"xOri": "BELO HORIZONTE",
"xDest": "SANTOS",
"qVag": 2
},
"vag": [
{
"pesoBC": 30.000,
"pesoR": 30.000,
"tpVag": "Gôndola",
"serie": "100",
"nVag": "100001",
"nSeq": "1",
"TU": 28.000
},
{
"pesoBC": 30.000,
"pesoR": 30.000,
"tpVag": "Gôndola",
"serie": "101",
"nVag": "100002",
"nSeq": "2",
"TU": 28.000
}
]
}
},
"infDoc": {
"infMunDescarga": [
{
"cMunDescarga": "3548500",
"xMunDescarga": "Santos",
"infNFe": [
{ "chNFe": "35260512345678000199550010000000011000000018" }
]
}
]
},
"prodPred": {
"tpCarga": "01",
"xProd": "MINERIO DE FERRO"
},
"tot": {
"vCarga": 800000.00,
"cUnid": "02",
"qCarga": 56.00
}
}
{
"ide": {
"tpAmb": 2,
"tpEmit": 2,
"tpTransp": "1",
"modal": "1",
"UFIni": "SP",
"UFFim": "ES",
"infMunCarrega": [
{ "cMunCarrega": "3550308", "xMunCarrega": "SAO PAULO" }
],
"infPercurso": [
{ "UFPer": "MG" }
],
"dhIniViagem": "2026-05-21T08:00:00-03:00",
"indCanalVerde": "1",
"indCarregaPosterior": "0"
},
"emit": {
"CNPJ": "12345678000199",
"IE": "123456789012",
"xNome": "TRANSPORTADORA EXEMPLO LTDA",
"xFant": "Exemplo Transportes",
"enderEmit": {
"xLgr": "RUA EXEMPLO",
"nro": "100",
"xCpl": "GALPAO A",
"xBairro": "CENTRO",
"cMun": "3550308",
"xMun": "SAO PAULO",
"CEP": "01001000",
"UF": "SP",
"fone": "1133334444",
"email": "contato@exemplo.com"
}
},
"infModal": {
"versaoModal": "3.00",
"rodo": {
"infANTT": {
"RNTRC": "12345678",
"infCIOT": [
{ "CIOT": "1234567890", "CNPJ": "12345678000199" }
],
"valePed": {
"categCombVeic": "01",
"disp": [
{
"CNPJForn": "98765432000111",
"CNPJPg": "12345678000199",
"nCompra": "VP001",
"vValePed": 250.00,
"tpValePed": "01"
}
]
},
"infContratante": [
{
"xNome": "EMPRESA CONTRATANTE LTDA",
"CNPJ": "11222333000144"
}
],
"infPag": [
{
"xNome": "João da Silva",
"CPF": "12345678909",
"Comp": [
{ "tpComp": "01", "vComp": 5000.00, "xComp": "Frete contratado" }
],
"vContrato": 5000.00,
"indAltoDesemp": "1",
"indPag": "0",
"infBanc": {
"codBanco": "001",
"codAgencia": "1234",
"PIX": "12345678909"
}
}
]
},
"veicTracao": {
"cInt": "VT001",
"placa": "ABC1D23",
"RENAVAM": "12345678901",
"tara": 8000,
"capKG": 25000,
"capM3": 80,
"prop": {
"CNPJ": "12345678000199",
"RNTRC": "12345678",
"xNome": "TRANSPORTADORA EXEMPLO LTDA",
"IE": "123456789012",
"UF": "SP",
"tpProp": "0"
},
"condutor": [
{ "xNome": "João da Silva", "CPF": "12345678909" },
{ "xNome": "Maria Souza", "CPF": "98765432100" }
],
"tpRod": "01",
"tpCar": "01",
"UF": "SP"
},
"veicReboque": [
{
"cInt": "VR001",
"placa": "DEF4G56",
"RENAVAM": "98765432109",
"tara": 3500,
"capKG": 30000,
"capM3": 90,
"tpCar": "02",
"UF": "SP"
}
],
"lacRodo": [
{ "nLacre": "LACRE001" },
{ "nLacre": "LACRE002" }
]
}
},
"infDoc": {
"infMunDescarga": [
{
"cMunDescarga": "3205200",
"xMunDescarga": "Vila Velha",
"infNFe": [
{
"chNFe": "35260512345678000199550010000000011000000018",
"SegCodBarras": "",
"indReentrega": "0",
"infUnidTransp": [
{
"tpUnidTransp": "1",
"idUnidTransp": "UT001",
"qtdRat": 100.000,
"lacUnidTransp": [{ "nLacre": "LACRE-UT-001" }],
"infUnidCarga": [
{
"tpUnidCarga": "1",
"idUnidCarga": "UC001",
"qtdRat": 100.000,
"lacUnidCarga": [{ "nLacre": "LACRE-UC-001" }]
}
]
}
],
"peri": []
}
]
}
]
},
"seg": [
{
"infResp": {
"respSeg": "1",
"CNPJ": "12345678000199"
},
"infSeg": {
"xSeg": "SEGURADORA EXEMPLO SA",
"CNPJ": "55666777000188"
},
"nApol": "APOL-2026-001",
"nAver": ["AV001", "AV002"]
}
],
"prodPred": {
"tpCarga": "05",
"xProd": "CARGA GERAL",
"cEAN": "7891234567890",
"NCM": "84713012",
"infLotacao": {
"infLocalCarrega": {
"CEP": "01001000",
"latitude": "-23.5505",
"longitude": "-46.6333"
},
"infLocalDescarrega": {
"CEP": "29100000",
"latitude": "-20.3297",
"longitude": "-40.2925"
}
}
},
"tot": {
"qCTe": 0,
"qNFe": 1,
"qMDFe": 0,
"vCarga": 50000.00,
"cUnid": "01",
"qCarga": 1500.00
},
"lacres": [
{ "nLacre": "LACRE-GERAL-001" }
],
"autXML": [
{ "CNPJ": "11222333000144" }
],
"infAdic": {
"infAdFisco": "Documento emitido em conformidade com a legislação vigente",
"infCpl": "Transporte com escolta armada"
},
"infRespTec": {
"CNPJ": "12345678000199",
"xContato": "Suporte Técnico",
"email": "suporte@exemplo.com",
"fone": "1133334444"
}
}
{
"success": true,
"message": "Autorizado o uso do MDF-e",
"cStat": "100",
"chMDFe": "35260512345678000199580010000000011000000018",
"nProt": "135260000123456",
"xml": "https://storage.../mdfe/35260512345678000199580010000000011000000018.xml",
"damdfe": "https://storage.../mdfe/35260512345678000199580010000000011000000018.pdf"
}