> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akua.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel order draft

Ends a `draft`. Once `:redeem` started the draft cannot be cancelled (409), because the redemption may already be spent. Cancelling a cancelled draft answers it unchanged.

`POST https://api.akua.dev/v1/order_drafts/{id}:cancel`

## Authorizations

- `Authorization: Bearer <token>` (BearerAuth): Bearer token for the authenticated caller.

## Headers

- `if-match` (string, required): The `etag` of the resource version the client last read. Required on writes when the resource exposes an `etag` field. Mismatch returns 409 `ABORTED` with the current etag in the error metadata. Required string length: `1 - 256`. Example: `"42"`.
- `idempotency-key` (string): Optional caller-supplied idempotency key. Any non-empty key up to 64 characters is accepted. Endpoint-specific documentation describes how the key is used. Required string length: `1 - 64`. Example: `"create-prod-2026-05-07"`.

## Path Parameters

- `id` (string, required): Order draft ID. Required string length: `1 - 55`. Example: `"odft_j572abc..."`.

## Response

### 200: Order draft cancelled

`application/json`: `OrderDraft`

- `id` (string, required): Order draft ID. Required string length: `1 - 55`. Example: `"odft_j572abc..."`.
- `offer_id` (string, required): The Offer this draft redeems.
- `status` (enum<string>, required): `draft`: editable. `redeeming`: fields frozen while the Offer is redeemed and the Install created; `:redeem` again resumes it. `installing`: the Install exists (`install_id`, `operation_id`). `failed`: the Offer redeemed but the Install could not be created (condition `install-failed`). `cancelled`: ended by the customer. Available options: `"draft"`, `"redeeming"`, `"installing"`, `"cancelled"`, `"failed"`.
- `workspace_id` (string | null, required)
- `cluster_id` (string | null, required)
- `values` (object, required): The customer's configuration values, without the Offer's values and without sensitive values.
- `missing` (object[], required)
  - Exactly one of:
    - `workspace`
      - `kind` (enum<string>, required): Available options: `"workspace"`.
    - `cluster`
      - `kind` (enum<string>, required): Available options: `"cluster"`.
    - `value`
      - `kind` (enum<string>, required): Available options: `"value"`.
      - `pointer` (string, required): JSON pointer into the configuration values, such as `/auth/password`. Required string length: `1 - 512`. Example: `"/replicas"`.
      - `sensitive` (boolean, required): A sensitive value is sent only with `:redeem` and never stored on the draft; it stays missing until then.
- `problems` (object[], required)
  - Exactly one of:
    - `offer`
      - `kind` (enum<string>, required): Available options: `"offer"`.
      - `reason` (enum<string>, required): Available options: `"not_found"`, `"not_for_you"`, `"unavailable"`, `"exhausted"`.
      - `message` (string, required): Why, for the customer to read.
    - `workspace`
      - `kind` (enum<string>, required): Available options: `"workspace"`.
      - `workspace_id` (string, required)
      - `reason` (enum<string>, required): Available options: `"not_allowed"`, `"deleting"`.
      - `message` (string, required): Why, for the customer to read.
    - `cluster`
      - `kind` (enum<string>, required): Available options: `"cluster"`.
      - `cluster_id` (string, required)
      - `reason` (enum<string>, required): Available options: `"not_found"`, `"other_workspace"`, `"not_ready"`, `"namespaces_not_allowed"`.
      - `message` (string, required): Why, for the customer to read.
    - `value`
      - `kind` (enum<string>, required): Available options: `"value"`.
      - `pointer` (string, required): JSON pointer into the configuration values, such as `/auth/password`. Required string length: `1 - 512`. Example: `"/replicas"`.
      - `reason` (enum<string>, required): Available options: `"invalid"`, `"locked"`.
      - `message` (string, required): Why, for the customer to read.
    - `expired`
      - `kind` (enum<string>, required): Available options: `"expired"`.
      - `message` (string, required): Why, for the customer to read.
