{
    "openapi": "3.1.0",
    "info": {
        "title": "Kelma API",
        "version": "1.0",
        "description": "The Kelma API lets you manage your Kelma sites from code, CI pipelines and AI agents. Everything you can do in the [Kelma Panel](https://dash.kelma.io) is available here: sites, WordPress, domains, DNS, databases, backups and restores, push to live, Git deploys, caching, security, cron jobs, redirects, monitoring, collaborators and the terminal.\n\nThe API runs the same actions as the panel, with the same permission checks and safety guardrails.\n\n## Quick start\n\n1. In the Kelma Panel, open **Profile → API tokens** and create a token. Copy it: it is shown once.\n2. Call the API with the token as a bearer token:\n\n```bash\ncurl https://api.kelma.io/v1/sites \\\n  -H \"Authorization: Bearer $KELMA_TOKEN\"\n```\n\n3. Take a backup before a change, and wait for it:\n\n```bash\nRUN=$(curl -s -X POST https://api.kelma.io/v1/sites/42/backups \\\n  -H \"Authorization: Bearer $KELMA_TOKEN\" -H \"Content-Type: application/json\" \\\n  -d '{\"kind\":\"snapshot\",\"note\":\"before plugin updates\"}' | jq -r .data.id)\n\ncurl -s https://api.kelma.io/v1/sites/42/backup-runs/$RUN -H \"Authorization: Bearer $KELMA_TOKEN\"\n```\n\n## Authentication\n\nEvery request needs an `Authorization: Bearer kelma_…` header. A token belongs to you and can reach every site you own or collaborate on, unless you limit it to one site. It can only do what its **abilities** allow, such as `sites:read`, `backups:write` or `dns:write`. Each endpoint lists the ability it needs. Tokens can expire after 30, 90 or 365 days, and you can revoke them at any time.\n\nTreat tokens like passwords. Don't commit them to repositories or paste them into files inside a site's public folder.\n\n## Requests and responses\n\n- Send JSON with `Content-Type: application/json`. File uploads (zone and redirect imports) use `multipart/form-data`.\n- Reads return `200` with the result in `data`.\n- Actions return a `message`. Actions that take a while, such as creating a site, installing WordPress, backups, pushes and deploys, start in the background and return `202`. Poll the matching status endpoint to follow them.\n- Ids are integers, except backup runs (uuid) and Cloudflare zone and record ids (strings).\n\n## Errors\n\nErrors use standard HTTP status codes and a consistent body:\n\n```json\n{ \"error\": { \"code\": \"forbidden\", \"message\": \"This token lacks the 'backups:write' ability.\" } }\n```\n\n| Status | Meaning |\n|---|---|\n| `400` | The action could not be done (the message says why) |\n| `401` | Missing, invalid or expired token |\n| `403` | The token lacks the ability, or is limited to another site |\n| `404` | No such site or object, or you have no access to it |\n| `409` | Something is already running (a backup or a push) |\n| `422` | Invalid input. `errors` lists the problems per field |\n| `429` | Rate limit or backup limit reached |\n\n## Rate limits\n\nEach token can make 120 requests a minute. Actions that work on servers (anything that isn't a read) are limited to 10 a minute. When you hit a limit you get `429` with a `Retry-After` header.\n\n## Long-running operations\n\n| Operation | Start | Follow |\n|---|---|---|\n| Backup | `POST /v1/sites/{site}/backups` | `GET /v1/sites/{site}/backup-runs/{run}` |\n| Push to live | `POST /v1/sites/{site}/push` | `GET /v1/sites/{site}/push` |\n| Git deploy | `POST /v1/sites/{site}/git/deploy` | `GET /v1/sites/{site}/git/deployments` |\n| New site | `POST /v1/sites` | `GET /v1/sites/statuses?ids[]={id}` |\n\n## AI agents and MCP\n\nThe **Kelma MCP server** lets Claude, ChatGPT, Cursor and other MCP clients use this API as tools, so an assistant can check your sites, take a backup before it changes anything, clear caches and push staging to live. The endpoint is `https://api.kelma.io/mcp` (Streamable HTTP).\n\n- **Claude and ChatGPT** (web, desktop and mobile): add a custom connector with the URL `https://api.kelma.io/mcp`. You sign in to Kelma and choose what the app may do (read only, recommended or full access; all sites or one). Manage connected apps under **Profile → Integrations**.\n- **Claude Code, Cursor, VS Code**: add the same URL. They sign in through the browser the same way, or you can send an API token in the `Authorization` header.\n\n```bash\nclaude mcp add --transport http kelma https://api.kelma.io/mcp\n```\n\n### OAuth for MCP clients\n\nKelma implements the MCP authorization spec: OAuth 2.1 authorization code with PKCE (`S256`), dynamic client registration ([RFC 7591](https://www.rfc-editor.org/rfc/rfc7591)) and rotating refresh tokens. Discovery starts from the `WWW-Authenticate` header on a `401` from `/mcp`:\n\n| | |\n|---|---|\n| Protected resource metadata | `https://api.kelma.io/.well-known/oauth-protected-resource` |\n| Authorization server metadata | `https://api.kelma.io/.well-known/oauth-authorization-server` |\n| Registration | `POST https://api.kelma.io/oauth/register` |\n| Authorization (consent screen) | `https://dash.kelma.io/oauth/authorize` |\n| Token / revocation | `POST https://api.kelma.io/oauth/token`, `POST https://api.kelma.io/oauth/revoke` |\n\nAccess tokens last one hour; refresh tokens last 90 days and change on every use. The abilities the user picks on the consent screen are returned in `scope`, and every API permission check applies.\n\nOn the server itself, every site has a `kelma` command and an `AGENTS.md` file for coding agents working over SSH:\n\n```bash\nkelma backup \"before theme edits\"   # snapshot of files + databases, waits until done\nkelma cache:clear                   # OPcache, object cache and Cloudflare\n```\n\n## Support\n\nQuestions or problems: live chat in the Kelma Panel, in Arabic and English. Guides: [kelma.io/knowledge-base](https://kelma.io/knowledge-base/). Machine-readable: [openapi.json](https://api.kelma.io/openapi.json) · [llms.txt](https://api.kelma.io/llms.txt).",
        "contact": {
            "name": "Kelma support",
            "url": "https://kelma.io/support/"
        },
        "termsOfService": "https://kelma.io/terms-of-service/"
    },
    "servers": [
        {
            "url": "https://api.kelma.io",
            "description": "Production"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "Account",
            "description": "Who the token belongs to, and your account activity."
        },
        {
            "name": "Sites",
            "description": "Create, list and delete sites; change PHP and site settings."
        },
        {
            "name": "Applications",
            "description": "Install WordPress on a site, and manage WordPress multisite."
        },
        {
            "name": "WordPress",
            "description": "Core, plugin and theme updates, plugins, themes, users and database search-replace. Slow jobs (updates, installs, search-replace) are queued: poll the returned task."
        },
        {
            "name": "Domains",
            "description": "Extra domains (aliases) and the primary domain of a site. SSL is issued and renewed automatically by Cloudflare for every domain."
        },
        {
            "name": "DNS",
            "description": "Manage DNS in your own Cloudflare account (connect it once in Profile → Integrations)."
        },
        {
            "name": "Databases",
            "description": "MySQL databases and their users."
        },
        {
            "name": "Backups",
            "description": "Restore points and snapshots (files + every database), restores and downloads."
        },
        {
            "name": "Push to live",
            "description": "Copy files and/or database tables from one site (usually staging) onto another."
        },
        {
            "name": "Git",
            "description": "Deploy a site from a GitHub repository, manually or on every push."
        },
        {
            "name": "Cache & performance",
            "description": "Cloudflare edge cache, Nginx FastCGI cache and PHP OPcache."
        },
        {
            "name": "Security",
            "description": "Cloudflare firewall options, security headers, TLS and development mode."
        },
        {
            "name": "Cron jobs",
            "description": "Scheduled commands and built-in automations."
        },
        {
            "name": "Redirects",
            "description": "Server-level redirects."
        },
        {
            "name": "Monitoring & reports",
            "description": "Server health, traffic analytics, logs and periodic email reports."
        },
        {
            "name": "Collaborators",
            "description": "Give teammates access to one site."
        },
        {
            "name": "Terminal",
            "description": "Run a shell or WP-CLI command on the site."
        },
        {
            "name": "Credentials",
            "description": "Reveal or reset SFTP/SSH and database passwords."
        }
    ],
    "x-tagGroups": [
        {
            "name": "Sites",
            "tags": [
                "Account",
                "Sites",
                "Applications",
                "WordPress"
            ]
        },
        {
            "name": "Domains & DNS",
            "tags": [
                "Domains",
                "DNS"
            ]
        },
        {
            "name": "Data & deploys",
            "tags": [
                "Backups",
                "Push to live",
                "Databases",
                "Git"
            ]
        },
        {
            "name": "Performance & security",
            "tags": [
                "Cache & performance",
                "Security",
                "Redirects",
                "Cron jobs"
            ]
        },
        {
            "name": "Operations",
            "tags": [
                "Monitoring & reports",
                "Collaborators",
                "Terminal",
                "Credentials"
            ]
        }
    ],
    "paths": {
        "/v1/me": {
            "get": {
                "operationId": "getTheCurrentToken",
                "summary": "Get the current token",
                "description": "The user the token belongs to, its abilities and, for site-scoped tokens, the site it is limited to. Useful to check a token works.\n\nAny valid token.",
                "tags": [
                    "Account"
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Me"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/activity": {
            "get": {
                "operationId": "listAccountActivity",
                "summary": "List account activity",
                "description": "The activity log shown on the panel's Logs page: sites created, backups taken, settings changed and so on.\n\n**Ability:** `account:read` · Not available to site-scoped tokens.",
                "tags": [
                    "Account"
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites": {
            "get": {
                "operationId": "listSites",
                "summary": "List sites",
                "description": "Every site you own or collaborate on. A site-scoped token returns only its site.\n\n**Ability:** `sites:read`",
                "tags": [
                    "Sites"
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SiteList"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "createASite",
                "summary": "Create a site",
                "description": "Creates a site on a Kelma server with free room. Creation runs in the background: poll `GET /v1/sites/statuses` or `GET /v1/sites` until its `status` is `active`.\n\nUse `type: staging` to create a staging site at an automatic, unguessable `<name>-stg-<random>.kelma.io` address (then install WordPress or push a live site onto it). Pass `staging_of_site_id` to link it to one of your live sites: the name defaults to that site's, and media files missing on staging are loaded from the live site. New staging sites are private: visitors must log in to WordPress (see `staging_private` under Security).\n\n**Ability:** `sites:write` · Not available to site-scoped tokens.",
                "tags": [
                    "Sites"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "live",
                                            "staging"
                                        ],
                                        "description": "live, or staging for a staging copy"
                                    },
                                    "domain": {
                                        "type": "string",
                                        "description": "Domain for a live site, e.g. example.com (not needed for staging)"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Staging only: name for the address, e.g. shop → shop-stg-k3f9q2.kelma.io (letters, digits, spaces, dots, hyphens; max 30)"
                                    },
                                    "staging_of_site_id": {
                                        "type": "integer",
                                        "description": "Staging only: id of the live site this staging copy belongs to"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/statuses": {
            "get": {
                "operationId": "getSiteStatuses",
                "summary": "Get site statuses",
                "description": "Lightweight status check for many sites at once (provisioning, active, …).\n\n**Ability:** `sites:read` · Not available to site-scoped tokens.",
                "tags": [
                    "Sites"
                ],
                "parameters": [
                    {
                        "name": "ids",
                        "in": "query",
                        "required": false,
                        "description": "Site ids",
                        "schema": {
                            "type": "array",
                            "items": {
                                "type": "integer"
                            }
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}": {
            "get": {
                "operationId": "getASite",
                "summary": "Get a site",
                "description": "Site details including the server, the SSH command and the web root.\n\n**Ability:** `sites:read`",
                "tags": [
                    "Sites"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SiteDetail"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "operationId": "deleteASite",
                "summary": "Delete a site",
                "description": "Permanently deletes the site, its files, databases, cron jobs and redirects. Only the site owner can do this. **This cannot be undone.**\n\n**Ability:** `sites:delete`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Sites"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/settings": {
            "get": {
                "operationId": "getSiteSettings",
                "summary": "Get site settings",
                "description": "PHP version, available PHP versions, linked DNS zone and caching state.\n\n**Ability:** `sites:read`",
                "tags": [
                    "Sites"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "operationId": "updateSiteSettings",
                "summary": "Update site settings",
                "description": "**Ability:** `sites:write`",
                "tags": [
                    "Sites"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "dns_id": {
                                        "type": "string",
                                        "description": "Cloudflare zone id (32 hex characters) to link, or null"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/settings/php-version": {
            "patch": {
                "operationId": "changeThePhpVersion",
                "summary": "Change the PHP version",
                "description": "Switches the site to another installed PHP version (see `available_php_versions` in the settings).\n\n**Ability:** `sites:write`",
                "tags": [
                    "Sites"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "version": {
                                        "type": "string",
                                        "description": "e.g. 8.3"
                                    }
                                },
                                "required": [
                                    "version"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/apps": {
            "get": {
                "operationId": "getTheInstalledApplication",
                "summary": "Get the installed application",
                "description": "**Ability:** `sites:read`",
                "tags": [
                    "Applications"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "installAnApplication",
                "summary": "Install an application",
                "description": "Installs WordPress (with Kelma caching, SSL and single sign-on). Runs in the background.\n\n**Ability:** `sites:write`",
                "tags": [
                    "Applications"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "wordpress"
                                        ],
                                        "description": "Application"
                                    },
                                    "options": {
                                        "type": "object",
                                        "description": "Installer options (optional)"
                                    }
                                },
                                "required": [
                                    "type"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "operationId": "uninstallTheApplication",
                "summary": "Uninstall the application",
                "description": "**Ability:** `sites:delete`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Applications"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/apps/detect": {
            "get": {
                "operationId": "detectWordpress",
                "summary": "Detect WordPress",
                "description": "Checks the site's files for a WordPress install and returns its version.\n\n**Ability:** `sites:read`",
                "tags": [
                    "Applications"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/multisite": {
            "get": {
                "operationId": "getMultisiteStatus",
                "summary": "Get multisite status",
                "description": "Whether WordPress multisite is on, its mode and its sub-sites.\n\n**Ability:** `sites:read`",
                "tags": [
                    "Applications"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "turnMultisiteOnOrOff",
                "summary": "Turn multisite on or off",
                "description": "**Ability:** `sites:write`",
                "tags": [
                    "Applications"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enabled": {
                                        "type": "boolean",
                                        "description": "On or off"
                                    },
                                    "mode": {
                                        "type": "string",
                                        "enum": [
                                            "subdirectory",
                                            "subdomain"
                                        ],
                                        "description": "Sub-site addressing"
                                    }
                                },
                                "required": [
                                    "enabled"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/multisite/domains": {
            "post": {
                "operationId": "connectASubSiteAddress",
                "summary": "Connect a sub-site address",
                "description": "For subdomain multisites: adds a sub-site hostname to the site (Cloudflare issues its SSL certificate).\n\n**Ability:** `domains:write`",
                "tags": [
                    "Applications"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "host": {
                                        "type": "string",
                                        "description": "e.g. shop.example.com"
                                    }
                                },
                                "required": [
                                    "host"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/redis": {
            "get": {
                "operationId": "getRedisObjectCacheStatus",
                "summary": "Get Redis object cache status",
                "description": "Whether WordPress keeps its object cache in Redis. Checked live over SSH (cached 2 minutes; `?fresh=1` re-checks).\n\n- `available`: Redis can be turned on for sites on this server.\n- `state`: `on`, `off`, `error` (turned on by Kelma but WordPress can't reach Redis; turn it off and on again), `other` (another object cache, see `provider`), or `null` when WordPress did not answer.\n- `provider`: the object cache drop-in in use (e.g. `Redis Object Cache`, `Object Cache Pro`), or null.\n- `managed`: set up by Kelma (its own Redis user, limited to this site's keys). `connected`: the drop-in reports a live connection.\n- `can_takeover`: a hand-made Redis Object Cache setup that turning Redis on would replace.\n- `status`: the last on/off change: `state` `queued`, `running` (with `step`: `checking`, `redis`, `wordpress`, `verifying`), `done` (with `notes`) or `failed` (with `error`). Kept 24 hours.\n\n**Ability:** `wordpress:read`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "turnRedisObjectCacheOnOrOff",
                "summary": "Turn Redis object cache on or off",
                "description": "Queued, takes about a minute: poll `GET /v1/sites/{site}/redis` until `status.state` is `done` or `failed`.\n\nOn: installs and activates the Redis Object Cache plugin, writes its settings to wp-config.php (connecting through Relay, an in-process cache, when the site's PHP version has it, otherwise phpredis), installs the drop-in, then checks that WordPress connects and the home page still loads. On any failure everything is put back. Off: removes the drop-in and the settings and deactivates the plugin.\n\nRefused when the site uses another object cache (`state: other`, unless `can_takeover`) or Redis is not `available` on the server.\n\n**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enabled": {
                                        "type": "boolean",
                                        "description": "On or off"
                                    }
                                },
                                "required": [
                                    "enabled"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/redis/flush": {
            "post": {
                "operationId": "flushTheRedisObjectCache",
                "summary": "Flush the Redis object cache",
                "description": "Empties this site's object cache (only its own keys). Only when `managed` is true.\n\n**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress": {
            "get": {
                "operationId": "getWordpressVersionAndUpdates",
                "summary": "Get WordPress version and updates",
                "description": "Core version and every pending core, plugin and theme update with versions. Checks wordpress.org live, so it takes a few seconds.\n\n`core.versions` lists the core releases you can update to, newest first, each with a `type`: `major` (a new version line, e.g. 7.1 → 7.2) or `minor` (a security and maintenance release of your current line). Pass one as `core_version` to `POST /wordpress/updates`.\n\n**Ability:** `wordpress:read`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/updates": {
            "post": {
                "operationId": "updateWordpress",
                "summary": "Update WordPress",
                "description": "Updates core (and runs its database upgrade), plugins and/or themes. Queued: returns a task (202); poll `GET /v1/sites/{site}/wordpress/tasks/{task}` until `state` is `completed` or `failed`. PHP OpCache is reset afterwards.\n\nTake a snapshot first (`POST /v1/sites/{site}/backups`) so you can roll back. `[\"*\"]` updates everything that has an update.\n\n**Ability:** `wordpress:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "core": {
                                        "type": "boolean",
                                        "description": "Update WordPress core"
                                    },
                                    "plugins": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Plugin slugs, or [\"*\"] for all"
                                    },
                                    "themes": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Theme slugs, or [\"*\"] for all"
                                    },
                                    "minor_only": {
                                        "type": "boolean",
                                        "description": "Only minor/patch versions (core, plugins and themes)"
                                    },
                                    "core_version": {
                                        "type": "string",
                                        "description": "Update core to exactly this version from `core.versions`, e.g. the security release of your current line while staying off a new major. Implies `core: true`"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/tasks/{task}": {
            "get": {
                "operationId": "getAWordpressTask",
                "summary": "Get a WordPress task",
                "description": "Status of a queued update, install or search-replace: `queued`, `running`, `completed` or `failed`, with WP-CLI output in `result`. Kept 24 hours.\n\n**Ability:** `wordpress:read`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "task",
                        "in": "path",
                        "required": true,
                        "description": "WordPress task id (from the 202 response).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/plugins": {
            "get": {
                "operationId": "listPlugins",
                "summary": "List plugins",
                "description": "Installed plugins with status (active, inactive, must-use, dropin), version and pending update.\n\n**Ability:** `wordpress:read`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "installAPlugin",
                "summary": "Install a plugin",
                "description": "From wordpress.org (slug) or an https URL to a .zip. Queued: returns a task to poll.\n\n**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "source": {
                                        "type": "string",
                                        "description": "Slug (e.g. query-monitor) or https://….zip"
                                    },
                                    "activate": {
                                        "type": "boolean",
                                        "description": "Activate after installing"
                                    }
                                },
                                "required": [
                                    "source"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/plugins/{plugin}/activate": {
            "post": {
                "operationId": "activateAPlugin",
                "summary": "Activate a plugin",
                "description": "**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "plugin",
                        "in": "path",
                        "required": true,
                        "description": "Plugin slug (folder name, from List plugins).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/plugins/{plugin}/deactivate": {
            "post": {
                "operationId": "deactivateAPlugin",
                "summary": "Deactivate a plugin",
                "description": "**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "plugin",
                        "in": "path",
                        "required": true,
                        "description": "Plugin slug (folder name, from List plugins).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/plugins/{plugin}": {
            "delete": {
                "operationId": "deleteAPlugin",
                "summary": "Delete a plugin",
                "description": "Deactivates the plugin, then deletes its files. Its database tables and options are left in place.\n\n**Ability:** `wordpress:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "plugin",
                        "in": "path",
                        "required": true,
                        "description": "Plugin slug (folder name, from List plugins).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/themes": {
            "get": {
                "operationId": "listThemes",
                "summary": "List themes",
                "description": "**Ability:** `wordpress:read`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "installATheme",
                "summary": "Install a theme",
                "description": "From wordpress.org (slug) or an https URL to a .zip. Queued: returns a task to poll.\n\n**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "source": {
                                        "type": "string",
                                        "description": "Slug (e.g. astra) or https://….zip"
                                    },
                                    "activate": {
                                        "type": "boolean",
                                        "description": "Activate after installing"
                                    }
                                },
                                "required": [
                                    "source"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/themes/{theme}/activate": {
            "post": {
                "operationId": "activateATheme",
                "summary": "Activate a theme",
                "description": "**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "theme",
                        "in": "path",
                        "required": true,
                        "description": "Theme slug (folder name, from List themes).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/themes/{theme}": {
            "delete": {
                "operationId": "deleteATheme",
                "summary": "Delete a theme",
                "description": "The active theme (and its parent) cannot be deleted.\n\n**Ability:** `wordpress:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "theme",
                        "in": "path",
                        "required": true,
                        "description": "Theme slug (folder name, from List themes).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/search-replace": {
            "post": {
                "operationId": "searchAndReplaceInTheDatabase",
                "summary": "Search and replace in the database",
                "description": "Runs `wp search-replace` (serialized data safe, `guid` column skipped). A dry run by default: it reports how many replacements would be made and changes nothing. For the real run, take a snapshot first, then send `\"dry_run\": false, \"confirm\": true`. Queued: returns a task to poll; the count is in `result.replacements`.\n\n**Ability:** `wordpress:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "search": {
                                        "type": "string",
                                        "description": "Text to find (min 3 characters)"
                                    },
                                    "replace": {
                                        "type": "string",
                                        "description": "Replacement (may be empty)"
                                    },
                                    "dry_run": {
                                        "type": "boolean",
                                        "description": "Default true"
                                    },
                                    "tables": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Only these tables (wildcards with %)"
                                    },
                                    "all_tables": {
                                        "type": "boolean",
                                        "description": "Include tables without the WordPress prefix"
                                    },
                                    "confirm": {
                                        "type": "boolean",
                                        "description": "Required when dry_run is false"
                                    }
                                },
                                "required": [
                                    "search",
                                    "replace"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/users": {
            "get": {
                "operationId": "listWordpressUsers",
                "summary": "List WordPress users",
                "description": "**Ability:** `wordpress:read`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "createAWordpressUser",
                "summary": "Create a WordPress user",
                "description": "A strong password is generated and returned once in `password`; Kelma does not store it.\n\n**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "login": {
                                        "type": "string",
                                        "description": "Username (letters, digits, . _ -)"
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "Email address"
                                    },
                                    "role": {
                                        "type": "string",
                                        "enum": [
                                            "administrator",
                                            "editor",
                                            "author",
                                            "contributor",
                                            "subscriber"
                                        ],
                                        "description": "Role (default subscriber)"
                                    }
                                },
                                "required": [
                                    "login",
                                    "email"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/users/{user}": {
            "patch": {
                "operationId": "changeAWordpressUserRole",
                "summary": "Change a WordPress user role",
                "description": "**Ability:** `wordpress:write`",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "description": "WordPress user ID (from List WordPress users).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "role": {
                                        "type": "string",
                                        "enum": [
                                            "administrator",
                                            "editor",
                                            "author",
                                            "contributor",
                                            "subscriber"
                                        ],
                                        "description": "New role"
                                    }
                                },
                                "required": [
                                    "role"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "operationId": "deleteAWordpressUser",
                "summary": "Delete a WordPress user",
                "description": "An administrator's content is reassigned to another administrator. The last administrator cannot be deleted.\n\n**Ability:** `wordpress:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "description": "WordPress user ID (from List WordPress users).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/wordpress/users/{user}/reset-password": {
            "post": {
                "operationId": "resetAWordpressUserPassword",
                "summary": "Reset a WordPress user password",
                "description": "Sets a new generated password, returned once in `password`. No email is sent.\n\n**Ability:** `wordpress:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "WordPress"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "user",
                        "in": "path",
                        "required": true,
                        "description": "WordPress user ID (from List WordPress users).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/domains": {
            "get": {
                "operationId": "listDomains",
                "summary": "List domains",
                "description": "**Ability:** `domains:read`",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "addADomain",
                "summary": "Add a domain",
                "description": "Adds an extra domain (alias). Point its DNS at Kelma (the records to add are in `validations` from List domains, or use Point to Kelma in DNS); Cloudflare then issues its SSL certificate automatically. `validations[].ssl_status` shows its progress.\n\n**Ability:** `domains:write`",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "domain": {
                                        "type": "string",
                                        "description": "e.g. www.example.com"
                                    }
                                },
                                "required": [
                                    "domain"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/domains/primary": {
            "post": {
                "operationId": "setThePrimaryDomain",
                "summary": "Set the primary domain",
                "description": "Makes one of the site's domains the primary one. WordPress URLs are updated to match.\n\n**Ability:** `domains:write`",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "domain": {
                                        "type": "string",
                                        "description": "A domain already on the site"
                                    }
                                },
                                "required": [
                                    "domain"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/domains/{alias}": {
            "delete": {
                "operationId": "removeADomain",
                "summary": "Remove a domain",
                "description": "**Ability:** `domains:write`",
                "tags": [
                    "Domains"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "alias",
                        "in": "path",
                        "required": true,
                        "description": "The domain to remove, e.g. www.example.com.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/dns/zones": {
            "get": {
                "operationId": "listCloudflareZones",
                "summary": "List Cloudflare zones",
                "description": "Zones in your connected Cloudflare account, with the ones matching this site's domains first.\n\n**Ability:** `dns:read`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/dns/zones/{zone}/records": {
            "get": {
                "operationId": "listDnsRecords",
                "summary": "List DNS records",
                "description": "**Ability:** `dns:read`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "createADnsRecord",
                "summary": "Create a DNS record",
                "description": "**Ability:** `dns:write`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "A",
                                            "AAAA",
                                            "CNAME",
                                            "TXT",
                                            "MX",
                                            "NS"
                                        ],
                                        "description": "Record type"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "@ for the apex, a label, * or a full name"
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "Record value"
                                    },
                                    "ttl": {
                                        "type": "integer",
                                        "description": "1 = auto, or 60–86400 seconds"
                                    },
                                    "proxied": {
                                        "type": "boolean",
                                        "description": "Proxy through Cloudflare (A/AAAA/CNAME)"
                                    },
                                    "priority": {
                                        "type": "integer",
                                        "description": "MX priority"
                                    }
                                },
                                "required": [
                                    "type",
                                    "name",
                                    "content",
                                    "ttl"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/dns/zones/{zone}/records/{record}": {
            "put": {
                "operationId": "updateADnsRecord",
                "summary": "Update a DNS record",
                "description": "**Ability:** `dns:write`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "record",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare DNS record id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "Record type"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Name"
                                    },
                                    "content": {
                                        "type": "string",
                                        "description": "Value"
                                    },
                                    "ttl": {
                                        "type": "integer",
                                        "description": "TTL"
                                    },
                                    "proxied": {
                                        "type": "boolean",
                                        "description": "Proxied"
                                    },
                                    "priority": {
                                        "type": "integer",
                                        "description": "Priority"
                                    }
                                },
                                "required": [
                                    "type",
                                    "name",
                                    "content",
                                    "ttl"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "operationId": "deleteADnsRecord",
                "summary": "Delete a DNS record",
                "description": "**Ability:** `dns:write`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "record",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare DNS record id.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/dns/zones/{zone}/export": {
            "get": {
                "operationId": "exportAZoneFile",
                "summary": "Export a zone file",
                "description": "Returns a BIND zone file.\n\n**Ability:** `dns:read`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/dns/zones/{zone}/import": {
            "post": {
                "operationId": "importAZoneFile",
                "summary": "Import a zone file",
                "description": "Send as `multipart/form-data` with a `file` field (BIND format, max 256 KB).\n\n**Ability:** `dns:write`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Zone file"
                                    },
                                    "proxied": {
                                        "type": "boolean",
                                        "description": "Proxy imported records"
                                    }
                                },
                                "required": [
                                    "file"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/dns/zones/{zone}/connect": {
            "get": {
                "operationId": "previewPointToKelma",
                "summary": "Preview \"Point to Kelma\"",
                "description": "The records that pointing a hostname at Kelma would create or change.\n\n**Ability:** `dns:read`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "hostname",
                        "in": "query",
                        "required": true,
                        "description": "Hostname in the zone",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "pointAHostnameToKelma",
                "summary": "Point a hostname to Kelma",
                "description": "Creates the DNS-only CNAME and SSL validation records so the hostname serves this site.\n\n**Ability:** `dns:write`",
                "tags": [
                    "DNS"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "zone",
                        "in": "path",
                        "required": true,
                        "description": "Cloudflare zone id (from List Cloudflare zones).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "hostname": {
                                        "type": "string",
                                        "description": "Hostname in the zone"
                                    }
                                },
                                "required": [
                                    "hostname"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/databases": {
            "get": {
                "operationId": "listDatabases",
                "summary": "List databases",
                "description": "**Ability:** `databases:read`",
                "tags": [
                    "Databases"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "createADatabase",
                "summary": "Create a database",
                "description": "Creates a MySQL database and a user with full access to it.\n\n**Ability:** `databases:write`",
                "tags": [
                    "Databases"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Letters, digits and underscores; 2–64 characters"
                                    },
                                    "user_name": {
                                        "type": "string",
                                        "description": "Database user name"
                                    },
                                    "password": {
                                        "type": "string",
                                        "description": "Password for the user"
                                    }
                                },
                                "required": [
                                    "name",
                                    "user_name",
                                    "password"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/databases/{database}": {
            "delete": {
                "operationId": "deleteADatabase",
                "summary": "Delete a database",
                "description": "Drops the database and its user. **This cannot be undone**: take a backup first.\n\n**Ability:** `databases:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Databases"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "database",
                        "in": "path",
                        "required": true,
                        "description": "Database id (from List databases).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backups": {
            "get": {
                "operationId": "listBackups",
                "summary": "List backups",
                "description": "All archives for the site, newest first: `restore_point` (14-day retention), `snapshot` (30 minutes) and `legacy`.\n\n**Ability:** `backups:read`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ArchiveList"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "takeABackup",
                "summary": "Take a backup",
                "description": "Starts a backup of the site's files and every database, and returns a **backup run** to poll.\n\n- `snapshot` (default): deleted 30 minutes after it finishes; at most 5 per site.\n- `restore_point`: kept for 14 days; at most 6 per site per day through the API.\n\nOnly one API backup per site runs at a time (`409` returns the running one).\n\n**Ability:** `backups:write`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "kind": {
                                        "type": "string",
                                        "enum": [
                                            "snapshot",
                                            "restore_point"
                                        ],
                                        "description": "Backup kind (default snapshot)"
                                    },
                                    "note": {
                                        "type": "string",
                                        "description": "Why you took it (max 200 characters)"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Accepted: started in the background",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BackupRun"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backup-runs": {
            "get": {
                "operationId": "listBackupRuns",
                "summary": "List backup runs",
                "description": "The last 20 backups started through the API, with their status.\n\n**Ability:** `backups:read`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BackupRunList"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backup-runs/{run}": {
            "get": {
                "operationId": "getABackupRun",
                "summary": "Get a backup run",
                "description": "Poll every few seconds until `status` is `completed` or `failed`. Most sites finish in one to five minutes.\n\n**Ability:** `backups:read`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "run",
                        "in": "path",
                        "required": true,
                        "description": "Backup run id (uuid).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/BackupRun"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backups/schedule": {
            "get": {
                "operationId": "getNightlyBackupStatus",
                "summary": "Get nightly backup status",
                "description": "Whether automatic nightly backups are on, and the last run's time and error.\n\n**Ability:** `backups:read`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "turnOnNightlyBackups",
                "summary": "Turn on nightly backups",
                "description": "Enables automatic nightly backups (files + every database, 14 kept) and takes the first one right away.\n\n**Ability:** `backups:write`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backups/contents": {
            "get": {
                "operationId": "listWhatIsInsideABackup",
                "summary": "List what is inside a backup",
                "description": "Files, databases and tables in an archive, for a selective restore.\n\n**Ability:** `backups:download`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "key",
                        "in": "query",
                        "required": true,
                        "description": "Archive key from List backups",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backups/download": {
            "get": {
                "operationId": "downloadABackup",
                "summary": "Download a backup",
                "description": "Redirects (302) to a download link valid for 15 minutes.\n\n**Ability:** `backups:download`",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "key",
                        "in": "query",
                        "required": true,
                        "description": "Archive key",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backups/restore": {
            "post": {
                "operationId": "restoreABackup",
                "summary": "Restore a backup",
                "description": "Restores files, databases or both from an archive. Files you name (or all) and tables you name (or all) are **overwritten**. Take a snapshot first if you may want to undo.\n\n**Ability:** `backups:restore`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "Archive key"
                                    },
                                    "mode": {
                                        "type": "string",
                                        "enum": [
                                            "files",
                                            "database",
                                            "both"
                                        ],
                                        "description": "What to restore"
                                    },
                                    "paths": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "File paths inside the archive (empty = all)"
                                    },
                                    "databases": {
                                        "type": "array",
                                        "items": {
                                            "type": "object"
                                        },
                                        "description": "Databases to restore: [{\"name\": \"wp_db\", \"tables\": []}] (empty tables = whole database)"
                                    },
                                    "tables": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        },
                                        "description": "Tables to restore (legacy database archives)"
                                    }
                                },
                                "required": [
                                    "key"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/backups/{backup}": {
            "delete": {
                "operationId": "turnOffABackupSchedule",
                "summary": "Turn off a backup schedule",
                "description": "Removes a nightly backup schedule (by its id from Get nightly backup status). Existing archives expire normally.\n\n**Ability:** `backups:restore`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Backups"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "backup",
                        "in": "path",
                        "required": true,
                        "description": "Backup schedule id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/push": {
            "get": {
                "operationId": "getPushStatus",
                "summary": "Get push status",
                "description": "`state` is `queued`, `running` (with `step`), `done` or `failed` (with `error`). `data` is null if this site has not pushed recently.\n\n**Ability:** `push:read`",
                "tags": [
                    "Push to live"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PushStatus"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "pushToAnotherSite",
                "summary": "Push to another site",
                "description": "Copies files and/or tables from this site onto `target_site_id`. Before overwriting, Kelma runs preflight checks, takes a safety snapshot of everything it will replace, and rolls the target back automatically if the push fails. `wp-config.php` is never pushed, and different table prefixes are converted.\n\n`files`: any of `.` (everything), `wp-content`, `wp-content/themes`, `wp-content/plugins`, `wp-content/uploads`.\n\n**Ability:** `push:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Push to live"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "target_site_id": {
                                        "type": "integer",
                                        "description": "Site to overwrite"
                                    },
                                    "files": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "enum": [
                                                ".",
                                                "wp-content",
                                                "wp-content/themes",
                                                "wp-content/plugins",
                                                "wp-content/uploads"
                                            ]
                                        },
                                        "description": "File scopes"
                                    },
                                    "database": {
                                        "type": "object",
                                        "description": "{\"all\": true} or {\"tables\": [\"wp_options\", …]}"
                                    },
                                    "confirm": {
                                        "type": "boolean",
                                        "description": "Must be true"
                                    }
                                },
                                "required": [
                                    "target_site_id",
                                    "confirm"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Accepted: started in the background",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PushStatus"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/push/tables": {
            "get": {
                "operationId": "listSourceTables",
                "summary": "List source tables",
                "description": "Database tables on the source site you can choose to push.\n\n**Ability:** `push:read`",
                "tags": [
                    "Push to live"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git": {
            "post": {
                "operationId": "connectARepository",
                "summary": "Connect a repository",
                "description": "**Ability:** `git:write`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "repository": {
                                        "type": "string",
                                        "description": "owner/repo or a git URL"
                                    },
                                    "branch": {
                                        "type": "string",
                                        "description": "Branch to deploy"
                                    }
                                },
                                "required": [
                                    "repository",
                                    "branch"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/branches": {
            "get": {
                "operationId": "listBranches",
                "summary": "List branches",
                "description": "**Ability:** `git:read`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "repository",
                        "in": "query",
                        "required": true,
                        "description": "owner/repo",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/key": {
            "post": {
                "operationId": "getTheDeployKey",
                "summary": "Get the deploy key",
                "description": "Returns (creating if needed) the SSH public key to add to a private repository as a read-only deploy key.\n\n**Ability:** `git:write`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/deploy": {
            "post": {
                "operationId": "deployNow",
                "summary": "Deploy now",
                "description": "Pulls the branch and runs the deploy script. Follow it with List deployments.\n\n**Ability:** `git:write`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/auto-deploy": {
            "patch": {
                "operationId": "turnPushToDeployOnOrOff",
                "summary": "Turn push-to-deploy on or off",
                "description": "**Ability:** `git:write`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enabled": {
                                        "type": "boolean",
                                        "description": "Deploy on every push to the branch"
                                    }
                                },
                                "required": [
                                    "enabled"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/deployments": {
            "get": {
                "operationId": "listDeployments",
                "summary": "List deployments",
                "description": "**Ability:** `git:read`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/deployments/{deployment}": {
            "get": {
                "operationId": "getADeployment",
                "summary": "Get a deployment",
                "description": "**Ability:** `git:read`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "deployment",
                        "in": "path",
                        "required": true,
                        "description": "Deployment id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/deployments/{deployment}/log": {
            "get": {
                "operationId": "getADeploymentLog",
                "summary": "Get a deployment log",
                "description": "**Ability:** `git:read`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "deployment",
                        "in": "path",
                        "required": true,
                        "description": "Deployment id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/script": {
            "get": {
                "operationId": "getTheDeployScript",
                "summary": "Get the deploy script",
                "description": "**Ability:** `git:read`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "operationId": "updateTheDeployScript",
                "summary": "Update the deploy script",
                "description": "**Ability:** `git:write`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "script": {
                                        "type": "string",
                                        "description": "Bash script run after each pull (max 20,000 characters)"
                                    }
                                },
                                "required": [
                                    "script"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/webhook": {
            "get": {
                "operationId": "getTheDeployWebhook",
                "summary": "Get the deploy webhook",
                "description": "The URL and secret to add as a GitHub webhook for push-to-deploy.\n\n**Ability:** `git:write`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/git/webhook/rotate": {
            "post": {
                "operationId": "rotateTheWebhookSecret",
                "summary": "Rotate the webhook secret",
                "description": "**Ability:** `git:write`",
                "tags": [
                    "Git"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/cache/purge": {
            "post": {
                "operationId": "purgeAllCaches",
                "summary": "Purge all caches",
                "description": "Purges the Cloudflare edge cache for every hostname of the site and resets PHP OPcache. Run it after deploying changes.\n\n**Ability:** `cache:purge`",
                "tags": [
                    "Cache & performance"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PurgeResult"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/cache/fastcgi/flush": {
            "post": {
                "operationId": "flushTheNginxFastcgiCache",
                "summary": "Flush the Nginx FastCGI cache",
                "description": "**Ability:** `cache:purge`",
                "tags": [
                    "Cache & performance"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/cache/opcache/reset": {
            "post": {
                "operationId": "resetPhpOpcache",
                "summary": "Reset PHP OPcache",
                "description": "Kelma servers cache compiled PHP and do not re-read changed files on their own. Reset after editing PHP files outside WordPress's updater (SFTP, git, agents).\n\n**Ability:** `cache:purge`",
                "tags": [
                    "Cache & performance"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/security": {
            "get": {
                "operationId": "getSecuritySettings",
                "summary": "Get security settings",
                "description": "The switches you can change with `PATCH`, plus live Intelligent Bot Fight state:\n\n- `bot_fight_actors`: how many sources (IP addresses or networks) Bot Fight is challenging on this site right now. Everyone else is unaffected.\n- `bot_fight_active`: `true` while the whole site is challenged because a distributed attack continued after those sources were challenged. It clears once traffic is back to normal.\n- `staging_private` (staging sites only, `null` for live sites): whether visitors must log in to WordPress to see the site.\n- `staging_custom_guard` (staging sites only): `true` when a custom guard set up by Kelma support keeps the site private. `staging_private` is then always `true` and can't be changed.\n\n**Ability:** `security:read`",
                "tags": [
                    "Security"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "operationId": "updateSecuritySettings",
                "summary": "Update security settings",
                "description": "Send only the fields you want to change. `dev_mode: true` bypasses all caches for 30 minutes.\n\n**Ability:** `security:write`",
                "tags": [
                    "Security"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "managed_challenge": {
                                        "type": "boolean",
                                        "description": "Cloudflare managed challenge for every visitor of the site"
                                    },
                                    "bot_fight": {
                                        "type": "boolean",
                                        "description": "Intelligent Bot Fight: automatically challenge only the IP addresses and networks behind a burst of bot traffic; the whole site is challenged only if a distributed attack continues after that. Turning it off clears its challenges"
                                    },
                                    "xmlrpc_protected": {
                                        "type": "boolean",
                                        "description": "Block xmlrpc.php"
                                    },
                                    "dev_mode": {
                                        "type": "boolean",
                                        "description": "Development mode (30 minutes, no caching)"
                                    },
                                    "security_headers": {
                                        "type": "boolean",
                                        "description": "Add HSTS and other security headers"
                                    },
                                    "remove_powered_by": {
                                        "type": "boolean",
                                        "description": "Hide X-Powered-By"
                                    },
                                    "cors_all": {
                                        "type": "boolean",
                                        "description": "Allow cross-origin requests from any site"
                                    },
                                    "min_tls": {
                                        "type": "string",
                                        "enum": [
                                            "1.0",
                                            "1.1",
                                            "1.2",
                                            "1.3"
                                        ],
                                        "description": "Minimum TLS version"
                                    },
                                    "full_page_cache": {
                                        "type": "boolean",
                                        "description": "Cloudflare full-page caching"
                                    },
                                    "fastcgi_cache": {
                                        "type": "boolean",
                                        "description": "Nginx FastCGI page cache"
                                    },
                                    "staging_private": {
                                        "type": "boolean",
                                        "description": "Staging sites only: require a WordPress login to view the site and keep search engines out. Turning it on also turns off full_page_cache. Refused (422) when `staging_custom_guard` is true"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/cronjobs": {
            "get": {
                "operationId": "listCronJobsAndAutomations",
                "summary": "List cron jobs and automations",
                "description": "**Ability:** `cron:read`",
                "tags": [
                    "Cron jobs"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "createACronJob",
                "summary": "Create a cron job",
                "description": "**Ability:** `cron:write`",
                "tags": [
                    "Cron jobs"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "command": {
                                        "type": "string",
                                        "description": "Command to run as the site user"
                                    },
                                    "frequency": {
                                        "type": "string",
                                        "description": "Cron expression, e.g. */5 * * * *"
                                    }
                                },
                                "required": [
                                    "command",
                                    "frequency"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/cronjobs/automations/{automation}": {
            "post": {
                "operationId": "toggleABuiltInAutomation",
                "summary": "Toggle a built-in automation",
                "description": "For example the real system cron that replaces WP-Cron.\n\n**Ability:** `cron:write`",
                "tags": [
                    "Cron jobs"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "automation",
                        "in": "path",
                        "required": true,
                        "description": "Automation key (from List cron jobs).",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/cronjobs/{cronjob}": {
            "delete": {
                "operationId": "deleteACronJob",
                "summary": "Delete a cron job",
                "description": "**Ability:** `cron:write`",
                "tags": [
                    "Cron jobs"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "cronjob",
                        "in": "path",
                        "required": true,
                        "description": "Cron job id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/redirects": {
            "get": {
                "operationId": "listRedirects",
                "summary": "List redirects",
                "description": "**Ability:** `redirects:read`",
                "tags": [
                    "Redirects"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "createARedirect",
                "summary": "Create a redirect",
                "description": "**Ability:** `redirects:write`",
                "tags": [
                    "Redirects"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "redirect_from": {
                                        "type": "string",
                                        "description": "Path, starting with /"
                                    },
                                    "redirect_to": {
                                        "type": "string",
                                        "description": "Full https:// URL"
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "redirect",
                                            "permanent"
                                        ],
                                        "description": "redirect = 302, permanent = 301"
                                    }
                                },
                                "required": [
                                    "redirect_from",
                                    "redirect_to",
                                    "type"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "operationId": "deleteAllRedirects",
                "summary": "Delete all redirects",
                "description": "**Ability:** `redirects:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Redirects"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/redirects/export": {
            "get": {
                "operationId": "exportRedirectsAsCsv",
                "summary": "Export redirects as CSV",
                "description": "**Ability:** `redirects:read`",
                "tags": [
                    "Redirects"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/redirects/import": {
            "post": {
                "operationId": "importRedirectsFromCsv",
                "summary": "Import redirects from CSV",
                "description": "Send as `multipart/form-data` with a `file` field (CSV: from,to,type; max 512 KB).\n\n**Ability:** `redirects:write`",
                "tags": [
                    "Redirects"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "CSV file"
                                    }
                                },
                                "required": [
                                    "file"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/redirects/{redirect}": {
            "delete": {
                "operationId": "deleteARedirect",
                "summary": "Delete a redirect",
                "description": "**Ability:** `redirects:write`",
                "tags": [
                    "Redirects"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "redirect",
                        "in": "path",
                        "required": true,
                        "description": "Redirect id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/monitoring": {
            "get": {
                "operationId": "getServerHealth",
                "summary": "Get server health",
                "description": "Live CPU, memory and disk for the site's server, plus uptime.\n\n**Ability:** `monitoring:read`",
                "tags": [
                    "Monitoring & reports"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/monitoring/reports": {
            "post": {
                "operationId": "setEmailReports",
                "summary": "Set email reports",
                "description": "**Ability:** `monitoring:write`",
                "tags": [
                    "Monitoring & reports"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "enabled": {
                                        "type": "boolean",
                                        "description": "Send reports"
                                    },
                                    "frequency": {
                                        "type": "string",
                                        "enum": [
                                            "daily",
                                            "weekly"
                                        ],
                                        "description": "How often"
                                    }
                                },
                                "required": [
                                    "enabled",
                                    "frequency"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/reports": {
            "get": {
                "operationId": "getTrafficAnalytics",
                "summary": "Get traffic analytics",
                "description": "Traffic, cache, response-time and firewall trends, top pages, countries and status codes from the Cloudflare edge.\n\n**Ability:** `monitoring:read`",
                "tags": [
                    "Monitoring & reports"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "range",
                        "in": "query",
                        "required": false,
                        "description": "Time range, e.g. 24h, 7d, 30d",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "fresh",
                        "in": "query",
                        "required": false,
                        "description": "Skip the short-lived cache",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/logs": {
            "get": {
                "operationId": "getTrafficAndSecurityLogs",
                "summary": "Get traffic and security logs",
                "description": "**Ability:** `monitoring:read`",
                "tags": [
                    "Monitoring & reports"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Log type, e.g. traffic or security",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "range",
                        "in": "query",
                        "required": false,
                        "description": "Time range",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/collaborators": {
            "get": {
                "operationId": "listCollaboratorsAndInvitations",
                "summary": "List collaborators and invitations",
                "description": "**Ability:** `collaborators:read`",
                "tags": [
                    "Collaborators"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Data"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "operationId": "inviteACollaborator",
                "summary": "Invite a collaborator",
                "description": "Emails an invitation. Collaborators can manage the site, but cannot delete it, uninstall its application, delete databases, restore backups, push onto it or manage collaborators. Only the owner can call this.\n\n**Ability:** `collaborators:write`",
                "tags": [
                    "Collaborators"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "description": "Their email address"
                                    }
                                },
                                "required": [
                                    "email"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/collaborators/invitations/{invitation}": {
            "delete": {
                "operationId": "revokeAnInvitation",
                "summary": "Revoke an invitation",
                "description": "**Ability:** `collaborators:write`",
                "tags": [
                    "Collaborators"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "invitation",
                        "in": "path",
                        "required": true,
                        "description": "Invitation id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/collaborators/{collaborator}": {
            "delete": {
                "operationId": "removeACollaborator",
                "summary": "Remove a collaborator",
                "description": "**Ability:** `collaborators:write`",
                "tags": [
                    "Collaborators"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "collaborator",
                        "in": "path",
                        "required": true,
                        "description": "Collaborator user id.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/terminal": {
            "post": {
                "operationId": "runACommand",
                "summary": "Run a command",
                "description": "Runs one non-interactive shell or WP-CLI command as the site user and returns its output (time limit about 25 seconds). The same command policy as the panel terminal applies.\n\n**Ability:** `terminal:run`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Terminal"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "command": {
                                        "type": "string",
                                        "description": "e.g. wp plugin list"
                                    },
                                    "cwd": {
                                        "type": "string",
                                        "description": "Working directory (defaults to the web root)"
                                    }
                                },
                                "required": [
                                    "command"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/credentials/sftp": {
            "post": {
                "operationId": "revealTheSftpSshPassword",
                "summary": "Reveal the SFTP/SSH password",
                "description": "Your Kelma account password is required, as in the panel.\n\n**Ability:** `credentials:read`",
                "tags": [
                    "Credentials"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "password": {
                                        "type": "string",
                                        "description": "Your Kelma account password"
                                    }
                                },
                                "required": [
                                    "password"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/credentials/sftp/reset": {
            "post": {
                "operationId": "resetTheSftpSshPassword",
                "summary": "Reset the SFTP/SSH password",
                "description": "Sets a new SFTP/SSH password for the site user. Anything logged in with the old one keeps its session; new logins need the new password.\n\n**Ability:** `credentials:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Credentials"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "password": {
                                        "type": "string",
                                        "description": "New password"
                                    }
                                },
                                "required": [
                                    "password"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/databases/{database}/password": {
            "post": {
                "operationId": "revealADatabasePassword",
                "summary": "Reveal a database password",
                "description": "**Ability:** `credentials:read`",
                "tags": [
                    "Credentials"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "database",
                        "in": "path",
                        "required": true,
                        "description": "Database id (from List databases).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/v1/sites/{site}/databases/{database}/reset-password": {
            "post": {
                "operationId": "resetADatabasePassword",
                "summary": "Reset a database password",
                "description": "Sets a new password for the database user and updates `wp-config.php` for WordPress sites.\n\n**Ability:** `credentials:write`\n\n> ⚠️ **Destructive.** This changes or removes data on the live site.",
                "tags": [
                    "Credentials"
                ],
                "parameters": [
                    {
                        "name": "site",
                        "in": "path",
                        "required": true,
                        "description": "Site id (from List sites).",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "database",
                        "in": "path",
                        "required": true,
                        "description": "Database id (from List databases).",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Done (or started in the background)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "400": {
                        "$ref": "#/components/responses/Error"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "403": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "kelma_…",
                "description": "Create a token in the Kelma Panel under **Profile → API tokens**."
            }
        },
        "responses": {
            "Error": {
                "description": "Error",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "ValidationError": {
                "description": "Invalid input",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ValidationError"
                        }
                    }
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string",
                                "examples": [
                                    "forbidden"
                                ]
                            },
                            "message": {
                                "type": "string",
                                "examples": [
                                    "This token lacks the 'backups:write' ability."
                                ]
                            }
                        }
                    }
                }
            },
            "ValidationError": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "examples": [
                            {
                                "domain": [
                                    "The domain field is required."
                                ]
                            }
                        ]
                    }
                }
            },
            "Data": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "description": "The same data the Kelma Panel shows for this screen."
                    }
                }
            },
            "Message": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string",
                        "examples": [
                            "Your website is being created"
                        ]
                    }
                }
            },
            "Me": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "user": {
                                "type": "object",
                                "properties": {
                                    "id": {
                                        "type": "integer"
                                    },
                                    "name": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string"
                                    }
                                }
                            },
                            "token": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string"
                                    },
                                    "abilities": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "site_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    },
                                    "expires_at": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "format": "date-time"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "Site": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "examples": [
                            42
                        ]
                    },
                    "domain": {
                        "type": "string",
                        "examples": [
                            "example.com"
                        ]
                    },
                    "aliases": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "status": {
                        "type": "string",
                        "examples": [
                            "active"
                        ]
                    },
                    "type": {
                        "type": "string",
                        "examples": [
                            "wordpress"
                        ]
                    },
                    "php_version": {
                        "type": "string",
                        "examples": [
                            "8.4"
                        ]
                    },
                    "is_staging": {
                        "type": "boolean"
                    },
                    "staging_of_site_id": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "For a staging site: the live site it belongs to (null if not linked)."
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "panel_url": {
                        "type": "string"
                    }
                }
            },
            "SiteList": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Site"
                        }
                    }
                }
            },
            "SiteDetail": {
                "type": "object",
                "properties": {
                    "data": {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/Site"
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "server": {
                                        "type": "object",
                                        "properties": {
                                            "name": {
                                                "type": "string"
                                            },
                                            "ip": {
                                                "type": "string"
                                            },
                                            "ssh_port": {
                                                "type": "integer"
                                            }
                                        }
                                    },
                                    "ssh": {
                                        "type": "object",
                                        "properties": {
                                            "user": {
                                                "type": "string"
                                            },
                                            "command": {
                                                "type": "string",
                                                "examples": [
                                                    "ssh example-42@203.0.113.10"
                                                ]
                                            }
                                        }
                                    },
                                    "web_root": {
                                        "type": "string",
                                        "examples": [
                                            "/home/example-42/example.com/public"
                                        ]
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            "PurgeResult": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "cloudflare": {
                                "type": "object",
                                "properties": {
                                    "purged": {
                                        "type": "boolean"
                                    },
                                    "hostnames": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "error": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                }
                            },
                            "opcache": {
                                "type": "object",
                                "properties": {
                                    "reset": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "Archive": {
                "type": "object",
                "properties": {
                    "key": {
                        "type": "string",
                        "examples": [
                            "backups/examplecom-full-2026-11-26-021500.zip"
                        ]
                    },
                    "name": {
                        "type": "string"
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "restore_point",
                            "snapshot",
                            "legacy"
                        ]
                    },
                    "bytes": {
                        "type": "integer"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "ArchiveList": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Archive"
                        }
                    }
                }
            },
            "BackupRunObject": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "site_id": {
                        "type": "integer"
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "snapshot",
                            "restore_point"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "queued",
                            "running",
                            "completed",
                            "failed"
                        ]
                    },
                    "archive": {
                        "type": "string"
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "error": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "warning": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Set when a database could not be included."
                    },
                    "expires_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time",
                        "description": "Snapshots only: when the archive is deleted."
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "started_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "finished_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "BackupRun": {
                "type": "object",
                "properties": {
                    "data": {
                        "$ref": "#/components/schemas/BackupRunObject"
                    }
                }
            },
            "BackupRunList": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/BackupRunObject"
                        }
                    }
                }
            },
            "PushStatus": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "properties": {
                            "source_site_id": {
                                "type": "integer"
                            },
                            "target": {
                                "type": "string"
                            },
                            "state": {
                                "type": "string",
                                "enum": [
                                    "queued",
                                    "running",
                                    "done",
                                    "failed"
                                ]
                            },
                            "step": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "error": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "snapshots": {
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "notes": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "started_at": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            },
                            "updated_at": {
                                "type": [
                                    "string",
                                    "null"
                                ],
                                "format": "date-time"
                            }
                        }
                    }
                }
            }
        }
    }
}