TF Fiscal

NF-e Invoices

POST/api/invoice/get_xml

Batch export NF-e

Starts an asynchronous bulk export task for the user's invoices, filtering by period and status. Can generate an Excel spreadsheet (metadata only) or a ZIP package with the XMLs. The first call creates the task and returns status: "Processing"; subsequent calls with the same parameters return the progress until status: "Success", when the url field contains the download link.

Required headers

tokenstringstringIssuing company token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body

type*stringstringOutput format: "excel" (metadata spreadsheet), "xml" (ZIP of XML files) or "pdf" (ZIP of DANFE PDFs).
statusstringstringFilter by invoice status: a status name (e.g.
monthintintMonth (1–12).
start_create_timelonglongPeriod start, inclusive (Unix timestamp in milliseconds).
end_create_timelonglongPeriod end, exclusive (same rule).

 * Required field.

Period: start_create_time/end_create_time are read by their UTC date and time and interpreted as Brasília time (UTC−3, no daylight saving). Send the UTC midnight of the calendar days: start inclusive, end exclusive. Example, full days 2026-08-29 through 2026-09-01: start_create_time = 1787961600000 (2026-08-29T00:00Z) and end_create_time = 1788307200000 (2026-09-02T00:00Z). Do not add 3 hours to the value.
Export scope: month, or both start_create_time and end_create_time, must be sent; otherwise the request is rejected with a parameter error and no export task is created. The period applies to the issue time, and only production invoices are included. Once an export file exceeds the storage retention period, a call with the same parameters generates it again.

Response fields

statusstringstring"Processing" while the task runs, "Success" when the file is ready
progress_countintintNumber of invoices processed so far
total_countintintTotal invoices to process
urlstringstringDownload URL of the final file (empty while status = Processing)
Idempotency: tasks are deduplicated by a hash of the parameters (uid + token + period + status + type). Repeated calls with the same parameters return the same task's progress, without triggering new executions.

Error responses

MessageCause
发票类型字段不能为空type missing
月份无效month outside 1–12
必须传 month,或同时传 start_create_time 与 end_create_timeNeither month nor both start_create_time and end_create_time were sent
type 为 excel 时 status 不能为空(全部状态传 "all")status missing while type is "excel"
导出处理出现内部错误,请稍后重试Internal processing error; the call may be retried later with the same parameters
<task failure reason>The export task failed (for example, an unsupported type); returned with success: false

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/get_xml" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json