> ## 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.

# Upsert Design Draft

> Create a new draft or update the existing draft design version

## Path Parameters

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

## Body Parameters

At least one top-level field is required.

<Warning>
  Both `theme_tokens` and `layout` use **strict validation**. Any unknown fields will be rejected with a `400 INVALID_SCHEMA` error.
</Warning>

<ParamField body="theme_tokens" type="object">
  Theme token payload. Supports the following sub-fields:

  * `brand.primary` — Primary brand color in `#RRGGBB` format
  * `brand.secondary` — Secondary brand color in `#RRGGBB` format
  * `font.family` — Font family identifier
  * `logo_url` — Logo image URL (string)
  * `favicon_url` — Favicon image URL (string)
</ParamField>

<ParamField body="layout" type="object">
  Layout payload. Supports a `sections` array (max 20 entries) with `type`, optional `enabled`, optional `props`. Valid section types: `header`, `overall_status`, `services_list`, `incident_timeline`, `uptime_chart`, `subscribe_panel`, `footer`.
</ParamField>

<ParamField body="template" type="string | null">
  Custom HTML template body, max `65536` chars (64KB).
</ParamField>

<ParamField body="template_mode" type="string">
  `default` or `custom`.
</ParamField>

<ParamField body="summary" type="string">
  Optional summary, min `1` char, max `500` chars. Empty strings are rejected.
</ParamField>

## Response

<ResponseField name="draft_version" type="object">
  Saved draft version object.
</ResponseField>

<ResponseField name="warnings" type="array">
  Non-blocking validation warnings.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT "https://kodostatus.com/api/v1/status-pages/<page-id>/design/draft" \
    -H "X-API-Key: your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "theme_tokens": {
        "brand": { "primary": "#0ea5e9", "secondary": "#22c55e" },
        "font": { "family": "inter" }
      },
      "layout": {
        "sections": [
          { "type": "header", "enabled": true },
          { "type": "overall_status", "enabled": true },
          { "type": "services_list", "enabled": true },
          { "type": "incident_timeline", "enabled": true },
          { "type": "footer", "enabled": true }
        ]
      },
      "summary": "Spring release branding refresh"
    }'
  ```
</RequestExample>

## Common Errors

| Status | Code              | Meaning                                                                                            |
| ------ | ----------------- | -------------------------------------------------------------------------------------------------- |
| `400`  | `INVALID_SCHEMA`  | Schema or validation failure                                                                       |
| `403`  | `PLAN_RESTRICTED` | `template_mode=custom` is not allowed on current plan. Response includes `upgrade_required: true`. |
| `404`  | -                 | Status page not found                                                                              |
| `500`  | -                 | Draft creation/update failed                                                                       |
