TF Fiscal

Received Documents & DistDFe

POST/api/invoice/received/get_xml

Get received document XML

Required headers

tokenstringstringCompany token
signstringstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringstringUnix timestamp in seconds (5-minute window)

Fields

FieldTypeRequiredDescription
idstringYesDocument ObjectId — returned by /received/list

Response fields

idstringstringDocument ObjectId
nsunumbernumberDocument NSU in DistDFe
doc_typestringstringresNFe, procNFe, resEvento or procEvento
chavestringstringNF-e access key
xml_urlstringstringURL of the document XML
danfestringstringURL of the full DANFE PDF (A4 format).
danfe_etiquetastringstringURL of the 100×150 mm label PDF (simplified DANFE).
About the returned XML:
  • resNFe — XML is the summary only, does NOT contain products/taxes. Use for auditing/triage before sending Awareness
  • procNFe — Full signed XML, equivalent to the one generated at issuance. Ready to import into the client's ERP
  • procEvento — Full event XML with signature and protocol
About the PDFs:
  • Only the full NF-e (procNFe) has a DANFE. For resNFe, resEvento and procEvento, danfe and danfe_etiqueta come back empty
  • They are the same two PDFs sent in the issuance webhook: A4 DANFE and 100×150 mm label
  • On the first call for each invoice the PDFs are generated on the spot, so it may take a few seconds; later calls return the same link
  • The PDFs stay available for 6 days. After that, call the endpoint again to get a new link — do not store the link as permanent
  • If generation fails, the response is still successful and includes xml_url; only the PDF field comes back empty

Common errors

MessageCause
id inválidoValue is not a valid ObjectId
documento recebido não encontradoObjectId exists but does not belong to the token's user

Examples

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