# Archive a document Archives the specified document by setting its archived flag to true and returns the updated document. Endpoint: PUT /api/v3/{invoices-type}/{id}/archive Version: 3.1.0 Security: apiKeyAuth ## Path parameters: - `invoices-type` (string, required) The type of the invoice document. receipts (payment receipts) is accepted here; receipts have no create, update, clone or /new (those operations use DocumentTypeInvoiceParam). Enum: "invoices", "invoice_receipts", "simplified_invoices", "credit_notes", "debit_notes", "receipts" - `id` (integer, required) The document ID. Example: 541674 ## Query parameters: - `api_key` (string, required) Your API Key. Example: "YOUR_API_KEY" ## Response 200 fields (application/json): - `invoice` (object) Wrapper key matches the singular of the requested invoice type (invoice, invoice_receipt, simplified_invoice, credit_note, debit_note, or receipt). For the receipt wrapper (payment receipts) the shape differs: items are the payments the receipt covers, each {document_type, document_sequence_number, total, paid} (e.g. {"document_type": "Invoice", "document_sequence_number": "2026/12", "total": 123.0, "paid": 123.0}) instead of product lines; account.bank_data and auto_add_related_document are not returned. - `invoice.id` (integer,null) Null in preview/transform contexts before the document is actually created. Example: 264663413 - `invoice.status` (string) Example: "draft" - `invoice.cancel_reason` (string) No enforced length limit; stored as a text column (maps to cancel_message). Example: "document was duplicated" - `invoice.archived` (boolean) - `invoice.type` (string) Example: "Invoice" - `invoice.sequence_number` (string) Example: "draft" - `invoice.inverted_sequence_number` (string) Example: "draft" - `invoice.sequence_id` (integer,null) Example: 5259451 - `invoice.atcud` (string) Example: "N/A" - `invoice.saft_hash` (string) Only present once the document has been finalized — absent while it is still a draft. Example: "FoIq" - `invoice.tax_exemption` (string) 255-character database column default (column tax_exemption_code); effectively an enum of AT exemption codes. Example: "M01" - `invoice.date` (string) Example: "2026-07-27" - `invoice.due_date` (string) Example: "2026-08-27" - `invoice.reference` (string,null) - `invoice.observations` (string,null) No enforced length limit; stored as a text column. - `invoice.token` (string,null) Null in preview/transform contexts before the document is actually created. Example: "2646634130360dcbca24d2d9509add7c92ccb1d7ab970ce6d" - `invoice.permalink` (string) Example: "https://web.invoicexpress.com/documents/2646634130360dcbca24d2d9509add7c92ccb1d7ab970ce6d?language=pt" - `invoice.retention` (number) - `invoice.global_discount` (object,null) Document-level discount, or null when there is none. - `invoice.global_discount.value_type` (string) Enum: "percentage", "absolute" - `invoice.global_discount.value` (number) Example: 10 - `invoice.owner_invoice_id` (integer,null) - `invoice.raw_owner_invoice` (string) Conditional — only present when set. Reference to an original document issued outside InvoiceXpress (isolated credit/debit notes), in the form " /". - `invoice.currency` (object,null) Document currency when one was set (multi-currency plans); null otherwise. - `invoice.currency.name` (string) Example: "US Dollar" - `invoice.currency.code` (string) Example: "USD" - `invoice.currency.symbol` (string) Example: "$" - `invoice.auto_add_related_document` (boolean) - `invoice.qr_code` (string) Conditional — never present on API-key requests. Only returned to the InvoiceXpress web app, for non-draft documents with a real ATCUD once the QR code image has been generated. Public URL of the QR code image. - `invoice.digital_signed` (boolean) Conditional — never present on API-key requests. Only returned to the InvoiceXpress web app; whether the document PDF is digitally signed. - `invoice.include_payment_reference` (boolean) Conditional — never present on API-key requests. Only returned to the InvoiceXpress web app for draft (or deleted) documents of a type that supports a Multibanco reference, when the plan includes MB, an MB provider is configured and the document has no MB reference yet. Reflects the account's "add payment reference by default" preference. - `invoice.account` (object) - `invoice.account.organization_name` (string) Example: "invoicexpress" - `invoice.account.address` (object) - `invoice.account.address.detail` (string) Example: "Avenida Duque D'Avila, Saldanha" - `invoice.account.address.postal_code` (string) Example: "1500-555" - `invoice.account.address.city` (string) Example: "Lisbon" - `invoice.account.address.country` (string) Example: "Portugal" - `invoice.account.address.translated_country` (string) Country name in the request language. Example: "Portugal" - `invoice.account.email` (string,null) Example: "info@mycompany.com" - `invoice.account.phone` (string,null) - `invoice.account.phone_country_code` (string) International calling code for the phone/mobile number (e.g. +351); empty string when unset. - `invoice.account.phone_indicative_printed` (boolean) Whether the document PDF prints phone behind phone_country_code. - `invoice.account.website` (string,null) - `invoice.account.footer` (string,null) Document footer text — the document series' configured footer when set, otherwise the account's invoice footer. - `invoice.account.fiscal_id` (string) Example: "999999990" - `invoice.account.logo` (string) - `invoice.account.bank_data` (array) - `invoice.client` (object) - `invoice.client.id` (integer) Example: 196600840 - `invoice.client.phone` (string) Empty string when unset. Example: "210000000" - `invoice.client.mobile` (string) Empty string when unset. Example: "910000000" - `invoice.client.mobile_country_code` (string) International calling code for the phone/mobile number (e.g. +351); empty string when unset. - `invoice.client.fiscal_id` (string) 255-character limit is the database column default, not an explicit validation. Example: "987654321" - `invoice.client.translated_country` (string) Client's fiscal country name in the request language. Example: "Portugal" - `invoice.items` (array) Product lines. For the receipt wrapper, the payments the receipt covers (document_type, document_sequence_number, total, paid) — see the wrapper description. - `invoice.items.name` (string) Maximum 60 characters. Longer values are rejected with 422 ("Code for the item is too long"). Example: "Product Name" - `invoice.items.description` (string) Maximum 200 characters and at most 20 lines. Longer values are rejected with 422. Example: "Product description" - `invoice.items.unit_price` (number) Example: 100 - `invoice.items.unit` (string) Must be one of a fixed set of supported unit values, not a length-limited free-text field. Example: "piece" - `invoice.items.quantity` (number) Example: 2 - `invoice.items.tax` (object) - `invoice.items.tax.name` (string) 255-character limit is the database column default; only presence and uniqueness are validated. Example: "IVA23" - `invoice.items.discount` (number) Example: 10 - `invoice.items.subtotal` (number) Example: 180 - `invoice.items.tax_amount` (number) Example: 41.4 - `invoice.items.discount_amount` (number) Example: 20 - `invoice.items.total` (number) Example: 221.4 - `invoice.summary` (object) - `invoice.summary.sum` (number) Example: 200 - `invoice.summary.before_taxes` (number) Example: 180 - `invoice.summary.taxes` (number) Example: 41.4 - `invoice.summary.currency` (object) - `invoice.summary.pay_progress` (number) - `invoice.summary.to_pay` (number) Example: 221.4 - `invoice.summary.total_paid` (number) - `invoice.summary.taxes_breakdown` (array) - `invoice.summary.taxes_breakdown.category` (string) Example: "IVA23" - `invoice.summary.taxes_breakdown.items_value` (number) Example: 180 - `invoice.summary.taxes_breakdown.tax_value` (number) Example: 41.4 - `invoice.summary.total_currency_rate` (number) - `invoice.summary.rate` (number) Example: 1 - `invoice.mb_reference` (object,null) - `invoice.mb_reference.entity` (string) Example: "12345" ## Response 401 fields (application/json): - `errors` (array) Example: [{"error":"Authentication Error"}] - `errors.error` (string) ## Response 404 fields (application/json): - `errors` (array) Example: [{"error":"Resource not found"}] - `errors.error` (string) ## Response 422 fields (application/json): - `errors` (array) Example: [{"error":"Can't archive draft document"}] - `errors.error` (string) ## Response 500 fields (application/json): - `errors` (array) Example: [{"error":"An unexpected error occurred"}] - `errors.error` (string)