- `install_id` (string | null, required)
- `operation_id` (string | null, required): The Install's create Operation; poll /v1/operations.
- `conditions` (object[], required): Maximum array length: `32 elements`. What needs attention now; empty when nothing does. Reasons:
  - `install-failed` (error): the Offer was redeemed but the Install could not be created; the draft is `failed`.
  - `reason` (string, required): Kebab-case reason; the resource documents the reasons it reports. Maximum string length: `64`. Pattern: `^[a-z0-9]+(?:-[a-z0-9]+)*$`. Example: `"agent-offline"`.
  - `severity` (enum<string>, required): `error`: the resource failed; the condition says why. `warning`: it is limited or held until the person acts or it recovers. `info`: worth knowing, nothing to do. Available options: `"error"`, `"warning"`, `"info"`.
  - `message` (string, required): Safe to show the person as is. Maximum string length: `512`.
  - `remedy` (object | null, required): What the person can do; null when nothing they do helps.
    - Any of:
      - `free-capacity`
        - `kind` (enum<string>, required): Available options: `"free-capacity"`.
        - `metric` (enum<string>, required): Available options: `"kaas/clusters"`, `"compute/machines"`, `"compute/cpu"`, `"compute/memory"`, `"compute/machines_concurrency"`, `"compute/managed_vm_trial"`, `"agents/turns_concurrency"`, `"agents/sandboxes"`, `"agents/sandboxes_running"`, `"agents/retained_filesystem_lifetime"`, `"codemode/executions"`, `"api/secrets_access"`, `"api/secrets_write"`, `"domain_routing/preview_hostnames"`, `"domain_routing/custom_domains"`, `"source_control/repositories"`.
        - `limit` (integer, required)
        - `usage` (integer, required)
        - `hint` (string, required): Maximum string length: `256`.
      - `upgrade-plan`
        - `kind` (enum<string>, required): Available options: `"upgrade-plan"`.
        - `metric` (enum<string>, required): Available options: `"kaas/clusters"`, `"compute/machines"`, `"compute/cpu"`, `"compute/memory"`, `"compute/machines_concurrency"`, `"compute/managed_vm_trial"`, `"agents/turns_concurrency"`, `"agents/sandboxes"`, `"agents/sandboxes_running"`, `"agents/retained_filesystem_lifetime"`, `"codemode/executions"`, `"api/secrets_access"`, `"api/secrets_write"`, `"domain_routing/preview_hostnames"`, `"domain_routing/custom_domains"`, `"source_control/repositories"`.
      - `grant-access`
        - `kind` (enum<string>, required): Available options: `"grant-access"`.
        - `namespace` (string | null, required): Maximum string length: `63`.
        - `permissions` (string[], required): Required array length: `1 - 64 elements`.
      - `reconnect`
        - `kind` (enum<string>, required): Available options: `"reconnect"`.
        - `what` (enum<string>, required): Available options: `"cluster-agent"`, `"connection"`.
      - `add-machine`
        - `kind` (enum<string>, required): Available options: `"add-machine"`.
      - `add-billing`
        - `kind` (enum<string>, required): Available options: `"add-billing"`.
      - `change-input`
        - `kind` (enum<string>, required): Available options: `"change-input"`.
        - `path` (string[], required): Maximum array length: `32 elements`.
      - `retry`
        - `kind` (enum<string>, required): Available options: `"retry"`.
        - `after_seconds` (integer | null, required)
      - `run-agent-install`
        - `kind` (enum<string>, required): Run the command from `POST /v1/clusters/{id}/connector_install` again; it re-applies the ClusterConnector and its updater at one release. Available options: `"run-agent-install"`.
      - `customer-upgrade`
        - `kind` (enum<string>, required): The change needs rights the agent was not granted. Run `command` (a `helm upgrade`, no secret) with an identity that holds `permissions`, or grant them to the agent. Available options: `"customer-upgrade"`.
        - `permissions` (string[], required): Required array length: `1 - 64 elements`.
        - `command` (string, required): Required string length: `1 - 8192`.
  - `last_transition_at` (integer, required): Unix timestamp (seconds) when this condition last changed. Required range: `x >= 0`.
