# Change document state Changes the state of a guide-type document (guides-type path segment: shippings, transports, or devolutions). | From | To | Value in request body | | :--- | :--- | :--- | | draft | final | finalized | | draft | deleted | deleted | | final | canceled | canceled | To cancel, send the reason in message inside the wrapper, e.g. {"transport": {"state": "canceled", "message": "Goods were not shipped"}}. Without it the API returns 422 "The cancellation reason is a required field". Endpoint: PUT /api/v3/{guides-type}/{id}/change-state.json Version: 3.1.0 Security: apiKeyAuth ## Path parameters: - `guides-type` (string, required) The type of the guide document. Enum: "shippings", "transports", "devolutions" - `id` (integer, required) The document ID. Example: 541674 ## Query parameters: - `api_key` (string, required) Your API Key. Example: "YOUR_API_KEY" ## Request fields (application/json): - `transport` (object, required) - `transport.state` (string, required) Target state event for guide documents (e.g. finalized, deleted, canceled). Example: "finalized" - `transport.message` (string) Cancellation reason. Required when state is canceled; if it is missing or empty the API returns 422 with "The cancellation reason is a required field" (text in the account's language). Ignored for the other states. Example: "Goods were not shipped" ## Response 200 fields (application/json): - `transport` (object) - `transport.id` (integer) Example: 257224199 - `transport.status` (string) Example: "final" - `transport.archived` (boolean) - `transport.type` (string) Example: "Shipping" - `transport.sequence_number` (string) Example: "1/INVOICEXPRESSDEMO" - `transport.inverted_sequence_number` (string) Example: "INVOICEXPRESSDEMO/1" - `transport.sequence_id` (integer) Example: 5259465 - `transport.date` (string) dd/mm/yyyy Example: "13/05/2026" - `transport.due_date` (string) dd/mm/yyyy Example: "13/06/2026" - `transport.reference` (string,null) - `transport.observations` (string,null) No enforced length limit (text column). - `transport.retention` (number,null) - `transport.permalink` (string) Example: "https://web.invoicexpress.com/documents/abc123" - `transport.saft_hash` (string) No enforced character limit (text column). Example: "Xbsc" - `transport.sum` (number) Example: 100 - `transport.discount` (number) - `transport.before_taxes` (number) Example: 100 - `transport.taxes` (number) Example: 23 - `transport.total` (number) Example: 123 - `transport.currency` (string) Example: "Euro" - `transport.client` (object) - `transport.client.name` (string) Example: "Test Client" - `transport.items` (array) - `transport.items.name` (string) Maximum 60 characters. Longer values are rejected with 422 ("Code for the item is too long"). Example: "Test Item" - `transport.items.description` (string,null) Maximum 200 characters and at most 20 lines. Longer values are rejected with 422. - `transport.items.unit_price` (string) Example: "100.0" - `transport.items.unit` (string) Must be one of a fixed set of supported unit values, not a free-length string. Example: "service" - `transport.items.quantity` (string) Example: "1.0" - `transport.items.tax` (object) - `transport.items.tax.value` (number) Example: 23 - `transport.items.subtotal` (number) Example: 100 - `transport.items.tax_amount` (number) Example: 23 - `transport.items.discount_amount` (number) - `transport.atcud` (string) Example: "N/D" ## 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":"The cancellation reason is a required field"}] - `errors.error` (string)