---
title: "Change Guide State"
method: PUT
path: "/{guides-type}/{document-id}/change-state.json"
tags: ["Guides"]
---

# Change Guide State

`PUT /{guides-type}/{document-id}/change-state.json`

Changes the state of guide documents (shippings, transports, devolutions).

| From | To | Event |
| :--- | :--- | :--- |
| draft | final | **finalized** |
| draft | deleted | **deleted** |
| final | canceled | **canceled** |

## Path parameters

- `guides-type` 'shippings' | 'transports' | 'devolutions', required
- `document-id` integer, required

## Query parameters

- `api_key` string, required

## Request body

- ChangeStateGuideRequest
  - `shipping` object, required
    - `state` 'finalized' | 'canceled' | 'deleted', required
    - `message` string — No enforced character limit (text column, stored as cancel_message).

## Response `200`

SUCCESS 

#### Possible values for field atcud:

* ABCD1234-1 (or similar) - Unique document identifier to the Tax Authority, when the sequence is registered.
* N/D - The document's sequence is relevant for ATCUD but is not registered in the Tax Authority.
* N/A - The document's sequence is not relevant for ATCUD and is not registered in the Tax Authority.

- GuideGetResponse
  - `shipping` object — Wrapper key matches the singular of the requested guide type — `shipping`, `transport` or `devolution`. Shown here as "shipping".
    - `id` integer
    - `status` string
    - `archived` boolean
    - `type` string
    - `sequence_number` string
    - `inverted_sequence_number` string
    - `atcud` string
    - `date` string
    - `due_date` string — dd/mm/yyyy
    - `reference` string, nullable
    - `observations` string, nullable — No enforced character limit (text column).
    - `retention` string, nullable
    - `loaded_at` string — dd/mm/yyyy HH:mm:ss. Note the list endpoint returns this same field as date-only (dd/mm/yyyy).
    - `license_plate` string, nullable — 255-character limit is the database column default, not an explicit business rule.
    - `permalink` string
    - `saft_hash` string — No enforced character limit (text column).
    - `sum` number
    - `discount` number
    - `before_taxes` number
    - `taxes` number
    - `total` number
    - `currency` string
    - `address_from` object
      - `country` string — Not stored on the address itself — resolved through a tax-location name lookup, falling back to Portugal.
      - `postal_code` string — 255-character limit is the database column default on the Address model, not an explicit business rule.
      - `detail` string — 255-character limit is the database column default on the Address model, not an explicit business rule. Note the API re-inserts line breaks roughly every 35 characters before storing, so an input close to 255 characters can overflow the column — keep well under the limit.
      - `city` string — 255-character limit is the database column default on the Address model, not an explicit business rule.
    - `address_to` object
      - `country` string — Not stored on the address itself — resolved through a tax-location name lookup, falling back to Portugal.
      - `postal_code` string — 255-character limit is the database column default on the Address model, not an explicit business rule.
      - `detail` string — 255-character limit is the database column default on the Address model, not an explicit business rule. Note the API re-inserts line breaks roughly every 35 characters before storing, so an input close to 255 characters can overflow the column — keep well under the limit.
      - `city` string — 255-character limit is the database column default on the Address model, not an explicit business rule.
    - `client` object
      - `id` integer
      - `name` string
      - `country` string — 255-character limit is the database column default, not an explicit business rule.
    - `items` object[]
      - `name` string — Maximum 60 characters. V3 rejects a longer name with HTTP 422; V2 accepts the request and silently truncates the stored value to 60 characters.
      - `description` string, nullable — Maximum 200 characters and 20 lines. V3 rejects a longer description with HTTP 422; V2 accepts the request and silently truncates the stored value to 200 characters.
      - `unit_price` string
      - `unit` string, nullable — Restricted to a fixed set of unit values rather than length-limited free text.
      - `quantity` string
      - `tax` object
        - `id` integer
        - `name` string
        - `value` number
      - `discount` number
      - `subtotal` number
      - `tax_amount` number
      - `discount_amount` number
      - `total` number
    - `sequence_id` integer, nullable
    - `tax_exemption` string
    - `at_doc_code_id` string, nullable — Read-only. Written only by the AT gateway and never accepted on input. The 255-character limit is the database column default, not an explicit business rule.

## Other responses

- `401` — ACCESS DENIED
- `404` — NOT FOUND
- `422` — UNPROCESSABLE ENTITY

## Changes

- **2026-08-25** `5b82d4eb0d9f` — 10 breaking, 1 warning, 2 info
  - the response property `shipping/at_doc_code_id` became nullable for the status `200`
  - the response property `shipping/items/items/description` became nullable for the status `200`
  - the response property `shipping/items/items/unit` became nullable for the status `200`
  - the response property `shipping/license_plate` became nullable for the status `200`
  - …9 more

[Change history](https://skmtc.dev/invoicexpress/apis/invoicexpress-api/changes/:guides-type/:document-id/change-state.json/put.md)

---

[API](https://skmtc.dev/invoicexpress/apis/invoicexpress-api.md) · [All operations](https://skmtc.dev/invoicexpress/apis/invoicexpress-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/invoicexpress/invoicexpress-api/revisions/5b82d4eb0d9f/schema)
