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

# Publish Design Draft

> Publish current draft design via an atomic database transaction with optimistic locking

## Path Parameters

<ParamField path="id" type="string" required>
  Status page ID.
</ParamField>

## Body Parameters

<ParamField body="expected_draft_version_id" type="string" required>
  Draft version UUID the client expects to publish.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  `true` when publish succeeds.
</ResponseField>

<ResponseField name="status_page_id" type="string">
  Status page ID.
</ResponseField>

<ResponseField name="current_version_id" type="string">
  Now-published version UUID.
</ResponseField>

<ResponseField name="warnings" type="array">
  Validation warnings from publish-time validation.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://kodostatus.com/api/v1/status-pages/<page-id>/design/publish" \
    -H "X-API-Key: your_api_key" \
    -H "Content-Type: application/json" \
    -d '{ "expected_draft_version_id": "05cc0f5e-c333-4e16-a7f7-67d8c3758f02" }'
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "success": true,
    "status_page_id": "a04cc0eb-35ef-4d7d-a6da-ef79ecb7ff3f",
    "current_version_id": "05cc0f5e-c333-4e16-a7f7-67d8c3758f02",
    "warnings": []
  }
  ```
</ResponseExample>

## Common Errors

| Status | Code                     | Meaning                                                                                                                                                                   |
| ------ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `400`  | `INVALID_SCHEMA`         | Request body invalid or draft failed publish validation                                                                                                                   |
| `403`  | `PLAN_RESTRICTED`        | Custom template publish blocked by plan. Response includes `upgrade_required: true`.                                                                                      |
| `404`  | `DRAFT_NOT_FOUND`        | No draft exists for page                                                                                                                                                  |
| `409`  | `DRAFT_VERSION_MISMATCH` | Draft changed since client last read it. Response includes `current_draft_version_id`.                                                                                    |
| `500`  | -                        | Publish failed. Possible causes: "Failed to publish design version" (RPC atomic transaction failure) or "Failed to apply published design to status page" (sync failure). |
