# Download CIUS-PT File Generates and downloads the CIUS-PT (electronic invoice) file for a document. The operation is asynchronous: while the file is being generated the response body is {"generating": true}; keep polling until the body contains key and url. Both cases return HTTP 200 — unlike the SAF-T export and the PDF and QR code endpoints, this endpoint does not return 202 while generating. The only difference is which fields are present in the body. Note that this endpoint takes a bare document id with no document-type segment, so any document in the account can be addressed. Only Invoice, InvoiceReceipt, SimplifiedInvoice, DebitNote and CreditNote documents are eligible — VAT MOSS invoices are not, and return 406. Draft documents also return 406. Endpoint: GET /api/v1/edi/{id}/cius-pt Version: 3.1.0 Security: apiKeyAuth ## Path parameters: - `id` (integer, required) The document ID. Example: 541674 ## Query parameters: - `api_key` (string, required) Your API Key. Example: "YOUR_API_KEY" ## Response 401 fields (application/json): - `errors` (array) Returned when the account is in trial, or on a plan without CIUS-PT support. Example: [{"error":"Account is in trial. subscribe in order to have access to this feature"}] - `errors.error` (string) ## Response 404 fields (application/json): - `errors` (array) Example: [{"error":"Resource not found"}] - `errors.error` (string) ## Response 406 fields (application/json): - `errors` (array) Returned when the document type is not eligible for CIUS-PT (invalid document type error) or the document is still a draft (Invalid document status error). The messages are translatable (English shown); do not match on the text, use the 406 status. Example: [{"error":"Invalid document status error"}] - `errors.error` (string) ## Response 422 fields (application/json): - `errors` (array) Returned when the CIUS-PT file could not be generated. The message is the underlying exception message. Example: [{"error":"Error generating the CIUS-PT file"}] - `errors.error` (string) ## Response 500 fields (application/json): - `errors` (array) Example: [{"error":"An unexpected error occurred"}] - `errors.error` (string)