- `redeemed_at` (integer | null, required): Unix timestamp (seconds). Required range: `x >= 0`.
- `created_at` (integer, required): Unix timestamp (seconds). Required range: `x >= 0`.
- `updated_at` (integer, required): Unix timestamp (seconds). Required range: `x >= 0`.
- `expires_at` (integer, required): Unix timestamp (seconds). After this time a `draft` can no longer change or redeem. Required range: `x >= 0`.
- `etag` (string, required)

### 401: Missing, invalid or expired credential.

`application/json`: `ApiUnauthorized`

- `_tag` (enum<string>, required): Available options: `"Unauthorized"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 403: The credential may not act in this workspace.

`application/json`: `ApiForbidden`

- `_tag` (enum<string>, required): Available options: `"Forbidden"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 404: The resource was not found in this workspace.

`application/json`: `ApiNotFound`

- `_tag` (enum<string>, required): Available options: `"NotFound"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 409: The request conflicts with existing resource state or immutable intent. | The resource changed since the etag the client sent; the current etag is in the metadata.

`application/json`: `object`

- Any of:
  - `Conflict`
    - `_tag` (enum<string>, required): Available options: `"Conflict"`.
    - `success` (enum<boolean>, required): Available options: `false`.
    - `errors` (object[], required): Minimum array length: `1 element`.
      - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
      - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
      - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
      - `metadata` (record<string, string>)
    - `result` (object, required)
  - `PreconditionFailed`
    - `_tag` (enum<string>, required): Available options: `"PreconditionFailed"`.
    - `success` (enum<boolean>, required): Available options: `false`.
    - `errors` (object[], required): Required array length: `1 - 1 element`.
      - `code` (enum<number>, required): Available options: `7006`.
      - `message` (string, required)
      - `metadata` (object, required)
        - `current_etag` (string, required)
        - `{key}` (string)
    - `result` (object, required)

### 500: The server failed to handle the request.

`application/json`: `ApiInternalServerError`

- `_tag` (enum<string>, required): Available options: `"InternalServerError"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Required array length: `1 - 1 element`.
  - `code` (enum<number>, required): Available options: `7009`.
  - `message` (enum<string>, required): Available options: `"Internal server error"`.
- `result` (object, required)

## Example request

```bash
curl --request POST \
  --url 'https://api.akua.dev/v1/order_drafts/odft_j572abc...:cancel' \
  --header 'Authorization: Bearer <token>' \
  --header 'if-match: 42'
```

## Example response

`200` `application/json`

```json
{
  "id": "odft_j572abc...",
  "offer_id": "offer_j572abc123def456",
  "status": "draft",
  "workspace_id": "ws_j572abc123def456",
  "cluster_id": "clu_j572abc123def456",
  "values": {},
  "missing": [
    {
      "kind": "workspace"
    }
  ],
  "problems": [
    {
      "kind": "offer",
      "reason": "not_found",
      "message": "<string>"
    }
  ],
  "install_id": "inst_j572abc123def456",
  "operation_id": "op_j572abc123def456",
  "conditions": [
    {
      "reason": "agent-offline",
      "severity": "error",
      "message": "<string>",
      "remedy": {
        "kind": "free-capacity",
        "metric": "kaas/clusters",
        "limit": 123,
        "usage": 123,
        "hint": "<string>"
      },
      "last_transition_at": 123
    }
  ],
  "redeemed_at": 123,
  "created_at": 123,
  "updated_at": 123,
  "expires_at": 123,
  "etag": "<string>"
}
```
