{
    "openapi": "3.1.0",
    "info": {
        "title": "sona.to API",
        "version": "1.0.0",
        "description": "Read and manage your sona.to account from your own scripts and tools.\n\nEvery request needs a bearer token. Create one under API in your dashboard.\nA token belongs to one team and can only ever reach that team's data.\n\n## Connect an AI assistant (MCP)\n\nsona.to runs a Model Context Protocol server at `https://mcp.sona.to/mcp`.\nIt exposes the same account, channels, posts, analytics and SEO actions as\ntools an AI client can call, scoped to your team. Any MCP-compatible client\ncan connect, including Claude, ChatGPT, Cursor and others.\n\n**Clients that support OAuth (Claude, ChatGPT and others).** Add a custom\nconnector with the URL above. You sign in with sona.to and approve access.\nNo token to paste.\n\n**Clients that use a header (Claude Code, Cursor, Windsurf and others).**\nCreate a token in the dashboard and pass it as a bearer header, for example:\n`claude mcp add sona --transport http --header \"Authorization: Bearer <token>\" https://mcp.sona.to/mcp`\n\nWrite actions (creating posts, uploads, running SEO audits and AI Visibility checks) require a token\nor connection granted the write scope. Read access is always available.\n\n## Uploading a file\n\nTo attach an image or video that is already at a public URL, pass that URL\nstraight to the create-post action. To upload a file the client holds\nlocally, use the two upload tools. Call the create-upload tool with the\nfilename and size to get a short-lived URL, PUT the raw bytes to that URL,\nthen call the finalize tool with the returned reference. Finalize stores\nthe file against your team and returns its public URL, which the create-post\naction then accepts. The bytes go straight to storage and never pass through\nthe tool call.\n\n## Webhooks\n\nInstead of polling, have sona.to call you when something happens. Point a\nwebhook at Zapier, Make, n8n or your own server and choose which events it\nreceives.\n\nThe destination must use `https` on port 443 and resolve to a public\naddress. Redirects are not followed, so give the final URL.\n\n**Verifying a delivery.** Every request carries a `Sona-Signature` header:\n\n`Sona-Signature: t=1785935116,v1=d3d9c2c387bf7556...`\n\n`t` is the unix time the request was signed and `v1` is an HMAC SHA-256 of\nthe timestamp, a full stop, then the raw request body, keyed with the\nsigning secret shown when you created the webhook. Recompute it and compare\nwith a constant-time function. Reject anything whose timestamp is more than\na few minutes old, which is what stops a captured request being replayed.\n\n```php\n$raw = file_get_contents('php://input');\npreg_match('/t=(\\d+),v1=([a-f0-9]{64})/', $_SERVER['HTTP_SONA_SIGNATURE'], $m);\n[, $ts, $sig] = $m;\n\nif (abs(time() - (int) $ts) > 300) { http_response_code(400); exit; }\n\n$expected = hash_hmac('sha256', $ts . '.' . $raw, $secret);\nif (!hash_equals($expected, $sig)) { http_response_code(401); exit; }\n```\n\n**Retries.** Any response outside 2xx, or no response within ten seconds, is\na failure. A failed delivery is retried after 60 seconds, then 5 minutes,\nthen 30 minutes, and abandoned after that. Reply 2xx as soon as you have the\npayload and do your work afterwards.\n\nEach delivery carries a `Sona-Delivery` id that stays the same across\nretries of the same event, so you can ignore duplicates.\n\nAn endpoint that fails repeatedly is disabled automatically. Re-enable it\nfrom the dashboard or by sending `status: true` to the update endpoint.\n\n## AI Visibility\n\nAI Visibility asks AI assistants the questions your customers ask and\nrecords whether they name your brand, at which position and which sites\nthey cite. Add prompts, start a run, then read the overview, prompts,\nsources and actions. A run uses AI credits for each answer received;\nscheduled runs use fewer credits per answer than runs started now.\n\nWebhook events follow each run. `seo.ai_visibility.completed` carries the\nproject, the run and its metrics. `seo.ai_visibility.failed` is sent when no\nassistant returned an answer. `seo.ai_visibility.mention_gained` and\n`seo.ai_visibility.mention_lost` list, in `mentions`, the prompt and\nassistant pairs whose result changed since that pair was last asked, at\nmost 100 per event with the full count in `total`.\n",
        "contact": {
            "url": "https://sona.to/contact"
        }
    },
    "servers": [
        {
            "url": "https://api.sona.to/v1"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "Account"
        },
        {
            "name": "Channels"
        },
        {
            "name": "Posts"
        },
        {
            "name": "Analytics"
        },
        {
            "name": "Files"
        },
        {
            "name": "SEO"
        },
        {
            "name": "Webhooks"
        }
    ],
    "paths": {
        "/me": {
            "get": {
                "operationId": "getAccount",
                "tags": [
                    "Account"
                ],
                "summary": "Account, plan and limits",
                "description": "Returns the account the token belongs to, its plan limits and the token's scopes.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Me"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "user": {
                                            "id": 1,
                                            "name": "Alex Doe",
                                            "email": "you@example.com"
                                        },
                                        "plan": {
                                            "id": 5,
                                            "name": "Agency",
                                            "interval": "monthly",
                                            "expires_at": "2027-01-01T00:00:00+00:00"
                                        },
                                        "limits": {
                                            "requests_per_minute": 60,
                                            "requests_per_month": 50000,
                                            "max_tokens": 3
                                        },
                                        "scopes": {
                                            "read": true,
                                            "write": true
                                        },
                                        "token": {
                                            "name": "My integration",
                                            "prefix": "sona_abc12345"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/accounts": {
            "get": {
                "operationId": "listChannels",
                "tags": [
                    "Channels"
                ],
                "summary": "List connected channels",
                "description": "Connected social accounts this team can publish to. Disconnected channels are omitted.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Offset"
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "description": "Match on channel name or handle. Case insensitive, matches anywhere in\nthe value. Maximum 200 characters.\n",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Account"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": "acc_example01",
                                            "network": "telegram",
                                            "name": "Your Channel",
                                            "username": "yourchannel",
                                            "avatar": null,
                                            "url": "https://t.me/yourchannel",
                                            "can_post": true
                                        }
                                    ],
                                    "meta": {
                                        "total": 4,
                                        "limit": 50,
                                        "offset": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/posts": {
            "get": {
                "operationId": "listPosts",
                "tags": [
                    "Posts"
                ],
                "summary": "List posts",
                "description": "Posts newest first by scheduled time.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Offset"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Filter by state. `scheduled` and `processing` are the same underlying\nstate split on the due time: a post is scheduled until its time\narrives, then processing until the publisher reports back.\n",
                        "schema": {
                            "$ref": "#/components/schemas/PostStatus"
                        }
                    },
                    {
                        "name": "account",
                        "in": "query",
                        "description": "Only posts for this channel id.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "description": "Match on the post caption. Case insensitive, matches anywhere in the\ncaption. Maximum 200 characters.\n",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Post"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": "pst_example01",
                                            "status": "scheduled",
                                            "network": "telegram",
                                            "type": "text",
                                            "caption": "Doors open at nine tomorrow.",
                                            "link": null,
                                            "media": [],
                                            "account": {
                                                "id": "acc_example01",
                                                "name": "Your Channel"
                                            },
                                            "scheduled_at": "2026-08-01T09:00:00+07:00",
                                            "created_at": "2026-07-20T12:00:00+07:00",
                                            "published_url": null
                                        }
                                    ],
                                    "meta": {
                                        "total": 128,
                                        "limit": 50,
                                        "offset": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            },
            "post": {
                "operationId": "createPost",
                "tags": [
                    "Posts"
                ],
                "summary": "Publish or schedule a post",
                "description": "Creates one post per channel. Without `scheduled_at` the post goes out\nimmediately and the response carries the result. With `scheduled_at` the\npost is queued and published at that time.\n\nEither every channel accepts the post or none of them do. If any channel\nfails validation the whole request is rejected, so a partial publish can\nnever happen without you knowing.\n\nRequires the `write` scope.\n",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PostCreate"
                            },
                            "examples": {
                                "now": {
                                    "summary": "Publish immediately",
                                    "value": {
                                        "accounts": [
                                            "acc_aaa111"
                                        ],
                                        "caption": "Doors open at nine tomorrow."
                                    }
                                },
                                "scheduled": {
                                    "summary": "Schedule for later",
                                    "value": {
                                        "accounts": [
                                            "acc_aaa111",
                                            "acc_bbb222"
                                        ],
                                        "caption": "Doors open at nine tomorrow.",
                                        "scheduled_at": "2026-08-01T09:00:00+07:00"
                                    }
                                },
                                "withMedia": {
                                    "summary": "With images",
                                    "value": {
                                        "accounts": [
                                            "acc_aaa111"
                                        ],
                                        "caption": "This week's specials.",
                                        "media": [
                                            "https://files.sona.to/files/example.jpg"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created. One entry per channel.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Post"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/posts/{id}": {
            "parameters": [
                {
                    "name": "id",
                    "in": "path",
                    "required": true,
                    "schema": {
                        "type": "string"
                    }
                }
            ],
            "get": {
                "operationId": "getPost",
                "tags": [
                    "Posts"
                ],
                "summary": "Get one post",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Post"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "pst_example01",
                                        "status": "published",
                                        "network": "telegram",
                                        "type": "media",
                                        "caption": "This week's specials.",
                                        "link": null,
                                        "media": [
                                            "https://files.sona.to/uploads/photo_example.jpg"
                                        ],
                                        "account": {
                                            "id": "acc_example01",
                                            "name": "Your Channel"
                                        },
                                        "scheduled_at": "2026-07-18T09:00:00+07:00",
                                        "created_at": "2026-07-18T08:59:12+07:00",
                                        "published_url": "https://t.me/yourchannel/42"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            },
            "patch": {
                "operationId": "updatePost",
                "tags": [
                    "Posts"
                ],
                "summary": "Edit a scheduled post",
                "description": "Only a post still waiting to go out can be changed. A published post, a\nfailed one, or one already being sent returns 409.\n\nOnly the fields you send are touched, so changing the time leaves the\ncaption alone.\n\nRequires the `write` scope.\n",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/PostUpdate"
                            },
                            "examples": {
                                "retime": {
                                    "summary": "Move it later",
                                    "value": {
                                        "scheduled_at": "2026-08-02T09:00:00+07:00"
                                    }
                                },
                                "recaption": {
                                    "summary": "Fix a typo",
                                    "value": {
                                        "caption": "Doors open at nine tomorrow."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Post"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "pst_example01",
                                        "status": "scheduled",
                                        "network": "telegram",
                                        "type": "text",
                                        "caption": "Doors open at nine tomorrow.",
                                        "link": null,
                                        "media": [],
                                        "account": {
                                            "id": "acc_example01",
                                            "name": "Your Channel"
                                        },
                                        "scheduled_at": "2026-08-02T09:00:00+07:00",
                                        "created_at": "2026-07-20T12:00:00+07:00",
                                        "published_url": null
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            },
            "delete": {
                "operationId": "cancelPost",
                "tags": [
                    "Posts"
                ],
                "summary": "Cancel a scheduled post",
                "description": "Removes a post that has not gone out. A published post returns 409,\nsince deleting the record would not recall the message.\n\nRequires the `write` scope.\n",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "deleted": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/analytics/{account}": {
            "get": {
                "operationId": "getChannelAnalytics",
                "tags": [
                    "Analytics"
                ],
                "summary": "Metrics for one channel",
                "description": "Daily metrics for a connected channel over a date range, read from\nstored data. Values are refreshed on a schedule, so this never triggers\na live fetch from the network.\n\nEach metric carries its full daily `series`, plus `latest` and `sum`.\nThe `aggregation` field says which of the two is the meaningful total:\n`latest` for a running count like followers, `sum` for per-day activity\nlike impressions. Where the right choice is genuinely ambiguous,\n`aggregation` and `total` are null and both `latest` and `sum` are still\ngiven, so you decide.\n",
                "parameters": [
                    {
                        "name": "account",
                        "in": "path",
                        "required": true,
                        "description": "A channel id from /accounts.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "description": "Start date, YYYY-MM-DD. Defaults to 30 days ago.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "until",
                        "in": "query",
                        "description": "End date, YYYY-MM-DD. Defaults to today.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Analytics"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "account": {
                                            "id": "acc_XXXXXXXXXX",
                                            "network": "telegram",
                                            "name": "Your Channel",
                                            "avatar": null,
                                            "url": null
                                        },
                                        "range": {
                                            "since": "2026-06-01",
                                            "until": "2026-06-30"
                                        },
                                        "metrics": [
                                            {
                                                "key": "member_count",
                                                "aggregation": "latest",
                                                "latest": 1200,
                                                "sum": 8400,
                                                "total": 1200,
                                                "series": [
                                                    {
                                                        "date": "2026-06-29",
                                                        "value": 1198
                                                    },
                                                    {
                                                        "date": "2026-06-30",
                                                        "value": 1200
                                                    }
                                                ]
                                            },
                                            {
                                                "key": "page_impressions",
                                                "aggregation": "sum",
                                                "latest": 12,
                                                "sum": 340,
                                                "total": 340,
                                                "series": [
                                                    {
                                                        "date": "2026-06-29",
                                                        "value": 18
                                                    },
                                                    {
                                                        "date": "2026-06-30",
                                                        "value": 12
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/files": {
            "post": {
                "operationId": "uploadFile",
                "tags": [
                    "Files"
                ],
                "x-curl": "curl -X POST https://api.sona.to/v1/files \\\\\n  -H \"Authorization: Bearer sona_your_token\" \\\\\n  -F \"files[]=@photo.jpg\"\n",
                "summary": "Upload media",
                "description": "Upload one or more files and get back a url for each. Pass those urls in\nthe `media` array of a post to publish them.\n\nSend the files as multipart form data under the repeated field `files[]`.\nUploads count against your plan's storage and appear in your Files, the\nsame as a file added from the dashboard.\n\nThis endpoint accepts files up to 100 MB. Anything larger is rejected\nbefore it reaches us, with an error that does not come from this API. Use\n`POST /files/presign` for bigger files.\n\nAllowed types and the per-file size limit also come from your plan, and\nmay be lower than 100 MB. A file of a disallowed type, one over your\nplan's limit, or one that would take you past your storage allowance is\nrejected with a message saying which.\n\nRequires the `write` scope.\n",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "files": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "binary"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Uploaded. One entry per file.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Upload"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": "file_XXXXXXXXXX",
                                            "url": "https://files.sona.to/uploads/photo_example.jpg",
                                            "name": "photo_example.jpg",
                                            "type": "image/jpeg",
                                            "extension": "jpg",
                                            "size": 82931,
                                            "is_image": true,
                                            "width": 1280,
                                            "height": 720
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/files/presign": {
            "post": {
                "operationId": "createUpload",
                "tags": [
                    "Files"
                ],
                "x-curl": "curl -X POST https://api.sona.to/v1/files/presign \\\\\n  -H \"Authorization: Bearer sona_your_token\" \\\\\n  -H \"Content-Type: application/json\" \\\\\n  -d '{\"filename\":\"clip.mp4\",\"size_bytes\":734003200,\"content_type\":\"video/mp4\"}'\n",
                "summary": "Start a large upload",
                "description": "Step one of a two step upload, for files over the 100 MB limit on\n`POST /files`. Returns a short lived url to send the raw bytes to with a\nPUT, and an `upload_ref` to pass to the finalize step.\n\nSend the bytes with a single PUT to `upload_url`, including any headers\nreturned in `headers`. They go straight to storage rather than through\nthis API, so the 100 MB limit does not apply. The ceiling here is your\nplan's per-file limit, returned as `max_bytes`.\n\nThe url expires after `expires_in` seconds, which scales with the size\nyou declare: 15 minutes plus a minute per 10 MB, up to an hour. An\nexpired url returns 403 from storage, not from this API. Nothing is\nrecorded in your Files until you call finalize.\nRequires the `write` scope.\n",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "filename",
                                    "size_bytes"
                                ],
                                "properties": {
                                    "filename": {
                                        "type": "string",
                                        "description": "Name to store the file under.",
                                        "example": "clip.mp4"
                                    },
                                    "size_bytes": {
                                        "type": "integer",
                                        "description": "Size of the file in bytes. Must be positive.",
                                        "example": 734003200
                                    },
                                    "content_type": {
                                        "type": "string",
                                        "description": "MIME type of the file.",
                                        "example": "video/mp4"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Upload authorised.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "upload_url": {
                                                    "type": "string",
                                                    "description": "Send the raw bytes here with a PUT."
                                                },
                                                "headers": {
                                                    "type": "object",
                                                    "additionalProperties": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "description": "Headers to include on the PUT."
                                                },
                                                "method": {
                                                    "type": "string",
                                                    "example": "PUT"
                                                },
                                                "upload_ref": {
                                                    "type": "string",
                                                    "description": "Pass this to the finalize step."
                                                },
                                                "expires_in": {
                                                    "type": "integer",
                                                    "description": "Seconds until the upload url expires."
                                                },
                                                "max_bytes": {
                                                    "type": "integer",
                                                    "description": "Largest file this token may upload."
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "upload_url": "https://example.r2.cloudflarestorage.com/sona-storage/uploads/clip_example.mp4?X-Amz-Signature=example01",
                                        "headers": {
                                            "Host": [
                                                "example.r2.cloudflarestorage.com"
                                            ]
                                        },
                                        "method": "PUT",
                                        "upload_ref": "example01",
                                        "expires_in": 960,
                                        "max_bytes": 4294967296
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/files/finalize": {
            "post": {
                "operationId": "finalizeUpload",
                "tags": [
                    "Files"
                ],
                "x-curl": "curl -X POST https://api.sona.to/v1/files/finalize \\\\\n  -H \"Authorization: Bearer sona_your_token\" \\\\\n  -H \"Content-Type: application/json\" \\\\\n  -d '{\"upload_ref\":\"example01\"}'\n",
                "summary": "Finish a large upload",
                "description": "Step two of a two step upload. Call this after the PUT has completed.\nChecks the file landed, measures its real size and type against your\nplan, and records it in your Files.\nReturns the same shape as `POST /files`, so the `url` can go straight\ninto the `media` array of a post.\nRequires the `write` scope.\n",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "upload_ref"
                                ],
                                "properties": {
                                    "upload_ref": {
                                        "type": "string",
                                        "description": "The value returned by the presign step.",
                                        "example": "example01"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Recorded.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Upload"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "file_XXXXXXXXXX",
                                        "url": "https://files.sona.to/uploads/clip_example.mp4",
                                        "name": "clip_example.mp4",
                                        "type": "video/mp4",
                                        "extension": "mp4",
                                        "size": 734003200,
                                        "is_image": false,
                                        "width": 0,
                                        "height": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/seo/projects": {
            "get": {
                "operationId": "listSeoProjects",
                "tags": [
                    "SEO"
                ],
                "summary": "List SEO projects",
                "description": "Sites you are auditing. Needs the SEO product on your plan, on top of API\naccess.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Offset"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SeoProject"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": "seo_example01",
                                            "domain": "example.com",
                                            "audit_status": "done",
                                            "last_crawled_at": "2026-07-20T07:00:00+00:00",
                                            "open_issues": 12,
                                            "created_at": "2026-07-01T09:00:00+00:00"
                                        }
                                    ],
                                    "meta": {
                                        "total": 1,
                                        "limit": 50,
                                        "offset": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            },
            "post": {
                "operationId": "createSeoProject",
                "tags": [
                    "SEO"
                ],
                "summary": "Add an SEO project",
                "description": "Add a site to audit. Give a domain like `example.com`; a pasted URL is\naccepted and reduced to its host. The project starts with no crawl data,\nrun `POST /seo/projects/{id}/audit` to crawl it.\n\nNeeds the SEO product on your plan and the `write` scope.\n",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "domain"
                                ],
                                "properties": {
                                    "domain": {
                                        "type": "string",
                                        "description": "The site domain, for example example.com."
                                    }
                                }
                            },
                            "example": {
                                "domain": "example.com"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/SeoProject"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "seo_example01",
                                        "domain": "example.com",
                                        "audit_status": "idle",
                                        "last_crawled_at": null,
                                        "open_issues": 0,
                                        "created_at": "2026-07-01T09:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/seo/projects/{id}": {
            "get": {
                "operationId": "getSeoProject",
                "tags": [
                    "SEO"
                ],
                "summary": "Get one SEO project",
                "description": "One project with a breakdown of its issues.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "description": "A project id from /seo/projects.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/SeoProjectDetail"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "seo_example01",
                                        "domain": "example.com",
                                        "audit_status": "done",
                                        "last_crawled_at": "2026-07-20T07:00:00+00:00",
                                        "issues": {
                                            "open_by_severity": {
                                                "low": 4,
                                                "medium": 6,
                                                "high": 2
                                            },
                                            "by_status": {
                                                "open": 12,
                                                "applied": 8,
                                                "dismissed": 3
                                            }
                                        },
                                        "created_at": "2026-07-01T09:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/seo/projects/{id}/issues": {
            "get": {
                "operationId": "listSeoIssues",
                "tags": [
                    "SEO"
                ],
                "summary": "List issues",
                "description": "Problems found in the last audit. Filter with `severity` (low, medium,\nhigh), `status` (open, applied, dismissed), `lane` (technical,\nopportunity), `type`, and `quick_win` (true, false).\n",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "severity",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "low",
                                "medium",
                                "high"
                            ]
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "applied",
                                "dismissed"
                            ]
                        }
                    },
                    {
                        "name": "lane",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "technical",
                                "opportunity"
                            ]
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "quick_win",
                        "in": "query",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SeoIssue"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "type": "missing_title",
                                            "severity": "high",
                                            "lane": "technical",
                                            "status": "open",
                                            "quick_win": true,
                                            "page_url": "https://example.com/about",
                                            "detail": "The page has no title tag.",
                                            "created_at": "2026-07-20T07:00:04+00:00"
                                        }
                                    ],
                                    "meta": {
                                        "total": 12,
                                        "limit": 100,
                                        "offset": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/seo/projects/{id}/pages": {
            "get": {
                "operationId": "listSeoPages",
                "tags": [
                    "SEO"
                ],
                "summary": "List crawled pages",
                "description": "Pages found in the last crawl, with their on-page SEO data.",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/SeoPage"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "url": "https://example.com/",
                                            "status_code": 200,
                                            "title": "Example — Home",
                                            "meta_description": "Welcome to Example.",
                                            "h1": "Welcome",
                                            "word_count": 930,
                                            "has_schema": true,
                                            "canonical": "https://example.com/",
                                            "noindex": false,
                                            "last_crawled_at": "2026-07-20T07:00:04+00:00"
                                        }
                                    ],
                                    "meta": {
                                        "total": 42,
                                        "limit": 100,
                                        "offset": 0
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/seo/projects/{id}/audit": {
            "post": {
                "operationId": "startSeoAudit",
                "tags": [
                    "SEO"
                ],
                "summary": "Start an audit",
                "description": "Queue a crawl and analysis for the project. Returns straight away with\nthe status set to queued; poll `GET /seo/projects/{id}` and read\n`audit_status` until it reads done. One audit runs at a time per\nproject, so calling this while one is queued or running returns 409.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Queued.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "audit_status": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "seo_example01",
                                        "audit_status": "queued"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/seo/projects/{id}/issues/{issueId}/fix": {
            "post": {
                "operationId": "fixSeoIssue",
                "tags": [
                    "SEO"
                ],
                "summary": "Generate a fix",
                "description": "Generate a suggested fix for an issue. This runs an AI generation and\nuses credits. It returns a before and after suggestion; you apply the\nchange on your own site. Not every issue type has an automatic fix, and\none that cannot be generated returns 422.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "issueId",
                        "in": "path",
                        "required": true,
                        "description": "An issue id from the issues list.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "A generated fix.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/SeoFix"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "issue_id": 3182,
                                        "fix_type": "title",
                                        "before": "",
                                        "after": "About Us | Example Bakery in Austin, TX"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility": {
            "get": {
                "operationId": "getAiVisibility",
                "tags": [
                    "SEO"
                ],
                "summary": "AI Visibility overview",
                "description": "How often AI assistants (ChatGPT, Gemini, Google AI Mode, Google AI\nOverviews, Perplexity and Claude) name the brand when asked the tracked\nprompts, from the latest finished run: visibility, share of voice,\naverage position, results per assistant, the brands named most and the\ntrend over recent runs. `metrics` is null until a run has finished.\n\n`credits_run_now` is the most a run started now would use. A check that\nfails costs nothing, so a run often uses less.\n\nAI Visibility must be included in the plan. Without it, every AI\nVisibility endpoint returns 403 `plan_required`.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AivOverview"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/prompts": {
            "get": {
                "operationId": "listAiVisibilityPrompts",
                "tags": [
                    "SEO"
                ],
                "summary": "List tracked prompts",
                "description": "The questions tracked for the project, with the latest result per\nassistant. In `mentioned`, true means the assistant named the brand,\nfalse means it did not, null means the prompt has not been asked on that\nassistant yet.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AivPrompt"
                                            }
                                        },
                                        "meta": {
                                            "type": "object",
                                            "properties": {
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "limit": {
                                                    "type": "integer",
                                                    "description": "Most prompts a site can track."
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            },
            "post": {
                "operationId": "addAiVisibilityPrompts",
                "tags": [
                    "SEO"
                ],
                "summary": "Add prompts",
                "description": "Add questions to track, as a customer would ask them to an AI assistant.\nPrompts already tracked are skipped, compared without case. A site\ntracks up to 100 prompts; prompts past the limit are not added and are\ncounted in `skipped_over_limit`. Returns 201 when at least one prompt was\nadded, 200 when every prompt was already tracked.\n\nAdding prompts does not run them. Start a run to get answers.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "prompts"
                                ],
                                "properties": {
                                    "prompts": {
                                        "type": "array",
                                        "maxItems": 100,
                                        "items": {
                                            "type": "string",
                                            "minLength": 3,
                                            "maxLength": 500
                                        }
                                    }
                                }
                            },
                            "example": {
                                "prompts": [
                                    "best accounting firm for a small business in Lyon",
                                    "how do I file a VAT return in France"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Nothing new to add.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AivPromptsAdded"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Added.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AivPromptsAdded"
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "added": [
                                            {
                                                "id": 41,
                                                "prompt": "best accounting firm for a small business in Lyon"
                                            }
                                        ],
                                        "skipped_duplicates": 1,
                                        "skipped_over_limit": 0,
                                        "limit": 100
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "description": "`invalid_prompts` prompts is missing, not a list, or longer than 100.\n`limit_reached` the site already tracks the maximum number of prompts.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/prompts/{promptId}": {
            "get": {
                "operationId": "getAiVisibilityPrompt",
                "tags": [
                    "SEO"
                ],
                "summary": "Get a prompt and its answers",
                "description": "The latest answer from each assistant for one prompt: the answer text in\nMarkdown, whether the brand is named and at which position, the brands\nnamed in order, the sources cited and the searches the assistant ran.\n`history` gives mentioned or not per assistant over the last runs that\nasked this prompt, oldest first.\n\nAn answer with status `empty` means the assistant showed no AI answer for\nthat search, which happens with Google AI Overviews.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "$ref": "#/components/parameters/AivPromptId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AivPromptDetail"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            },
            "delete": {
                "operationId": "removeAiVisibilityPrompt",
                "tags": [
                    "SEO"
                ],
                "summary": "Stop tracking a prompt",
                "description": "The prompt is no longer asked. Its past answers stay in the history.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "$ref": "#/components/parameters/AivPromptId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Removed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "removed": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/sources": {
            "get": {
                "operationId": "listAiVisibilitySources",
                "tags": [
                    "SEO"
                ],
                "summary": "List cited sources",
                "description": "Sites the assistants cited as sources in the latest finished run, by\nshare of answers. `type` is `self` (your site), `competitor` (the site of\na brand named in the answers), `community`, `social`, `video`,\n`reference` or `editorial`. `your_pages` lists the pages of your site\ncited over the last four runs.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AivSources"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/actions": {
            "get": {
                "operationId": "listAiVisibilityActions",
                "tags": [
                    "SEO"
                ],
                "summary": "List recommended actions",
                "description": "Changes that can get the brand into more answers, rebuilt after every\nrun. `kind` is one of:\n\n`crawler_blocked` robots.txt stops an assistant's crawler from reading\nthe site. `details` lists the crawlers and paths.\n\n`no_mention` no assistant names the brand on a prompt. `details` lists\nthe brands named instead.\n\n`source_gap` a site that several assistants cite on prompts where the\nbrand is absent. `details` gives the domain, an example page and the\nbrands it names.\n\nDone actions carry `measure`: visibility on the action's prompts on the\nrun before it was marked done, and on the latest run since.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "done"
                            ],
                            "default": "open"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AivAction"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "description": "`invalid_status` status is not open or done.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/actions/{actionId}": {
            "patch": {
                "operationId": "updateAiVisibilityAction",
                "tags": [
                    "SEO"
                ],
                "summary": "Update an action",
                "description": "Mark an action `done`, `dismissed`, or `open` again. Marking it done\nrecords the current visibility on its prompts so the next runs can\nmeasure the change.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "name": "actionId",
                        "in": "path",
                        "required": true,
                        "description": "An action id from the actions list.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "status"
                                ],
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "enum": [
                                            "open",
                                            "done",
                                            "dismissed"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Updated.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "description": "`invalid_status` status is not open, done or dismissed.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/runs": {
            "get": {
                "operationId": "listAiVisibilityRuns",
                "tags": [
                    "SEO"
                ],
                "summary": "List runs",
                "description": "Runs for the project, newest first, including queued and running ones.\n`trigger` is `manual` for a run started from the dashboard or the API,\n`schedule` for a scheduled one.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 20
                        }
                    },
                    {
                        "$ref": "#/components/parameters/Offset"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/AivRun"
                                            }
                                        },
                                        "meta": {
                                            "$ref": "#/components/schemas/Meta"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            },
            "post": {
                "operationId": "startAiVisibilityRun",
                "tags": [
                    "SEO"
                ],
                "summary": "Start a run",
                "description": "Ask every tracked prompt on every selected assistant now, or only the\nprompts in `prompt_ids`. Returns straight away; poll\n`GET /seo/projects/{id}/ai-visibility/runs/{runId}` until `status` reads\ndone or failed, or subscribe to the `seo.ai_visibility.completed`\nwebhook. A run of a few prompts usually takes one to two minutes.\n\nUses AI credits for each answer received. `credits_max` is the most the\nrun can use; checks that fail cost nothing. One run at a time per\nproject: starting another while one is queued or running returns 409.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "prompt_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        },
                                        "description": "Only these prompts. Omit to run all."
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "202": {
                        "description": "Queued.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "run_id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string"
                                                },
                                                "credits_max": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "run_id": 128,
                                        "status": "queued",
                                        "credits_max": 24600
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "description": "`insufficient_credits` the team does not have enough credits left for this run.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "$ref": "#/components/responses/Conflict"
                    },
                    "422": {
                        "description": "`invalid_prompt_ids` prompt_ids is not a list.\n`no_prompts` the project tracks no prompts yet.\n`no_engines` no assistant is selected.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/runs/{runId}": {
            "get": {
                "operationId": "getAiVisibilityRun",
                "tags": [
                    "SEO"
                ],
                "summary": "Get a run",
                "description": "Status and progress of one run. `metrics` is filled once the run is done.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "name": "runId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/AivRun"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "checks_total": {
                                                            "type": "integer"
                                                        },
                                                        "checks_finished": {
                                                            "type": "integer"
                                                        },
                                                        "metrics": {
                                                            "allOf": [
                                                                {
                                                                    "$ref": "#/components/schemas/AivMetrics"
                                                                }
                                                            ],
                                                            "nullable": true
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/seo/projects/{id}/ai-visibility/settings": {
            "patch": {
                "operationId": "updateAiVisibilitySettings",
                "tags": [
                    "SEO"
                ],
                "summary": "Update settings",
                "description": "Change which assistants are asked, the schedule, the brand name or the\nother names the brand goes by. Fields not sent keep their value.\nAnswers are searched for the brand name and every other name, whole\nwords only and without case.\n\nA scheduled run uses fewer credits per answer than a run started now.\nClaude is asked at most once a week on a schedule.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/AivSettings"
                            },
                            "example": {
                                "schedule": "weekly",
                                "other_names": [
                                    "Example Bakery",
                                    "examplebakery.com"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "The settings after the change.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/AivSettings"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "description": "`nothing_to_update` no field was sent.\n`invalid_assistants` no valid assistant in the list.\n`invalid_schedule` the schedule is not one of the values listed.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/seo/projects/{id}/rank-tracker": {
            "get": {
                "operationId": "getRankTracker",
                "tags": [
                    "SEO"
                ],
                "summary": "Rank Tracker overview",
                "description": "The Google position of every keyword tracked for the project, from its\nlatest check. `position` is null when the site is not in the first\n`limits.depth` results. `change` is the number of places gained since 7\ndays ago (daily plans) or since the previous check (weekly plans):\npositive means the site climbed, `in` means it entered the checked depth,\n`out` means it dropped out, null means there is not enough history.\n\nGoogle can show different results to identical searches. When a check\nmoves a keyword a lot, a second search confirms it. When the two\ndisagree, the position where the site was found is kept and `unstable`\nis true.\n\n`features` lists what the results page shows: `aio` (AI Overview),\n`aio_you` (the AI Overview cites the site, plans with AI Visibility),\n`snippet`, `snippet_you`, `local`, `video`, `paa` (People also ask),\n`shopping`, `news`, `images`.\n\nThe Rank Tracker must be included in the plan. Without it, every Rank\nTracker endpoint returns 403 `plan_required`.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/RankOverview"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/seo/projects/{id}/rank-tracker/keywords": {
            "post": {
                "operationId": "addRankKeywords",
                "tags": [
                    "SEO"
                ],
                "summary": "Track keywords",
                "description": "Track Google searches for one country, language and device. The first\ncheck runs within minutes. Keywords already tracked with the same\ncountry, language and device are skipped.\n\nThe plan sets how many keywords a team tracks across its sites and how\nmany it can add in any 7 days. Deleting a keyword does not give the\naddition back. Keywords past either limit are not added and are counted\nin `skipped_over_limit`. Returns 201 when at least one keyword was added,\n200 when every keyword was already tracked.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "keywords"
                                ],
                                "properties": {
                                    "keywords": {
                                        "type": "array",
                                        "maxItems": 500,
                                        "items": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 191
                                        }
                                    },
                                    "country": {
                                        "type": "string",
                                        "description": "Two-letter country code.",
                                        "default": "US"
                                    },
                                    "language": {
                                        "type": "string",
                                        "description": "Google language code, for example en, fr, de, pt, zh-CN.",
                                        "default": "en"
                                    },
                                    "device": {
                                        "type": "string",
                                        "enum": [
                                            "desktop",
                                            "mobile"
                                        ],
                                        "default": "desktop"
                                    }
                                }
                            },
                            "example": {
                                "keywords": [
                                    "accounting firm lyon",
                                    "vat return france"
                                ],
                                "country": "FR",
                                "language": "fr",
                                "device": "mobile"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Nothing new to add.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/RankKeywordsAdded"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "201": {
                        "description": "Added.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/RankKeywordsAdded"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "description": "`busy` keywords are being added for this team. Try again in a moment.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`invalid_keywords`, `invalid_country`, `invalid_language` or `invalid_device`.\n`limit_reached` the plan has no keyword places left.\n`additions_limit` the team added its plan's keyword count in the last 7 days.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/seo/projects/{id}/rank-tracker/keywords/{keywordId}": {
            "get": {
                "operationId": "getRankKeyword",
                "tags": [
                    "SEO"
                ],
                "summary": "Get a tracked keyword",
                "description": "One keyword with its position history (one point per check, unstable\nchecks left out), its best position, the domains in the latest top 10\nwith their position at the check before, the domains the AI Overview\ncites, and Search Console impressions and clicks from the latest pull.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "$ref": "#/components/parameters/RankKeywordId"
                    },
                    {
                        "name": "days",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "enum": [
                                30,
                                90
                            ],
                            "default": 90
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/RankKeywordDetail"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            },
            "delete": {
                "operationId": "removeRankKeyword",
                "tags": [
                    "SEO"
                ],
                "summary": "Stop tracking a keyword",
                "description": "The keyword and its position history are deleted.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "$ref": "#/components/parameters/RankKeywordId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Removed.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "removed": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/seo/projects/{id}/rank-tracker/keywords/{keywordId}/check": {
            "post": {
                "operationId": "checkRankKeyword",
                "tags": [
                    "SEO"
                ],
                "summary": "Check a keyword now",
                "description": "Checks the Google position now instead of waiting for the scheduled\ncheck. Uses `check_now_credits` AI credits, charged once when the result\nis stored. The result is usually ready within 3 minutes; read it with the\nkeyword endpoint, where `checking` is false once it is stored.\n\nRequires the `write` scope.\n",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/SeoProjectId"
                    },
                    {
                        "$ref": "#/components/parameters/RankKeywordId"
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Checking.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "enum": [
                                                        "checking"
                                                    ]
                                                },
                                                "credits": {
                                                    "type": "integer"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "402": {
                        "description": "`insufficient_credits` the team does not have enough AI credits left.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "409": {
                        "description": "`busy` a check is already running for this keyword.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/webhooks": {
            "get": {
                "operationId": "listWebhooks",
                "tags": [
                    "Webhooks"
                ],
                "summary": "List webhooks",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Webhook"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            },
            "post": {
                "operationId": "createWebhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Create a webhook",
                "description": "The signing secret is returned once, in this response, and cannot be\nretrieved afterwards. Store it before you close the connection.\n\nThe URL must use https on port 443 and must resolve to a public\naddress. Redirects are not followed.\n",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookCreate"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "allOf": [
                                                {
                                                    "$ref": "#/components/schemas/Webhook"
                                                },
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "secret": {
                                                            "type": "string"
                                                        }
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                },
                                "example": {
                                    "data": {
                                        "id": "wh_example01",
                                        "url": "https://hooks.zapier.com/hooks/catch/123456/abcdef/",
                                        "events": [
                                            "post.published",
                                            "post.failed"
                                        ],
                                        "description": "Zapier",
                                        "status": "active",
                                        "disabled_reason": null,
                                        "failure_count": 0,
                                        "last_status_code": null,
                                        "last_delivered_at": null,
                                        "created_at": "2026-08-05T09:00:00+00:00",
                                        "secret_prefix": "whsec_4b175323",
                                        "secret": "whsec_4b1753236d823b667dc22dbc8d885f80eb290efc9352c4ad"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "403": {
                        "$ref": "#/components/responses/Forbidden"
                    },
                    "422": {
                        "description": "`invalid_url` the destination was rejected.\n`invalid_events` an unknown event was named.\n`limit_reached` the team already has the maximum number of webhooks.\n",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                }
            }
        },
        "/webhooks/events": {
            "get": {
                "operationId": "listWebhookEvents",
                "tags": [
                    "Webhooks"
                ],
                "summary": "List available events",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "description": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "name": "post.published",
                                            "description": "A post was published successfully."
                                        },
                                        {
                                            "name": "post.failed",
                                            "description": "A post failed to publish."
                                        },
                                        {
                                            "name": "seo.audit.completed",
                                            "description": "A site audit finished."
                                        },
                                        {
                                            "name": "seo.audit.failed",
                                            "description": "A site audit failed to complete."
                                        },
                                        {
                                            "name": "seo.ai_visibility.completed",
                                            "description": "An AI Visibility check finished."
                                        },
                                        {
                                            "name": "seo.ai_visibility.failed",
                                            "description": "An AI Visibility check failed: no assistant returned an answer."
                                        },
                                        {
                                            "name": "seo.ai_visibility.mention_gained",
                                            "description": "An assistant named your brand on a prompt where it did not before."
                                        },
                                        {
                                            "name": "seo.ai_visibility.mention_lost",
                                            "description": "An assistant stopped naming your brand on a prompt."
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    }
                }
            }
        },
        "/webhooks/{id}": {
            "get": {
                "operationId": "getWebhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Get a webhook",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Webhook"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            },
            "patch": {
                "operationId": "updateWebhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Update a webhook",
                "description": "Send only the fields you want to change. Setting status to true on a\nwebhook that was disabled after repeated failures also clears its\nfailure count.\n",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string"
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "description": {
                                        "type": "string",
                                        "nullable": true
                                    },
                                    "status": {
                                        "type": "boolean"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Webhook"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "422": {
                        "$ref": "#/components/responses/UnprocessableEntity"
                    }
                }
            },
            "delete": {
                "operationId": "deleteWebhook",
                "tags": [
                    "Webhooks"
                ],
                "summary": "Delete a webhook",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Deleted",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string"
                                                },
                                                "deleted": {
                                                    "type": "boolean"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        },
        "/webhooks/{id}/deliveries": {
            "get": {
                "operationId": "listWebhookDeliveries",
                "tags": [
                    "Webhooks"
                ],
                "summary": "List recent delivery attempts",
                "description": "Newest first. Useful for diagnosing an endpoint that is failing.\nHistory is kept for a limited period, not indefinitely.\n",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "default": 50,
                            "maximum": 200
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/WebhookDelivery"
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "data": [
                                        {
                                            "event": "post.published",
                                            "attempt": 1,
                                            "status_code": 200,
                                            "error": null,
                                            "duration_ms": 178,
                                            "created_at": "2026-08-05T09:01:00+00:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "Send your token as `Authorization: Bearer sona_...`.\n\nTokens are shown once when created and stored hashed, so a lost token\ncannot be recovered. Revoke it and make another.\n"
            }
        },
        "parameters": {
            "Limit": {
                "name": "limit",
                "in": "query",
                "description": "Rows per page, 1 to 200.",
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "default": 50
                }
            },
            "Offset": {
                "name": "offset",
                "in": "query",
                "description": "Rows to skip.",
                "schema": {
                    "type": "integer",
                    "minimum": 0,
                    "default": 0
                }
            },
            "SeoProjectId": {
                "name": "id",
                "in": "path",
                "required": true,
                "description": "The SEO project id, from the projects list.",
                "schema": {
                    "type": "string"
                }
            },
            "AivPromptId": {
                "name": "promptId",
                "in": "path",
                "required": true,
                "description": "A prompt id from the prompts list.",
                "schema": {
                    "type": "integer"
                }
            },
            "RankKeywordId": {
                "name": "keywordId",
                "in": "path",
                "required": true,
                "description": "The keyword id, from the Rank Tracker overview.",
                "schema": {
                    "type": "integer"
                }
            }
        },
        "schemas": {
            "Meta": {
                "type": "object",
                "properties": {
                    "total": {
                        "type": "integer",
                        "description": "Rows matching the query, ignoring limit and offset."
                    },
                    "limit": {
                        "type": "integer"
                    },
                    "offset": {
                        "type": "integer"
                    }
                }
            },
            "Analytics": {
                "type": "object",
                "properties": {
                    "account": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "network": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            },
                            "avatar": {
                                "type": "string",
                                "nullable": true
                            },
                            "url": {
                                "type": "string",
                                "nullable": true
                            }
                        }
                    },
                    "range": {
                        "type": "object",
                        "properties": {
                            "since": {
                                "type": "string"
                            },
                            "until": {
                                "type": "string"
                            }
                        }
                    },
                    "metrics": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Metric"
                        }
                    }
                }
            },
            "Metric": {
                "type": "object",
                "properties": {
                    "key": {
                        "type": "string",
                        "description": "The network's own name for the metric.",
                        "example": "page_impressions"
                    },
                    "aggregation": {
                        "type": "string",
                        "nullable": true,
                        "enum": [
                            "latest",
                            "sum"
                        ],
                        "description": "Which of latest or sum is the meaningful total, or null when ambiguous."
                    },
                    "latest": {
                        "type": "number",
                        "description": "The most recent day's value."
                    },
                    "sum": {
                        "type": "number",
                        "description": "All daily values added up."
                    },
                    "total": {
                        "type": "number",
                        "nullable": true,
                        "description": "latest or sum per aggregation, or null when ambiguous."
                    },
                    "series": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "date": {
                                    "type": "string"
                                },
                                "value": {
                                    "type": "number"
                                }
                            }
                        }
                    }
                }
            },
            "Upload": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "description": "Public url. Use this in a post's media array.",
                        "example": "https://files.sona.to/uploads/photo_ab12Cd.jpg"
                    },
                    "name": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string",
                        "description": "MIME type.",
                        "example": "image/jpeg"
                    },
                    "extension": {
                        "type": "string"
                    },
                    "size": {
                        "type": "integer",
                        "description": "Bytes."
                    },
                    "is_image": {
                        "type": "boolean"
                    },
                    "width": {
                        "type": "integer"
                    },
                    "height": {
                        "type": "integer"
                    }
                }
            },
            "SeoProject": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "domain": {
                        "type": "string"
                    },
                    "audit_status": {
                        "type": "string",
                        "description": "idle, queued, running, done, or failed."
                    },
                    "last_crawled_at": {
                        "type": "string",
                        "nullable": true
                    },
                    "open_issues": {
                        "type": "integer"
                    },
                    "created_at": {
                        "type": "string"
                    }
                }
            },
            "SeoProjectDetail": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "domain": {
                        "type": "string"
                    },
                    "audit_status": {
                        "type": "string"
                    },
                    "last_crawled_at": {
                        "type": "string",
                        "nullable": true
                    },
                    "issues": {
                        "type": "object",
                        "properties": {
                            "open_by_severity": {
                                "type": "object",
                                "properties": {
                                    "low": {
                                        "type": "integer"
                                    },
                                    "medium": {
                                        "type": "integer"
                                    },
                                    "high": {
                                        "type": "integer"
                                    }
                                }
                            },
                            "by_status": {
                                "type": "object",
                                "properties": {
                                    "open": {
                                        "type": "integer"
                                    },
                                    "applied": {
                                        "type": "integer"
                                    },
                                    "dismissed": {
                                        "type": "integer"
                                    }
                                }
                            }
                        }
                    },
                    "created_at": {
                        "type": "string"
                    }
                }
            },
            "SeoIssue": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer",
                        "description": "Use this to request a fix."
                    },
                    "type": {
                        "type": "string",
                        "example": "missing_title"
                    },
                    "severity": {
                        "type": "string",
                        "enum": [
                            "low",
                            "medium",
                            "high"
                        ]
                    },
                    "lane": {
                        "type": "string",
                        "enum": [
                            "technical",
                            "opportunity"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "open",
                            "applied",
                            "dismissed"
                        ]
                    },
                    "quick_win": {
                        "type": "boolean"
                    },
                    "page_url": {
                        "type": "string",
                        "nullable": true
                    },
                    "detail": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": "string"
                    }
                }
            },
            "SeoPage": {
                "type": "object",
                "properties": {
                    "url": {
                        "type": "string"
                    },
                    "status_code": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string",
                        "nullable": true
                    },
                    "meta_description": {
                        "type": "string",
                        "nullable": true
                    },
                    "h1": {
                        "type": "string",
                        "nullable": true
                    },
                    "word_count": {
                        "type": "integer"
                    },
                    "has_schema": {
                        "type": "boolean"
                    },
                    "canonical": {
                        "type": "string",
                        "nullable": true
                    },
                    "noindex": {
                        "type": "boolean"
                    },
                    "last_crawled_at": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "SeoFix": {
                "type": "object",
                "properties": {
                    "issue_id": {
                        "type": "integer"
                    },
                    "fix_type": {
                        "type": "string",
                        "example": "title"
                    },
                    "before": {
                        "type": "string",
                        "description": "The current value, may be empty."
                    },
                    "after": {
                        "type": "string",
                        "description": "The suggested replacement."
                    }
                }
            },
            "RankKeyword": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "keyword": {
                        "type": "string"
                    },
                    "country": {
                        "type": "string"
                    },
                    "language": {
                        "type": "string"
                    },
                    "device": {
                        "type": "string",
                        "enum": [
                            "desktop",
                            "mobile"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "checked",
                            "checking",
                            "paused"
                        ],
                        "description": "`paused` when the team tracks more keywords than its plan allows."
                    },
                    "position": {
                        "type": "integer",
                        "nullable": true
                    },
                    "change": {
                        "description": "Places gained, or `in`, `out`, or null.",
                        "oneOf": [
                            {
                                "type": "integer"
                            },
                            {
                                "type": "string",
                                "enum": [
                                    "in",
                                    "out"
                                ]
                            }
                        ],
                        "nullable": true
                    },
                    "url": {
                        "type": "string",
                        "nullable": true,
                        "description": "The ranking page."
                    },
                    "unstable": {
                        "type": "boolean"
                    },
                    "features": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "search_console_impressions": {
                        "type": "integer",
                        "nullable": true
                    },
                    "checked_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    }
                }
            },
            "RankOverview": {
                "type": "object",
                "properties": {
                    "project": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "domain": {
                                "type": "string"
                            }
                        }
                    },
                    "limits": {
                        "type": "object",
                        "properties": {
                            "keywords": {
                                "type": "integer",
                                "description": "Keywords the plan allows across the team's sites, -1 for unlimited."
                            },
                            "keywords_used": {
                                "type": "integer"
                            },
                            "additions_left": {
                                "type": "integer",
                                "description": "Keywords the team can still add in the current 7 days, -1 for unlimited."
                            },
                            "next_release": {
                                "type": "object",
                                "nullable": true,
                                "properties": {
                                    "count": {
                                        "type": "integer"
                                    },
                                    "at": {
                                        "type": "string",
                                        "format": "date-time"
                                    }
                                }
                            },
                            "checked_every": {
                                "type": "string",
                                "enum": [
                                    "day",
                                    "7_days"
                                ]
                            },
                            "depth": {
                                "type": "integer",
                                "description": "Number of Google results checked."
                            }
                        }
                    },
                    "check_now_credits": {
                        "type": "integer"
                    },
                    "metrics": {
                        "type": "object",
                        "properties": {
                            "keywords_checked": {
                                "type": "integer"
                            },
                            "average_position": {
                                "type": "number",
                                "nullable": true
                            },
                            "top_3": {
                                "type": "integer"
                            },
                            "top_10": {
                                "type": "integer"
                            },
                            "in_depth": {
                                "type": "integer"
                            },
                            "ai_overview": {
                                "type": "integer",
                                "description": "Keywords whose results page shows an AI Overview."
                            },
                            "ai_overview_cites_you": {
                                "type": "integer",
                                "nullable": true,
                                "description": "Null when the plan does not include AI Visibility."
                            }
                        }
                    },
                    "keywords": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/RankKeyword"
                        }
                    }
                }
            },
            "RankKeywordDetail": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "keyword": {
                        "type": "string"
                    },
                    "country": {
                        "type": "string"
                    },
                    "language": {
                        "type": "string"
                    },
                    "device": {
                        "type": "string"
                    },
                    "position": {
                        "type": "integer",
                        "nullable": true
                    },
                    "best_position": {
                        "type": "integer",
                        "nullable": true
                    },
                    "url": {
                        "type": "string",
                        "nullable": true
                    },
                    "unstable": {
                        "type": "boolean"
                    },
                    "checking": {
                        "type": "boolean"
                    },
                    "checked_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "next_check_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "features": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "ai_overview_cites": {
                        "type": "array",
                        "nullable": true,
                        "items": {
                            "type": "string"
                        },
                        "description": "Null when the plan does not include AI Visibility."
                    },
                    "history": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "date": {
                                    "type": "string",
                                    "format": "date"
                                },
                                "position": {
                                    "type": "integer",
                                    "nullable": true
                                }
                            }
                        }
                    },
                    "competitors": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "domain": {
                                    "type": "string"
                                },
                                "position": {
                                    "type": "integer"
                                },
                                "previous_position": {
                                    "type": "integer",
                                    "nullable": true
                                },
                                "is_you": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "search_console": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "impressions": {
                                "type": "integer"
                            },
                            "clicks": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "RankKeywordsAdded": {
                "type": "object",
                "properties": {
                    "added": {
                        "type": "integer"
                    },
                    "skipped_duplicates": {
                        "type": "integer"
                    },
                    "skipped_over_limit": {
                        "type": "integer"
                    },
                    "additions_left": {
                        "type": "integer"
                    }
                }
            },
            "AivMetrics": {
                "type": "object",
                "description": "Percentages are whole numbers from 0 to 100.",
                "properties": {
                    "answers": {
                        "type": "integer",
                        "description": "Answers received in the run."
                    },
                    "visibility": {
                        "type": "integer",
                        "description": "Share of answers that name the brand."
                    },
                    "share_of_voice": {
                        "type": "integer",
                        "description": "The brand's mentions as a share of all brand mentions in the answers."
                    },
                    "average_position": {
                        "type": "number",
                        "nullable": true,
                        "description": "Average rank of the brand among the brands named, over the answers that name it. 1 is first."
                    },
                    "positive_sentiment": {
                        "type": "integer",
                        "nullable": true,
                        "description": "Share of the answers naming the brand that describe it positively."
                    },
                    "cited_pages": {
                        "type": "integer",
                        "description": "Pages of your site cited as a source."
                    }
                }
            },
            "AivRun": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "trigger": {
                        "type": "string",
                        "enum": [
                            "manual",
                            "schedule"
                        ]
                    },
                    "all_prompts": {
                        "type": "boolean",
                        "description": "False for a run of only some prompts (prompt_ids). Such runs are left out of the overview metrics, the trend and the recommendations."
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "queued",
                            "running",
                            "done",
                            "failed"
                        ]
                    },
                    "assistants": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "prompts": {
                        "type": "integer"
                    },
                    "checks": {
                        "type": "integer",
                        "description": "Checks finished, one per prompt per assistant. Filled when the run closes."
                    },
                    "credits_used": {
                        "type": "integer",
                        "description": "Filled when the run closes."
                    },
                    "created_at": {
                        "type": "string"
                    },
                    "started_at": {
                        "type": "string",
                        "nullable": true
                    },
                    "finished_at": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "AivOverview": {
                "type": "object",
                "properties": {
                    "project": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "domain": {
                                "type": "string"
                            }
                        }
                    },
                    "brand_name": {
                        "type": "string"
                    },
                    "other_names": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "assistants": {
                        "type": "array",
                        "description": "Assistants asked on each run.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "chatgpt",
                                "gemini",
                                "ai_mode",
                                "ai_overviews",
                                "perplexity",
                                "claude"
                            ]
                        }
                    },
                    "schedule": {
                        "type": "string",
                        "enum": [
                            "off",
                            "weekly",
                            "twice_weekly",
                            "daily"
                        ]
                    },
                    "prompts": {
                        "type": "integer",
                        "description": "Prompts tracked."
                    },
                    "credits_run_now": {
                        "type": "integer"
                    },
                    "active_run": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "status": {
                                "type": "string"
                            },
                            "trigger": {
                                "type": "string"
                            },
                            "checks_total": {
                                "type": "integer"
                            },
                            "checks_finished": {
                                "type": "integer"
                            }
                        }
                    },
                    "latest_run": {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/AivRun"
                            }
                        ],
                        "nullable": true
                    },
                    "metrics": {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/AivMetrics"
                            }
                        ],
                        "nullable": true
                    },
                    "previous_metrics": {
                        "allOf": [
                            {
                                "$ref": "#/components/schemas/AivMetrics"
                            }
                        ],
                        "nullable": true
                    },
                    "by_assistant": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "assistant": {
                                    "type": "string"
                                },
                                "name": {
                                    "type": "string"
                                },
                                "visibility": {
                                    "type": "integer"
                                },
                                "change": {
                                    "type": "integer",
                                    "nullable": true,
                                    "description": "Points up or down since the run before."
                                }
                            }
                        }
                    },
                    "brands": {
                        "type": "array",
                        "description": "The brands named most in the latest run, and yours.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "is_you": {
                                    "type": "boolean"
                                },
                                "visibility": {
                                    "type": "integer"
                                },
                                "share_of_voice": {
                                    "type": "integer"
                                },
                                "average_position": {
                                    "type": "number",
                                    "nullable": true
                                },
                                "positive_sentiment": {
                                    "type": "integer",
                                    "nullable": true
                                }
                            }
                        }
                    },
                    "trend": {
                        "type": "array",
                        "description": "Visibility per finished run, oldest first.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "date": {
                                    "type": "string"
                                },
                                "visibility": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                }
            },
            "AivPrompt": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "prompt": {
                        "type": "string"
                    },
                    "topic": {
                        "type": "string",
                        "nullable": true
                    },
                    "visibility": {
                        "type": "integer",
                        "nullable": true
                    },
                    "average_position": {
                        "type": "number",
                        "nullable": true
                    },
                    "change": {
                        "type": "integer",
                        "nullable": true
                    },
                    "mentioned": {
                        "type": "object",
                        "description": "One key per assistant. True, false, or null when not asked yet.",
                        "additionalProperties": {
                            "type": "boolean",
                            "nullable": true
                        }
                    }
                }
            },
            "AivPromptsAdded": {
                "type": "object",
                "properties": {
                    "added": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "id": {
                                    "type": "integer"
                                },
                                "prompt": {
                                    "type": "string"
                                }
                            }
                        }
                    },
                    "skipped_duplicates": {
                        "type": "integer"
                    },
                    "skipped_over_limit": {
                        "type": "integer"
                    },
                    "limit": {
                        "type": "integer"
                    }
                }
            },
            "AivAnswer": {
                "type": "object",
                "properties": {
                    "assistant": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "ok",
                            "empty"
                        ]
                    },
                    "mentioned": {
                        "type": "boolean"
                    },
                    "position": {
                        "type": "integer",
                        "nullable": true
                    },
                    "sentiment": {
                        "type": "string",
                        "nullable": true,
                        "enum": [
                            "positive",
                            "neutral",
                            "negative",
                            null
                        ]
                    },
                    "described_as": {
                        "type": "string",
                        "nullable": true,
                        "description": "How the answer describes the brand, in a few words."
                    },
                    "answer": {
                        "type": "string",
                        "nullable": true,
                        "description": "The answer text, in Markdown."
                    },
                    "model": {
                        "type": "string",
                        "nullable": true
                    },
                    "captured_at": {
                        "type": "string"
                    },
                    "brands": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "position": {
                                    "type": "integer"
                                },
                                "is_you": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "sources": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": "string"
                                },
                                "is_you": {
                                    "type": "boolean"
                                }
                            }
                        }
                    },
                    "searches": {
                        "type": "array",
                        "description": "Web searches the assistant ran to answer, when it reports them.",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "AivPromptDetail": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "prompt": {
                        "type": "string"
                    },
                    "topic": {
                        "type": "string",
                        "nullable": true
                    },
                    "active": {
                        "type": "boolean"
                    },
                    "answers": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/AivAnswer"
                        }
                    },
                    "history": {
                        "type": "object",
                        "properties": {
                            "dates": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "assistants": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "assistant": {
                                            "type": "string"
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "mentioned": {
                                            "type": "array",
                                            "description": "One entry per date. Null when the prompt was not asked on that assistant.",
                                            "items": {
                                                "type": "boolean",
                                                "nullable": true
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "AivSources": {
                "type": "object",
                "properties": {
                    "run_id": {
                        "type": "integer",
                        "nullable": true
                    },
                    "domains": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "domain": {
                                    "type": "string"
                                },
                                "type": {
                                    "type": "string",
                                    "enum": [
                                        "self",
                                        "competitor",
                                        "community",
                                        "social",
                                        "video",
                                        "reference",
                                        "editorial"
                                    ]
                                },
                                "share": {
                                    "type": "integer",
                                    "description": "Share of answers citing this domain."
                                },
                                "answers": {
                                    "type": "integer"
                                },
                                "assistants": {
                                    "type": "integer"
                                },
                                "prompts": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "your_pages": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "type": "string"
                                },
                                "answers": {
                                    "type": "integer"
                                },
                                "assistants": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "prompts": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "AivAction": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "kind": {
                        "type": "string",
                        "enum": [
                            "crawler_blocked",
                            "no_mention",
                            "source_gap"
                        ]
                    },
                    "impact": {
                        "type": "string",
                        "enum": [
                            "high",
                            "medium",
                            "low"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "open",
                            "done",
                            "dismissed"
                        ]
                    },
                    "details": {
                        "type": "object",
                        "description": "Depends on kind. See the actions list."
                    },
                    "prompt_ids": {
                        "type": "array",
                        "items": {
                            "type": "integer"
                        }
                    },
                    "done_at": {
                        "type": "string",
                        "nullable": true
                    },
                    "measure": {
                        "type": "object",
                        "description": "Done actions only.",
                        "properties": {
                            "visibility_before": {
                                "type": "integer",
                                "nullable": true
                            },
                            "visibility_after": {
                                "type": "integer",
                                "nullable": true
                            },
                            "runs_since": {
                                "type": "integer"
                            }
                        }
                    }
                }
            },
            "AivSettings": {
                "type": "object",
                "properties": {
                    "assistants": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                            "type": "string",
                            "enum": [
                                "chatgpt",
                                "gemini",
                                "ai_mode",
                                "ai_overviews",
                                "perplexity",
                                "claude"
                            ]
                        }
                    },
                    "schedule": {
                        "type": "string",
                        "enum": [
                            "off",
                            "weekly",
                            "twice_weekly",
                            "daily"
                        ]
                    },
                    "brand_name": {
                        "type": "string",
                        "maxLength": 80,
                        "description": "The name the answers are searched for. Empty uses the domain."
                    },
                    "other_names": {
                        "type": "array",
                        "maxItems": 20,
                        "description": "Other names or spellings. Sending it replaces the saved list.",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "Me": {
                "type": "object",
                "properties": {
                    "user": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer"
                            },
                            "name": {
                                "type": "string"
                            },
                            "email": {
                                "type": "string"
                            }
                        }
                    },
                    "plan": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "integer",
                                "nullable": true
                            },
                            "name": {
                                "type": "string",
                                "nullable": true,
                                "example": "Agency"
                            },
                            "interval": {
                                "type": "string",
                                "nullable": true,
                                "enum": [
                                    "monthly",
                                    "yearly",
                                    "lifetime",
                                    "credit_pack"
                                ]
                            },
                            "expires_at": {
                                "type": "string",
                                "nullable": true,
                                "description": "ISO 8601, or null if the plan does not expire."
                            }
                        }
                    },
                    "limits": {
                        "type": "object",
                        "properties": {
                            "requests_per_minute": {
                                "type": "integer",
                                "description": "-1 means no limit."
                            },
                            "requests_per_month": {
                                "type": "integer",
                                "description": "-1 means no limit."
                            },
                            "max_tokens": {
                                "type": "integer",
                                "description": "-1 means no limit."
                            }
                        }
                    },
                    "scopes": {
                        "type": "object",
                        "properties": {
                            "read": {
                                "type": "boolean"
                            },
                            "write": {
                                "type": "boolean"
                            }
                        }
                    },
                    "token": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string"
                            },
                            "prefix": {
                                "type": "string",
                                "description": "First characters of the token, to tell tokens apart in logs."
                            }
                        }
                    }
                }
            },
            "Account": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string",
                        "description": "Use this wherever a channel id is asked for."
                    },
                    "network": {
                        "type": "string",
                        "example": "telegram"
                    },
                    "module": {
                        "type": "string",
                        "description": "Internal channel type."
                    },
                    "name": {
                        "type": "string"
                    },
                    "username": {
                        "type": "string",
                        "nullable": true
                    },
                    "avatar": {
                        "type": "string",
                        "nullable": true
                    },
                    "url": {
                        "type": "string",
                        "nullable": true
                    },
                    "can_post": {
                        "type": "boolean"
                    }
                }
            },
            "PostStatus": {
                "type": "string",
                "enum": [
                    "draft",
                    "awaiting_approval",
                    "scheduled",
                    "processing",
                    "published",
                    "failed"
                ]
            },
            "Post": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "status": {
                        "$ref": "#/components/schemas/PostStatus"
                    },
                    "network": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "text",
                            "media",
                            "link"
                        ]
                    },
                    "caption": {
                        "type": "string",
                        "nullable": true
                    },
                    "link": {
                        "type": "string",
                        "nullable": true
                    },
                    "media": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "account": {
                        "type": "object",
                        "nullable": true,
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "scheduled_at": {
                        "type": "string",
                        "description": "ISO 8601 with offset."
                    },
                    "created_at": {
                        "type": "string",
                        "description": "ISO 8601 with offset."
                    },
                    "published_url": {
                        "type": "string",
                        "nullable": true,
                        "description": "Link to the published post, once it has gone out."
                    }
                }
            },
            "PostCreate": {
                "type": "object",
                "required": [
                    "accounts"
                ],
                "properties": {
                    "accounts": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                            "type": "string"
                        },
                        "description": "Channel ids from /accounts."
                    },
                    "caption": {
                        "type": "string"
                    },
                    "link": {
                        "type": "string"
                    },
                    "media": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        },
                        "description": "Publicly reachable image or video URLs."
                    },
                    "scheduled_at": {
                        "type": "string",
                        "description": "ISO 8601 with offset, in the future. Omit to publish now.\n"
                    },
                    "options": {
                        "type": "object",
                        "description": "Per-network settings, passed through untouched. Networks that need\nextra fields, such as a YouTube title, take them here.\n"
                    }
                }
            },
            "PostUpdate": {
                "type": "object",
                "properties": {
                    "caption": {
                        "type": "string"
                    },
                    "link": {
                        "type": "string"
                    },
                    "media": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "scheduled_at": {
                        "type": "string"
                    }
                }
            },
            "Error": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "Webhook": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string"
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "disabled"
                        ]
                    },
                    "disabled_reason": {
                        "type": "string",
                        "nullable": true
                    },
                    "failure_count": {
                        "type": "integer"
                    },
                    "last_status_code": {
                        "type": "integer",
                        "nullable": true
                    },
                    "last_delivered_at": {
                        "type": "string",
                        "format": "date-time",
                        "nullable": true
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "secret_prefix": {
                        "type": "string"
                    }
                }
            },
            "WebhookCreate": {
                "type": "object",
                "required": [
                    "url",
                    "events"
                ],
                "properties": {
                    "url": {
                        "type": "string"
                    },
                    "events": {
                        "type": "array",
                        "minItems": 1,
                        "items": {
                            "type": "string"
                        }
                    },
                    "description": {
                        "type": "string",
                        "nullable": true
                    }
                }
            },
            "WebhookDelivery": {
                "type": "object",
                "properties": {
                    "event": {
                        "type": "string"
                    },
                    "attempt": {
                        "type": "integer"
                    },
                    "status_code": {
                        "type": "integer",
                        "nullable": true
                    },
                    "error": {
                        "type": "string",
                        "nullable": true
                    },
                    "duration_ms": {
                        "type": "integer"
                    },
                    "created_at": {
                        "type": "string",
                        "format": "date-time"
                    }
                }
            }
        },
        "responses": {
            "Unauthorized": {
                "description": "`unauthenticated` no token was sent.\n`invalid_token` the token is unknown, revoked, expired, or its account is not active.\n",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Forbidden": {
                "description": "`plan_required` the plan does not include API access, or AI Visibility on its endpoints.\n`plan_expired` the plan has lapsed.\n`insufficient_scope` the token or the plan does not allow this action.\n",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "NotFound": {
                "description": "`not_found` no such post, channel, SEO project, prompt, run or action on this team.\n",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "Conflict": {
                "description": "`conflict` the post has already gone out or is being sent.\n`busy` an AI Visibility run is already queued or running for this project.\n",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "UnprocessableEntity": {
                "description": "`invalid_parameter` something in the request is wrong, with the reason in the message.\n`validation_failed` a channel rejected the content.\n`publish_failed` the network refused the post.\n",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "TooManyRequests": {
                "description": "`rate_limited` too many requests this minute.\n`quota_exceeded` the monthly request or post allowance is used up.\n",
                "headers": {
                    "X-RateLimit-Limit": {
                        "schema": {
                            "type": "integer"
                        }
                    },
                    "X-RateLimit-Remaining": {
                        "schema": {
                            "type": "integer"
                        }
                    },
                    "Retry-After": {
                        "schema": {
                            "type": "integer"
                        }
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        }
    }
}