Files
File download
Downloads the original XML or the document PDF through the links returned by queries and callbacks.
GET
/openapi/files/{kind}/{ref}No signature headers required.
Download links in query responses and callback payloads look like https://api.v2.tffiscal.com/openapi/files/{kind}/{ref}?token=…. No signature headers: the token travels with the link and a plain GET is enough. The token is bound to the path, the integrator and the application; changing the path or reusing it on another file invalidates it. Use the link exactly as returned.
Path parameters
kind* | string | File kind |
ref* | string | File reference |
* Required field
Query parameters
token* | string | Link token |
* Required field
302
Redirects to an object-storage URL valid for 60 seconds. Clients must follow redirects (
curl -L). The response carries Cache-Control: no-store; do not cache links.No response body
- Validity: 7 days by default; the platform can configure 1 to 365 days per integrator, and the setting only affects links issued afterwards. Every query issues new links.
- PDF on demand:
danfe,danfce,dacte,daceanddanfseare rendered on the first download, so the link is usable as soon as the document is authorized. If rendering has not finished yet, the response is 503 withRetry-After. - Failures are HTTP statuses: 403 when the application or the integrator is disabled; the body is the platform envelope with
success=false. - Rate limiting and billing: downloads count against the application throttle and have their own
FILESgroup; they are not billed.
kindFile kind
| Values | Meaning |
|---|---|
| xml | Original XML: authorized document or event receipt, by file id |
| danfe | NF-e DANFE PDF, by the 44-digit key |
| danfce | NFC-e 80 mm receipt PDF, by the 44-digit key |
| dacce | Correction letter PDF (DACCE), by file id |
| dacte | CT-e DACTE PDF, by the 44-digit key |
| dace | DC-e DACE PDF, by the 44-digit key |
| danfse | NFS-e DANFSe PDF, by the 50-digit key or the DPS identifier |
| Code | HTTP | |
|---|---|---|
| 10009035 | 401 | Invalid token: signature mismatch, link altered or reused on another file, or the application that issued it no longer exists. |
| 10009035 | 404 | Link does not exist: unknown kind, or the ref of an xml link is not a file identifier. |
| 10009036 | 401 | Download link expired. Query the document again to obtain a fresh link. |
| 10009004 | 403 | Application disabled: every link it issued stops working. |
| 10009015 | 403 | Application not effective yet (pending approval or rejected). |
| 10009014 | 403 | Integrator disabled. |
| 10004001 | 404 | The NF-e behind the link does not exist (DANFE). |
| 10017003 | 404 | The CT-e behind the link does not exist (DACTE). |
| 10019003 | 404 | The DC-e behind the link does not exist (DACE). |
| 10018003 | 404 | The NFS-e behind the link does not exist (DANFSe). |
| 10022006 | 404 | The NFC-e behind the link does not exist (receipt). |
| 10013011 | 404 | File not found (XML). |
| 10004010 | 409 | NF-e not authorized: no DANFE. mensagem gives the current status. |
| 10017046 | 409 | The current CT-e status does not allow a DACTE. |
| 10019046 | 409 | The current DC-e status does not allow a DACE. |
| 10018060 | 409 | The current NFS-e status does not allow a DANFSe. |
| 10022012 | 409 | The current NFC-e status does not allow a receipt: only Autorizada, Cancelada and ContingenciaPendente have one. |
| 10013013 | 409 | File currently unavailable (archived, quarantined or expired). |
| 10009006 | 429 | Application rate limit exceeded. Retry after Retry-After. |
| 10013016 | 429 | Too many downloads from one IP, for links without an application (the ones delivered by webhook). Retry after Retry-After. |
| 10009037 | 503 | Document still being generated. Retry the same link after Retry-After (30 s). |
