{
    "openapi": "3.1.0",
    "info": {
        "title": "Rawi API",
        "version": "1.0.0",
        "summary": "AI visibility (AEO) platform: the customer API (auth, onboarding, runs and reports, billing, settings).",
        "description": "JSON API of Rawi (راوی). All endpoints live under `/api`, answer JSON with `snake_case` keys and use `Accept-Language: fa|en` for localized messages. Authenticate with a Sanctum bearer token from `POST /auth/verify` (email or mobile code).\n\nHuman guide: `/docs/fa/api/overview` · interactive console: `/docs/api`.\n\nThis is the public copy of the spec: customer and public endpoints only. Generated by `php artisan docs:openapi`.",
        "contact": {
            "name": "Rawi"
        }
    },
    "servers": [
        {
            "url": "http://127.0.0.1:8010/api",
            "description": "Local development"
        },
        {
            "url": "{origin}/api",
            "description": "Custom",
            "variables": {
                "origin": {
                    "default": "https://api.example.com"
                }
            }
        }
    ],
    "paths": {
        "/auth/logout": {
            "post": {
                "operationId": "post-auth-logout",
                "tags": [
                    "Auth & profile"
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Log out",
                "description": "Revokes the current token.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "shell",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Log out",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/auth/logout-others": {
            "post": {
                "operationId": "post-auth-logout-others",
                "summary": "Sign out of all other devices",
                "tags": [
                    "Auth & profile"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "signed_out": {
                                            "type": "integer"
                                        }
                                    },
                                    "required": [
                                        "signed_out"
                                    ]
                                },
                                "example": {
                                    "signed_out": 2
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                },
                "description": "Revokes every token of the account except the one making the request. Throttle 10/min.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Log out other devices",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/auth/options": {
            "get": {
                "operationId": "get-auth-options",
                "summary": "Sign-in options",
                "tags": [
                    "Auth & profile"
                ],
                "responses": {
                    "200": {
                        "description": "AuthOptions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "phone_login": {
                                            "type": "boolean"
                                        },
                                        "voice_fallback": {
                                            "type": "boolean"
                                        },
                                        "panel_languages": {
                                            "type": "array",
                                            "description": "O1 language switcher: panel languages switched on in A4 (that the app has a dictionary for).",
                                            "items": {}
                                        },
                                        "market": {
                                            "type": "string",
                                            "description": "Market & calendar (A «بازار و تقویم»): `calendar` decides period boundaries only (monthly allowances reset\non the 1st of a Gregorian or Persian month in `timezone`); dates are displayed by the reader's locale."
                                        },
                                        "default_locale": {
                                            "type": "string"
                                        },
                                        "calendar": {
                                            "type": "string"
                                        },
                                        "timezone": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "phone_login",
                                        "voice_fallback",
                                        "panel_languages",
                                        "market",
                                        "default_locale",
                                        "calendar",
                                        "timezone"
                                    ]
                                },
                                "example": {
                                    "phone_login": true,
                                    "voice_fallback": false,
                                    "panel_languages": [
                                        "fa",
                                        "en"
                                    ],
                                    "market": "international",
                                    "default_locale": "en",
                                    "calendar": "gregorian",
                                    "timezone": "UTC"
                                }
                            }
                        }
                    }
                },
                "description": "Which sign-in methods the app shows. `phone_login` = setting `sms.login_enabled` on and codes can be delivered (IPPanel configured, or the log driver outside production); `voice_fallback` = `sms.otp_voice_fallback` on and voice available. `panel_languages` = the panel languages switched on in the admin panel (`fa`/`en`, in the admin panel order); the language switcher offers only these and hides itself when just one is on. Market & calendar: `market` (`international` or `iran`, from `RAWI_MARKET`), `default_locale` (panel language for a visitor who has not picked one), `calendar` (`gregorian` or `jalali`, period boundaries only) and `timezone` (IANA; the zone dates are displayed in).",
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "x-rawi-access-note": "Public — no token",
                "x-rawi-screen": "O1",
                "security": [],
                "x-postman": {
                    "name": "Sign-in options",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/auth/request-code": {
            "post": {
                "operationId": "post-auth-request-code",
                "tags": [
                    "Auth & profile"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "maxLength": 190,
                                        "description": "valid email, max 190; normalized to lower case"
                                    },
                                    "locale": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "fa",
                                            "en",
                                            null
                                        ],
                                        "description": "`fa` | `en` (panel language for a new account; default = Accept-Language)"
                                    },
                                    "ref": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 32,
                                        "description": "referral code of the inviter (S6 link `?ref=`), max 32"
                                    }
                                },
                                "required": [
                                    "email"
                                ]
                            },
                            "x-rawi-template": "{\n  \"email\": \"{{userEmail}}\",\n  \"locale\": \"{{lang}}\",\n  \"ref\": null\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Request login code",
                                    "value": {
                                        "email": "demo@rawi.local",
                                        "locale": "fa",
                                        "ref": null
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "email": "demo@rawi.local",
                                        "locale": "fa",
                                        "ref": "wth1ftkn"
                                    }
                                },
                                "variant1": {
                                    "summary": "SMS: phone sign-in (IPPanel Edge)",
                                    "value": {
                                        "phone": "09120000077",
                                        "channel": "sms",
                                        "locale": "fa"
                                    }
                                },
                                "variant2": {
                                    "summary": "SMS: phone sign-in (IPPanel Edge)",
                                    "value": {
                                        "phone": "09120000077",
                                        "channel": "voice"
                                    }
                                },
                                "postman2": {
                                    "summary": "Postman: Phone login: request SMS code",
                                    "value": {
                                        "phone": "09120000077",
                                        "channel": "sms",
                                        "locale": "fa"
                                    }
                                },
                                "postman3": {
                                    "summary": "Postman: Phone login: request voice code",
                                    "value": {
                                        "phone": "09120000077",
                                        "channel": "voice"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "RequestCodeResponse\n\nPhone response: `{\"sent\":true,\"expires_in\":600,\"resend_in\":45,\"existing_account\":true,\"channel\":\"sms\",\"phone\":\"+989120000077\",\"voice_available\":false,\"dev_code\":\"495814\"}`. `dev_code` is present only when `RAWI_DEV_EXPOSE_OTP=true` and the app is not in production.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "sent": {
                                                    "type": "boolean"
                                                },
                                                "expires_in": {
                                                    "type": "integer",
                                                    "const": 600
                                                },
                                                "resend_in": {
                                                    "type": "integer"
                                                },
                                                "existing_account": {
                                                    "type": "boolean"
                                                },
                                                "channel": {
                                                    "type": "string",
                                                    "const": "email"
                                                },
                                                "dev_code": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "sent",
                                                "expires_in",
                                                "resend_in",
                                                "existing_account",
                                                "channel",
                                                "dev_code"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "sent": {
                                                    "type": "boolean"
                                                },
                                                "expires_in": {
                                                    "type": "integer",
                                                    "const": 600
                                                },
                                                "resend_in": {
                                                    "type": "integer"
                                                },
                                                "existing_account": {
                                                    "type": "boolean"
                                                },
                                                "channel": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "string",
                                                            "enum": [
                                                                "sms"
                                                            ]
                                                        }
                                                    ]
                                                },
                                                "phone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "voice_available": {
                                                    "type": "boolean"
                                                },
                                                "dev_code": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "sent",
                                                "expires_in",
                                                "resend_in",
                                                "existing_account",
                                                "channel",
                                                "phone",
                                                "voice_available",
                                                "dev_code"
                                            ]
                                        }
                                    ]
                                },
                                "example": {
                                    "sent": true,
                                    "expires_in": 600,
                                    "resend_in": 45,
                                    "existing_account": true,
                                    "channel": "email",
                                    "dev_code": "901976"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`email` invalid; `phone` invalid number or phone login switched off; `channel` voice not available («دریافت کد با تماس صوتی فعلاً ممکن نیست.»)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Resend cooldown (45 s) or more than 5 codes/min for this address: `{\"message\":\"…\",\"resend_in\":32}`; or route throttle 30 req/min/IP (`Too Many Attempts.`)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "IPPanel rejected the SMS/voice send: `errors.phone` «فرستادن پیامک ممکن نشد…»; the code is retired so the user can ask again at once",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Request login code",
                "description": "Sends the 6-digit login code. With `email`: by email. With `phone` (and no `email`): by SMS (`otp` type) or, with `channel: \"voice\"`, by a voice call. Remembers `locale` and `ref` for the verify step (30 min). Fires `signup_started` for new accounts.",
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "x-rawi-access-note": "Public — no token",
                "x-rawi-screen": "O1",
                "x-rawi-throttle": "30/1min",
                "security": [],
                "x-postman": {
                    "name": "Request login code",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/auth/sessions": {
            "get": {
                "operationId": "get-auth-sessions",
                "summary": "List signed-in devices",
                "tags": [
                    "Auth & profile"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "description": "Unique ID."
                                            },
                                            "current": {
                                                "type": "boolean"
                                            },
                                            "user_agent": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "ip": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "created_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "When it was created (ISO 8601)."
                                            },
                                            "last_used_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "id",
                                            "current",
                                            "user_agent",
                                            "ip",
                                            "created_at",
                                            "last_used_at"
                                        ]
                                    }
                                },
                                "example": [
                                    {
                                        "id": 41,
                                        "current": true,
                                        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0 Safari/537.36",
                                        "ip": "203.0.113.7",
                                        "created_at": "2026-11-26T09:00:00Z",
                                        "last_used_at": "2026-11-26T10:12:00Z"
                                    },
                                    {
                                        "id": 38,
                                        "current": false,
                                        "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) Safari/604.1",
                                        "ip": "198.51.100.20",
                                        "created_at": "2026-11-20T18:30:00Z",
                                        "last_used_at": "2026-11-24T08:01:00Z"
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "description": "The account's live sign-ins (tokens from `/auth/verify`), the current one first, then by last use. `user_agent` and `ip` are recorded at sign-in (null for sessions created before they were recorded); the app shows the browser and OS parsed from `user_agent`. `last_used_at` falls back to `created_at`. Support sessions opened by the Rawi team are not listed.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "List signed-in devices",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/auth/sessions/{id}": {
            "delete": {
                "operationId": "delete-auth-sessions-id",
                "summary": "Sign one device out",
                "tags": [
                    "Auth & profile"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "x-rawi-variable": "id"
                    }
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "401": {
                        "description": "Missing/invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No such session on this account",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Too many requests",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "description": "Revokes one of the account's own sessions (an `id` from `GET /auth/sessions`); the current one too, which signs this device out. Throttle 20/min.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "20/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-rawi-destructive": "danger",
                "x-postman": {
                    "name": "Sign one device out",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/auth/verify": {
            "post": {
                "operationId": "post-auth-verify",
                "tags": [
                    "Auth & profile"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email",
                                        "maxLength": 190,
                                        "description": "same email as request-code"
                                    },
                                    "code": {
                                        "type": "string",
                                        "maxLength": 12,
                                        "description": "6 digits; Persian/Arabic digits accepted"
                                    },
                                    "locale": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "fa",
                                            "en",
                                            null
                                        ],
                                        "description": "`fa`| `en`, overrides the value remembered from request-code"
                                    },
                                    "ref": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 32,
                                        "description": "referral code, overrides the remembered one"
                                    }
                                },
                                "required": [
                                    "email",
                                    "code"
                                ]
                            },
                            "x-rawi-template": "{\n  \"email\": \"{{userEmail}}\",\n  \"code\": \"{{devCode}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Verify code (get user token)",
                                    "value": {
                                        "email": "demo@rawi.local",
                                        "code": ""
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "email": "demo@rawi.local",
                                        "code": "901976"
                                    }
                                },
                                "variant1": {
                                    "summary": "SMS: phone sign-in (IPPanel Edge)",
                                    "value": {
                                        "phone": "09120000077",
                                        "code": "495814"
                                    }
                                },
                                "postman2": {
                                    "summary": "Postman: Phone login: verify (get user token)",
                                    "value": {
                                        "phone": "09120000077",
                                        "code": ""
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "VerifyResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "token": {
                                            "type": "string"
                                        },
                                        "user": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "email": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Email address."
                                                },
                                                "phone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Mobile number."
                                                },
                                                "phone_verified": {
                                                    "type": "boolean"
                                                },
                                                "sms_notifications": {
                                                    "type": "boolean"
                                                },
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "locale": {
                                                    "type": "string",
                                                    "enum": [
                                                        "en",
                                                        "fa"
                                                    ],
                                                    "description": "Language: `fa` or `en`."
                                                },
                                                "plan": {
                                                    "type": "string",
                                                    "enum": [
                                                        "paid",
                                                        "free"
                                                    ],
                                                    "description": "Plan: `free` (Free) or `paid` (Pro)."
                                                },
                                                "billing_period": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "plan_expires_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "onboarding_step": {
                                                    "type": "integer"
                                                },
                                                "onboarding_completed": {
                                                    "type": "boolean"
                                                },
                                                "referral_code": {
                                                    "type": "string"
                                                },
                                                "limits": {
                                                    "type": "object",
                                                    "properties": {
                                                        "engines": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            },
                                                            "description": "AI assistants included."
                                                        },
                                                        "questions": {
                                                            "type": "integer"
                                                        },
                                                        "products": {
                                                            "type": "integer"
                                                        },
                                                        "customers": {
                                                            "type": "integer"
                                                        },
                                                        "cells": {
                                                            "type": "integer"
                                                        },
                                                        "changes_per_month": {
                                                            "type": "integer"
                                                        },
                                                        "run_frequencies": {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "discovered_limit": {
                                                            "type": "integer"
                                                        },
                                                        "citations_full": {
                                                            "type": "boolean"
                                                        },
                                                        "all_runs": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "description": "Limits of the account's plan."
                                                },
                                                "brand": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "domain": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "Site domain."
                                                        },
                                                        "initial": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "domain",
                                                        "initial"
                                                    ]
                                                },
                                                "gaps_count": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "last_run": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "kind": {
                                                            "type": "string"
                                                        },
                                                        "status": {
                                                            "type": "string",
                                                            "description": "Current status."
                                                        },
                                                        "engines": {
                                                            "type": "array",
                                                            "items": {},
                                                            "description": "AI assistants included."
                                                        },
                                                        "started_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "When it started (ISO 8601)."
                                                        },
                                                        "finished_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ],
                                                            "description": "When it finished (ISO 8601)."
                                                        },
                                                        "done": {
                                                            "type": "integer"
                                                        },
                                                        "total": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "kind",
                                                        "status",
                                                        "engines",
                                                        "started_at",
                                                        "finished_at",
                                                        "done",
                                                        "total"
                                                    ]
                                                },
                                                "next_run_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "run_frequency": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "R1 plan widget: the schedule the user chose in S4 (the plan's allowed value, as RunService schedules it).",
                                                    "enum": [
                                                        "weekly",
                                                        "monthly",
                                                        null
                                                    ]
                                                },
                                                "queue": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {}
                                                },
                                                "notify_requested": {
                                                    "type": "boolean",
                                                    "description": "Sidebar plan widget «On the Pro list»: «Notify me» pressed (C2 or /signup?notify=pro) and not answered yet."
                                                },
                                                "run_issue": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "description": "The latest run failed: automatic retry state for the app shell banner (RunService::issue; null otherwise).",
                                                    "properties": {
                                                        "state": {
                                                            "type": "string",
                                                            "enum": [
                                                                "retrying",
                                                                "stopped"
                                                            ]
                                                        },
                                                        "attempts": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "max_retries": {
                                                            "type": "integer",
                                                            "const": 3
                                                        },
                                                        "has_report": {
                                                            "type": "boolean"
                                                        },
                                                        "next_retry_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "next_run_at": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "message": {
                                                            "type": "string",
                                                            "description": "Human-readable message in the request language."
                                                        }
                                                    },
                                                    "required": [
                                                        "state",
                                                        "attempts",
                                                        "max_retries",
                                                        "has_report",
                                                        "next_retry_at",
                                                        "next_run_at",
                                                        "message"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "email",
                                                "phone",
                                                "phone_verified",
                                                "sms_notifications",
                                                "name",
                                                "locale",
                                                "plan",
                                                "billing_period",
                                                "plan_expires_at",
                                                "onboarding_step",
                                                "onboarding_completed",
                                                "referral_code",
                                                "limits",
                                                "brand",
                                                "gaps_count",
                                                "last_run",
                                                "next_run_at",
                                                "run_frequency",
                                                "queue",
                                                "notify_requested",
                                                "run_issue"
                                            ]
                                        },
                                        "new_account": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "token",
                                        "user",
                                        "new_account"
                                    ]
                                },
                                "example": {
                                    "token": "15|0so4SUgNHqSvPb89wYfuxDEtvOlEOvFK5LSDrV8Kac3dfe31",
                                    "user": {
                                        "id": 1,
                                        "email": "demo@rawi.local",
                                        "phone": "+989120000077",
                                        "phone_verified": true,
                                        "sms_notifications": true,
                                        "name": "عرفان",
                                        "locale": "fa",
                                        "plan": "free",
                                        "billing_period": null,
                                        "plan_expires_at": null,
                                        "onboarding_step": 9,
                                        "onboarding_completed": true,
                                        "referral_code": "wth1ftkn",
                                        "limits": {
                                            "engines": [
                                                "chatgpt"
                                            ],
                                            "questions": 10,
                                            "products": 1,
                                            "customers": 1,
                                            "cells": 1,
                                            "changes_per_month": 2,
                                            "run_frequencies": [
                                                "monthly"
                                            ],
                                            "discovered_limit": 10,
                                            "citations_full": false,
                                            "all_runs": false
                                        },
                                        "brand": {
                                            "id": 40,
                                            "name": "آوند",
                                            "domain": "avand.example",
                                            "initial": "آ"
                                        },
                                        "gaps_count": 2,
                                        "last_run": {
                                            "id": 38,
                                            "kind": "scheduled",
                                            "status": "complete",
                                            "engines": [
                                                "chatgpt"
                                            ],
                                            "started_at": "2026-11-25T10:16:00Z",
                                            "finished_at": "2026-11-25T10:30:00Z",
                                            "done": 10,
                                            "total": 10
                                        },
                                        "next_run_at": "2026-12-25T10:30:00Z",
                                        "queue": null,
                                        "run_frequency": "monthly"
                                    },
                                    "new_account": false
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Wrong, expired or used code, or more than 10 wrong tries per address+IP in 10 min: `errors.code`; `errors.phone` invalid number",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Route throttle 30 req/min/IP",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Verify code (get user token)",
                "description": "Checks the code and returns a user token. Email: signs in or creates the user. Phone: signs in the user whose **verified** phone matches, or creates a phone-only user (`email: null`, `signup_method: phone`); a phone that is saved but not verified on an email account never signs in to that account (security rule). New users start on plan `free`, `onboarding_step` 2; `ref` records the referral. Fires `signup_completed` or `login`. `new_account: true` when this call created the account: after a new phone account, the app shows a one-time notice on the next screen (\"sign in with email and verify this phone in Settings → Account & billing\").",
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "x-rawi-access-note": "Public — no token",
                "x-rawi-screen": "O1",
                "x-rawi-throttle": "30/1min",
                "security": [],
                "x-postman": {
                    "name": "Verify code (get user token)",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/billing/checkout": {
            "post": {
                "operationId": "post-billing-checkout",
                "tags": [
                    "Billing & payment gateway"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "period": {
                                        "type": "string",
                                        "maxLength": 12,
                                        "description": "active period key"
                                    },
                                    "code": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 40,
                                        "description": "must be valid if given"
                                    },
                                    "gateway_id": {
                                        "type": "integer",
                                        "description": "a gateway from `GET /billing/gateways` for this user"
                                    },
                                    "auto_renew": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "«Renew automatically»: only with a gateway whose `supports_auto_renew` is true (Stripe)"
                                    }
                                },
                                "required": [
                                    "period",
                                    "gateway_id"
                                ]
                            },
                            "x-rawi-template": "{\n  \"period\": \"quarterly\",\n  \"code\": \"FOUNDERS30\",\n  \"gateway_id\": {{gatewayId}}\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Checkout (start payment)",
                                    "value": {
                                        "period": "quarterly",
                                        "code": "FOUNDERS30",
                                        "gateway_id": 1
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "period": "quarterly",
                                        "code": "FOUNDERS30",
                                        "gateway_id": 1
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "{payment_id, redirect_url}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "payment_id": {
                                            "type": "integer"
                                        },
                                        "redirect_url": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "payment_id",
                                        "redirect_url"
                                    ]
                                },
                                "example": {
                                    "payment_id": 31,
                                    "redirect_url": "http://127.0.0.1:8010/pay/mock/31?expires=1764064424&signature=3f6c…"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed: `gateway_id` «این درگاه فعال نیست.» (not in the caller's usable gateways: off, not in the caller's currency, no driver, other panel language, or a live gateway for a test account) or gateway error; `code` invalid or used up for this account; `period`; `auto_renew` (gateway without automatic renewal, or a subscription that still renews)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Throttle 10 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Checkout (start payment)",
                "description": "Creates a `pending` payment from the quote and returns the gateway URL. With the mock gateway the URL is a signed page on the API host (`/pay/mock/{payment}`) whose buttons hit `/pay/callback/{payment}` and redirect to `{FRONTEND_URL}/app/checkout/result?payment={id}`. Fires `checkout_started`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C3",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Checkout (start payment)",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/gateways": {
            "get": {
                "operationId": "get-billing-gateways",
                "summary": "Gateways the user can pay with",
                "tags": [
                    "Billing & payment gateway"
                ],
                "responses": {
                    "200": {
                        "description": "Gateway[]",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "description": "Unique ID."
                                            },
                                            "name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "description": {
                                                "anyOf": [
                                                    {
                                                        "type": "string"
                                                    },
                                                    {
                                                        "type": "string",
                                                        "enum": [
                                                            ""
                                                        ]
                                                    }
                                                ]
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                            },
                                            "provider": {
                                                "type": "string"
                                            },
                                            "supports_auto_renew": {
                                                "type": "boolean",
                                                "description": "«Renew automatically» (Stripe subscription) can be chosen with this gateway."
                                            }
                                        },
                                        "required": [
                                            "id",
                                            "name",
                                            "description",
                                            "currency",
                                            "provider",
                                            "supports_auto_renew"
                                        ]
                                    }
                                },
                                "example": [
                                    {
                                        "id": 1,
                                        "name": "درگاه بانکی (آزمایشی)",
                                        "description": "پرداخت با کارت‌های بانکی عضو شتاب.",
                                        "currency": "IRT",
                                        "provider": "zarinpal",
                                        "supports_auto_renew": false
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "description": "Only gateways usable for a payment by the caller (`PricingService::usableGateways`) **in the caller's currency** (see\n`GET /billing/plans`): switched on in the admin panel, provider with a payment driver (`mock`, `zarinpal`, `stripe`) charging a\ncurrency it supports that has a price, `show_for` equal to the user's panel language\n(`locale`; for `fa` also gateways without `show_for`), and for test accounts only `mode: test` gateways. Sorted by\n`position`. `name` is `name_en` when the request language is `en` and `name_en` is set.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C3",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Enabled gateways",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/notify-me": {
            "post": {
                "operationId": "post-billing-notify-me",
                "summary": "Notify me when online payment is available",
                "tags": [
                    "Billing & payment gateway"
                ],
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "description": "Records interest (`payment_notify_requested`) when no gateway is enabled. As soon as an online (Toman) gateway the user can pay with is enabled — when an admin switches one on, or at the next `rawi:notify-payment-available` run (every 15 minutes) — the user gets the email email once (the `payment_available` SMS for phone-only accounts). email is transactional: the user asked for it, so the Reminders / SMS notification toggles do not block it. Idempotent: pressing it again before the notice is not logged twice (the app calls it after `/signup?notify=pro`). The answer is marked with a `payment_notify_sent` event; asking again later queues a new notice.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C2",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Notify me when online payment is available",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/payments": {
            "get": {
                "operationId": "get-billing-payments",
                "tags": [
                    "Billing & payment gateway"
                ],
                "responses": {
                    "200": {
                        "description": "Payment[]",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "description": "Unique ID."
                                            },
                                            "period": {
                                                "type": "string"
                                            },
                                            "status": {
                                                "type": "string",
                                                "description": "Current status."
                                            },
                                            "base_amount": {
                                                "type": "integer"
                                            },
                                            "period_discount": {
                                                "type": "integer"
                                            },
                                            "code_discount": {
                                                "type": "integer"
                                            },
                                            "vat": {
                                                "type": "integer"
                                            },
                                            "total": {
                                                "type": "integer"
                                            },
                                            "currency": {
                                                "type": "string",
                                                "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                            },
                                            "tracking_code": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "gateway_message": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "gateway_name": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "period_start": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "period_end": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "paid_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "created_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "When it was created (ISO 8601)."
                                            },
                                            "auto_renew": {
                                                "type": "boolean"
                                            },
                                            "renewal_amount": {
                                                "type": [
                                                    "integer",
                                                    "null"
                                                ],
                                                "description": "«Renew automatically» (Stripe subscription)"
                                            },
                                            "amount_refunded": {
                                                "type": "integer",
                                                "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                            },
                                            "refunded_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "id",
                                            "period",
                                            "status",
                                            "base_amount",
                                            "period_discount",
                                            "code_discount",
                                            "vat",
                                            "total",
                                            "currency",
                                            "tracking_code",
                                            "gateway_message",
                                            "gateway_name",
                                            "period_start",
                                            "period_end",
                                            "paid_at",
                                            "created_at",
                                            "auto_renew",
                                            "renewal_amount",
                                            "amount_refunded",
                                            "refunded_at"
                                        ]
                                    }
                                },
                                "example": [
                                    {
                                        "id": 19,
                                        "period": "quarterly",
                                        "status": "success",
                                        "base_amount": 5400000,
                                        "period_discount": 540000,
                                        "code_discount": 1458000,
                                        "vat": 340200,
                                        "total": 3742200,
                                        "currency": "IRT",
                                        "tracking_code": "427999304",
                                        "gateway_message": null,
                                        "gateway_name": "درگاه بانکی (آزمایشی)",
                                        "period_start": "2026-10-25T00:00:00Z",
                                        "period_end": "2027-01-25T00:00:00Z",
                                        "paid_at": "2026-10-25T11:42:00Z",
                                        "created_at": "2026-10-25T11:42:00Z"
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "List own payments",
                "description": "All payments of the caller (any status), newest first.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C3, S5",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "List own payments",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/payments/{id}": {
            "get": {
                "operationId": "get-billing-payments-id",
                "tags": [
                    "Billing & payment gateway"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Postman variable `{{paymentId}}`",
                        "x-rawi-variable": "paymentId"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Payment",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "period": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "Current status."
                                        },
                                        "base_amount": {
                                            "type": "integer"
                                        },
                                        "period_discount": {
                                            "type": "integer"
                                        },
                                        "code_discount": {
                                            "type": "integer"
                                        },
                                        "vat": {
                                            "type": "integer"
                                        },
                                        "total": {
                                            "type": "integer"
                                        },
                                        "currency": {
                                            "type": "string",
                                            "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                        },
                                        "tracking_code": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "gateway_message": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "gateway_name": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "period_start": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "period_end": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "paid_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "created_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "When it was created (ISO 8601)."
                                        },
                                        "auto_renew": {
                                            "type": "boolean"
                                        },
                                        "renewal_amount": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "«Renew automatically» (Stripe subscription)"
                                        },
                                        "amount_refunded": {
                                            "type": "integer",
                                            "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                        },
                                        "refunded_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "period",
                                        "status",
                                        "base_amount",
                                        "period_discount",
                                        "code_discount",
                                        "vat",
                                        "total",
                                        "currency",
                                        "tracking_code",
                                        "gateway_message",
                                        "gateway_name",
                                        "period_start",
                                        "period_end",
                                        "paid_at",
                                        "created_at",
                                        "auto_renew",
                                        "renewal_amount",
                                        "amount_refunded",
                                        "refunded_at"
                                    ]
                                },
                                "example": {
                                    "id": 19,
                                    "period": "quarterly",
                                    "status": "success",
                                    "base_amount": 5400000,
                                    "period_discount": 540000,
                                    "code_discount": 1458000,
                                    "vat": 340200,
                                    "total": 3742200,
                                    "currency": "IRT",
                                    "tracking_code": "427999304",
                                    "gateway_message": null,
                                    "gateway_name": "درگاه بانکی (آزمایشی)",
                                    "period_start": "2026-10-25T00:00:00Z",
                                    "period_end": "2027-01-25T00:00:00Z",
                                    "paid_at": "2026-10-25T11:42:00Z",
                                    "created_at": "2026-10-25T11:42:00Z"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown id (or not owned by the caller)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Get payment (result page)",
                "description": "Status of one own payment for `/app/checkout/result?payment=` (success → receipt; failed → «پرداخت ناموفق», retry, account stays free). In Postman run «Checkout» or «List own payments» first so `{{paymentId}}` is set (the demo account has no payments; an empty id would hit the list route).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C3 result",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Get payment (result page)",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/plans": {
            "get": {
                "operationId": "get-billing-plans",
                "tags": [
                    "Billing & payment gateway"
                ],
                "responses": {
                    "200": {
                        "description": "PlansResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {}
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Plans & periods",
                "description": "Same data as `/public/plans` for signed-in users, except `online_payment_available`: here it is `true` only when the caller\nhas at least one usable gateway (the list `GET /billing/gateways` returns is not empty). `currency` is the caller's\ncurrency: `default_currency` when one of the caller's usable gateways takes it, otherwise the first usable gateway's\ncurrency. Example for an international user: `{\"currency\":\"USD\",\"monthly_price\":6000,\"vat_percent\":0,\"periods\":[…{\"key\":\"quarterly\",\"price\":16200,…}]}`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C2",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Plans & periods",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/quote": {
            "post": {
                "operationId": "post-billing-quote",
                "tags": [
                    "Billing & payment gateway"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "period": {
                                        "type": "string",
                                        "maxLength": 12,
                                        "description": "active period key: `monthly` | `quarterly` | `yearly`"
                                    },
                                    "code": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 40,
                                        "description": "max 40"
                                    }
                                },
                                "required": [
                                    "period"
                                ]
                            },
                            "x-rawi-template": "{\n  \"period\": \"quarterly\",\n  \"code\": \"FOUNDERS30\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Quote (period + code)",
                                    "value": {
                                        "period": "quarterly",
                                        "code": "FOUNDERS30"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "period": "quarterly",
                                        "code": "FOUNDERS30"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Quote",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "period": {
                                            "type": "string"
                                        },
                                        "currency": {
                                            "type": "string",
                                            "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                        },
                                        "base_amount": {
                                            "type": "integer"
                                        },
                                        "period_discount": {
                                            "type": "integer"
                                        },
                                        "code_discount": {
                                            "type": "integer"
                                        },
                                        "subtotal": {
                                            "type": "integer"
                                        },
                                        "vat": {
                                            "type": "integer"
                                        },
                                        "total": {
                                            "type": "integer"
                                        },
                                        "code": {
                                            "type": "string",
                                            "description": "Machine-readable code."
                                        },
                                        "code_valid": {
                                            "type": "boolean"
                                        },
                                        "code_message": {
                                            "type": "string"
                                        },
                                        "period_start": {
                                            "type": "string"
                                        },
                                        "period_end": {
                                            "type": "string"
                                        }
                                    }
                                },
                                "example": {
                                    "period": "quarterly",
                                    "currency": "IRT",
                                    "base_amount": 5400000,
                                    "period_discount": 540000,
                                    "code_discount": 1260000,
                                    "subtotal": 3600000,
                                    "vat": 360000,
                                    "total": 3960000,
                                    "code": "FOUNDERS30",
                                    "code_valid": true,
                                    "code_message": "با این کد، پرداخت اول ۳۰ درصد تخفیف دارد. از تمدید بعدی، مبلغ بدون کد حساب می‌شود.",
                                    "period_start": "2026-11-25T09:53:44Z",
                                    "period_end": "2027-02-25T09:53:44Z"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`period` not active)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Throttle 30 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Quote (period + code)",
                "description": "Price breakdown for a period and optional discount code, in the caller's currency (`currency` field, amounts in its minor\nunit). An invalid code is not an error: `code_valid:false` + `code_message`. A fixed-amount code (`amount_off`) in another\ncurrency → `code_valid:false`, «این کد برای پرداخت با این واحد پول نیست.» (\"This code is not valid for payments in this\ncurrency.\"); percent codes work in every currency.\n\nThe code's `duration` is counted **per account** (successful and refunded payments of the caller with this code):\n\n| `duration` | Per account | `code_message` when valid (fa) |\n|---|---|---|\n| `first_payment` | once | «با این کد، پرداخت اول {percent} درصد تخفیف دارد. از تمدید بعدی، مبلغ بدون کد حساب می‌شود.» |\n| `first_n` | the first `duration_n` payments | «این کد روی {n} پرداخت اول هر حساب {percent} درصد تخفیف دارد؛ {left} پرداخت با این کد برای شما مانده است.» |\n| `forever` | every payment with the code | «با این کد، این پرداخت و هر تمدیدی که با همین کد بپردازید {percent} درصد تخفیف دارد.» |\n\nA code this account has used up → `code_valid:false`, `code_message` «این حساب سهم خود از این کد را استفاده کرده است.»\n(\"This account has already used its share of this code.\"). `max_uses` counts successful and refunded payments with the\ncode by customer accounts (test accounts, team accounts and the admin panel test payments are not counted); an account that already\nused the code (`first_n`, `forever`) is not blocked by `max_uses`. Reached cap → «ظرفیت استفاده از این کد پر شده است.»\n\nWithout a code, a user who signed up with an invite link and has no successful payment gets the referral first-payment\ndiscount (`referral_discount_percent`) only while `referral_gift_enabled` is on; `code_message` then reads\n«چون با لینک دعوت آمده‌اید، پرداخت اول {percent} درصد تخفیف دارد.»",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C2, C3",
                "x-rawi-throttle": "30/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Quote (period + code)",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/subscription/cancel": {
            "post": {
                "operationId": "post-billing-subscription-cancel",
                "summary": "Cancel automatic renewal",
                "tags": [
                    "Billing & payment gateway"
                ],
                "responses": {
                    "200": {
                        "description": "AccountSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "email_notifications": {
                                            "type": "object",
                                            "properties": {
                                                "reminders": {
                                                    "type": "boolean"
                                                },
                                                "report_ready": {
                                                    "type": "boolean"
                                                },
                                                "renewal": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "reminders",
                                                "report_ready",
                                                "renewal"
                                            ]
                                        },
                                        "plan": {
                                            "type": "string",
                                            "description": "S5: reminders, report_ready, renewal",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ]
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "renewal": {
                                            "type": "object",
                                            "description": "Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription).",
                                            "properties": {
                                                "auto": {
                                                    "type": "boolean"
                                                },
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Current status."
                                                },
                                                "can_cancel": {
                                                    "type": "boolean",
                                                    "description": "active | past_due | cancel_at_period_end | none"
                                                },
                                                "can_resume": {
                                                    "type": "boolean"
                                                },
                                                "renews_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ends_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "auto",
                                                "status",
                                                "can_cancel",
                                                "can_resume",
                                                "renews_at",
                                                "ends_at"
                                            ]
                                        },
                                        "brand_names": {
                                            "type": "array",
                                            "description": "«Delete account» accepts any of these (or the email) as the typed confirmation.",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "email",
                                        "phone",
                                        "sms_notifications",
                                        "email_notifications",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "payments",
                                        "renewal",
                                        "brand_names"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "No subscription that still renews: `{\"message\":\"…\",\"code\":\"no_subscription\"}`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ConfirmRequired"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Stripe refused: `{\"message\":\"…\",\"code\":\"gateway_error\"}`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Throttle 10 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "description": "Sets `cancel_at_period_end` on the Stripe subscription: nothing more is charged and the paid period runs to its end\n(`renewal.ends_at`). Returns `AccountSettings` (see `GET /settings/account`).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — paid users with a Stripe subscription",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Cancel automatic renewal",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/subscription/resume": {
            "post": {
                "operationId": "post-billing-subscription-resume",
                "summary": "Resume automatic renewal",
                "tags": [
                    "Billing & payment gateway"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "email_notifications": {
                                            "type": "object",
                                            "properties": {
                                                "reminders": {
                                                    "type": "boolean"
                                                },
                                                "report_ready": {
                                                    "type": "boolean"
                                                },
                                                "renewal": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "reminders",
                                                "report_ready",
                                                "renewal"
                                            ]
                                        },
                                        "plan": {
                                            "type": "string",
                                            "description": "S5: reminders, report_ready, renewal",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ]
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "renewal": {
                                            "type": "object",
                                            "description": "Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription).",
                                            "properties": {
                                                "auto": {
                                                    "type": "boolean"
                                                },
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Current status."
                                                },
                                                "can_cancel": {
                                                    "type": "boolean",
                                                    "description": "active | past_due | cancel_at_period_end | none"
                                                },
                                                "can_resume": {
                                                    "type": "boolean"
                                                },
                                                "renews_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ends_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "auto",
                                                "status",
                                                "can_cancel",
                                                "can_resume",
                                                "renews_at",
                                                "ends_at"
                                            ]
                                        },
                                        "brand_names": {
                                            "type": "array",
                                            "description": "«Delete account» accepts any of these (or the email) as the typed confirmation.",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "email",
                                        "phone",
                                        "sms_notifications",
                                        "email_notifications",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "payments",
                                        "renewal",
                                        "brand_names"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthenticated"
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                },
                "description": "Undoes a cancel before the period ends (`cancel_at_period_end=false`). Returns `AccountSettings` (`renewal.status: active`).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — paid users with a cancelled-at-period-end subscription",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Resume automatic renewal",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/billing/webhooks/stripe": {
            "post": {
                "operationId": "post-billing-webhooks-stripe",
                "tags": [
                    "Billing & payment gateway"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "received": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "received"
                                    ]
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "const": "Invalid signature",
                                            "description": "Human-readable message in the request language."
                                        },
                                        "code": {
                                            "type": "string",
                                            "const": "invalid_signature",
                                            "description": "Machine-readable code."
                                        }
                                    },
                                    "required": [
                                        "message",
                                        "code"
                                    ]
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "More than 120 requests a minute",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Stripe webhook",
                "description": "Stripe calls this with events; set it in the Stripe dashboard (Developers › Webhooks) with the event\n`checkout.session.completed`. The URL to copy is shown on the admin Stripe gateway page (`webhook_url`):\n`{APP_URL}/api/billing/webhooks/stripe`.\n\n- The raw body is verified against the `Stripe-Signature` header (`t=…,v1=…`): HMAC-SHA256 of `\"{t}.{body}\"` with the\n  webhook signing secret of a Stripe gateway, and `t` within 5 minutes of now.\n- `checkout.session.completed` (and `checkout.session.async_payment_succeeded`) with `payment_status: \"paid\"`: the\n  session must match the payment in `metadata.payment_id` (session id, amount, currency); the payment is then completed\n  like a successful return (plan, email, referral), or, for an the admin panel test payment, verified and refunded. Idempotent: a replayed\n  event or one that arrives after the customer's return changes nothing and sends no second receipt.\n- `checkout.session.expired` / `checkout.session.async_payment_failed`: a still-pending payment is marked failed.\n- Automatic renewal (subscribe the endpoint to these too): `invoice.paid` with a renewal `billing_reason` (not\n  `subscription_create`, which is the checkout payment) records a payment in the invoice's currency and `amount_paid`\n  (`authority` = invoice id, tracking code = its PaymentIntent) and extends the plan by one period from the current end\n  (email receipt); idempotent per invoice. `invoice.payment_failed` sets `subscription_status: past_due` and sends email.\n  `customer.subscription.updated` / `customer.subscription.deleted` keep `subscription_status` in step\n  (`cancel_at_period_end`, `canceled` = stops renewing). The subscription is found by `users.stripe_subscription_id`\n  (`invoice.subscription`, or `invoice.parent.subscription_details.subscription` on newer API versions). A subscription\n  that still renews keeps the plan for `RENEWAL_GRACE_DAYS` (3) after `plan_expires_at` while its invoice is pending.\n- Other events, unknown payments and sessions that do not match are acknowledged and ignored.\n\n**Request** — a Stripe `Event` object (raw JSON body), e.g.",
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "x-rawi-access-note": "**Public** (no token, no CSRF)",
                "x-rawi-throttle": "120/1min",
                "security": [],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "x-rawi-template": "{\n    \"id\": \"evt_test_1\",\n    \"type\": \"checkout.session.completed\",\n    \"data\": {\n        \"object\": {\n            \"id\": \"cs_test_a1\",\n            \"payment_status\": \"paid\",\n            \"amount_total\": 16200,\n            \"currency\": \"usd\",\n            \"client_reference_id\": \"{{paymentId}}\",\n            \"metadata\": {\n                \"payment_id\": \"{{paymentId}}\"\n            },\n            \"payment_intent\": \"pi_test_1\"\n        }\n    }\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Stripe webhook (public, signed by Stripe)",
                                    "value": {
                                        "id": "evt_test_1",
                                        "type": "checkout.session.completed",
                                        "data": {
                                            "object": {
                                                "id": "cs_test_a1",
                                                "payment_status": "paid",
                                                "amount_total": 16200,
                                                "currency": "usd",
                                                "client_reference_id": "",
                                                "metadata": {
                                                    "payment_id": ""
                                                },
                                                "payment_intent": "pi_test_1"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "x-postman": {
                    "name": "Stripe webhook (public, signed by Stripe)",
                    "folder": "07 Billing & payment gateway (C2, C3)"
                }
            }
        },
        "/competitors/discovered": {
            "post": {
                "operationId": "post-competitors-discovered",
                "tags": [
                    "Scans & reports"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 120
                                    },
                                    "domain": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 190,
                                        "description": "max 190"
                                    },
                                    "replace_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            },
                            "x-rawi-template": "{\n  \"name\": \"حساب‌یار\",\n  \"domain\": \"hesabyar.example\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: R1 Add discovered brand to competitors",
                                    "value": {
                                        "name": "حساب‌یار",
                                        "domain": "hesabyar.example"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "name": "حساب‌یار",
                                        "domain": "hesabyar.example"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Competitor\n\nThe demo account already has 5 competitors, so this returns 422 «حداکثر ۵ رقیب» until one is removed in S1.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "domain": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Site domain."
                                        },
                                        "position": {
                                            "type": "integer"
                                        },
                                        "source": {
                                            "type": "string"
                                        },
                                        "replaced_id": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "name",
                                        "domain",
                                        "position",
                                        "source",
                                        "replaced_id"
                                    ]
                                },
                                "example": {
                                    "id": 168,
                                    "name": "حساب‌یار",
                                    "domain": "hesabyar.example",
                                    "position": 6,
                                    "source": "discovered"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`name` — already a competitor, or already 5 competitors)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Add discovered brand to competitors",
                "description": "Turns a discovered brand into a tracked competitor (source `discovered`); its past mentions are re-labelled as competitor mentions.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R1 «افزودن به رقبا»",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "R1 Add discovered brand to competitors",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/consultations": {
            "get": {
                "operationId": "get-consultations",
                "summary": "List own expert requests",
                "tags": [
                    "Talk to an expert"
                ],
                "responses": {
                    "200": {
                        "description": "ConsultationRequest[]",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "description": "Unique ID."
                                            },
                                            "name": {
                                                "type": "string"
                                            },
                                            "phone": {
                                                "type": "string",
                                                "description": "Mobile number."
                                            },
                                            "method": {
                                                "type": "string"
                                            },
                                            "time_slot": {
                                                "type": "string"
                                            },
                                            "preferred_days": {
                                                "type": "array",
                                                "items": {}
                                            },
                                            "note": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "source_page": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "status": {
                                                "type": "string",
                                                "description": "Current status."
                                            },
                                            "due_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            },
                                            "snapshot": {
                                                "type": "object",
                                                "properties": {
                                                    "brand": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "plan": {
                                                        "anyOf": [
                                                            {
                                                                "type": "string"
                                                            },
                                                            {
                                                                "type": "string",
                                                                "enum": [
                                                                    "free"
                                                                ]
                                                            }
                                                        ],
                                                        "description": "Plan: `free` (Free) or `paid` (Pro)."
                                                    },
                                                    "share": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gaps": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Missed questions: AI named a competitor and not you."
                                                    },
                                                    "last_run_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "source_page": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "brand",
                                                    "plan",
                                                    "share",
                                                    "gaps",
                                                    "last_run_at",
                                                    "source_page"
                                                ]
                                            },
                                            "created_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "When it was created (ISO 8601)."
                                            }
                                        },
                                        "required": [
                                            "id",
                                            "name",
                                            "phone",
                                            "method",
                                            "time_slot",
                                            "preferred_days",
                                            "note",
                                            "source_page",
                                            "status",
                                            "due_at",
                                            "snapshot",
                                            "created_at"
                                        ]
                                    }
                                },
                                "example": [
                                    {
                                        "id": 23,
                                        "name": "نسرین کاظمی",
                                        "phone": "09123456789",
                                        "method": "phone",
                                        "time_slot": "morning",
                                        "note": null,
                                        "source_page": "r2",
                                        "status": "new",
                                        "due_at": "2026-11-29T16:20:00Z",
                                        "snapshot": {
                                            "brand": "آوند",
                                            "plan": "free",
                                            "share": null,
                                            "gaps": null,
                                            "last_run_at": null,
                                            "source_page": "r2"
                                        },
                                        "created_at": "2026-11-24T16:20:00Z"
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "description": "The caller's own requests, newest first (up to 50). View only; a request can still be changed with `PATCH /consultations/{id}` while its status is `new`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C1 «درخواست‌های من»",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "List own consultation requests",
                    "folder": "06 Consultation (C1)"
                }
            },
            "post": {
                "operationId": "post-consultations",
                "tags": [
                    "Talk to an expert"
                ],
                "responses": {
                    "201": {
                        "description": "ConsultationRequest",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "phone": {
                                            "type": "string",
                                            "description": "Mobile number."
                                        },
                                        "method": {
                                            "type": "string"
                                        },
                                        "time_slot": {
                                            "type": "string"
                                        },
                                        "preferred_days": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "note": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "source_page": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "Current status."
                                        },
                                        "due_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "snapshot": {
                                            "type": "object",
                                            "properties": {
                                                "brand": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "plan": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "string",
                                                            "enum": [
                                                                "free"
                                                            ]
                                                        }
                                                    ],
                                                    "description": "Plan: `free` (Free) or `paid` (Pro)."
                                                },
                                                "share": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "gaps": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Missed questions: AI named a competitor and not you."
                                                },
                                                "last_run_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "source_page": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "brand",
                                                "plan",
                                                "share",
                                                "gaps",
                                                "last_run_at",
                                                "source_page"
                                            ]
                                        },
                                        "created_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "When it was created (ISO 8601)."
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "name",
                                        "phone",
                                        "method",
                                        "time_slot",
                                        "preferred_days",
                                        "note",
                                        "source_page",
                                        "status",
                                        "due_at",
                                        "snapshot",
                                        "created_at"
                                    ]
                                },
                                "example": {
                                    "id": 23,
                                    "name": "نسرین کاظمی",
                                    "phone": "09123456789",
                                    "method": "phone",
                                    "time_slot": "morning",
                                    "note": "می‌خواهم بدانم چرا نیک‌حساب در پرسش‌های مقایسه همیشه اول است و ما نیستیم.",
                                    "source_page": "r2",
                                    "status": "new",
                                    "due_at": "2026-11-29T16:20:00Z",
                                    "snapshot": {
                                        "brand": "آوند",
                                        "plan": "free",
                                        "share": null,
                                        "gaps": null,
                                        "last_run_at": null,
                                        "source_page": "r2"
                                    },
                                    "created_at": "2026-11-24T16:20:00Z"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "409": {
                        "$ref": "#/components/responses/ConfirmRequired"
                    },
                    "422": {
                        "description": "Validation failed (phone format, method, time_slot)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Throttle 10 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Submit expert request",
                "description": "Creates the request (status `new`, `due_at` = two Iranian working days later: Saturday–Wednesday, Tehran time), snapshots the account, sends email and fires `consultation_submitted`. The user gets the `consultation` SMS only when `phone` is the account's verified phone. Every active or invited super admin and consultant gets the admin email; admins with a mobile and «هشدار پیامکی» on also get the `admin_new_consultation` SMS.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C1",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "x-rawi-template": "{\n  \"name\": \"نسرین کاظمی\",\n  \"phone\": \"09123456789\",\n  \"method\": \"phone\",\n  \"time_slot\": \"morning\",\n  \"note\": \"می‌خواهم بدانم چرا نیک‌حساب در پرسش‌های مقایسه همیشه اول است و ما نیستیم.\",\n  \"source_page\": \"r2\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Submit consultation request",
                                    "value": {
                                        "name": "نسرین کاظمی",
                                        "phone": "09123456789",
                                        "method": "phone",
                                        "time_slot": "morning",
                                        "note": "می‌خواهم بدانم چرا نیک‌حساب در پرسش‌های مقایسه همیشه اول است و ما نیستیم.",
                                        "source_page": "r2"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "name": "نسرین کاظمی",
                                        "phone": "09123456789",
                                        "method": "phone",
                                        "time_slot": "morning",
                                        "note": "می‌خواهم بدانم چرا نیک‌حساب در پرسش‌های مقایسه همیشه اول است و ما نیستیم.",
                                        "source_page": "r2"
                                    }
                                }
                            }
                        }
                    }
                },
                "x-postman": {
                    "name": "Submit consultation request",
                    "folder": "06 Consultation (C1)"
                }
            }
        },
        "/consultations/prefill": {
            "get": {
                "operationId": "get-consultations-prefill",
                "tags": [
                    "Talk to an expert"
                ],
                "parameters": [
                    {
                        "name": "source_page",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "`r1` `r2` `r3` `r4` `r5` `o2` `settings` `other`",
                        "example": "r2"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "{name, phone, snapshot: ConsultationSnapshot, working_days, timezone}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "name": {
                                            "type": "string"
                                        },
                                        "phone": {
                                            "type": "string",
                                            "description": "Mobile number."
                                        },
                                        "snapshot": {
                                            "type": "object",
                                            "properties": {
                                                "brand": {
                                                    "type": "string"
                                                },
                                                "plan": {
                                                    "type": "string",
                                                    "description": "Plan: `free` (Free) or `paid` (Pro)."
                                                },
                                                "share": {
                                                    "type": "number"
                                                },
                                                "gaps": {
                                                    "type": "integer",
                                                    "description": "Missed questions: AI named a competitor and not you."
                                                },
                                                "last_run_at": {
                                                    "type": "string"
                                                },
                                                "source_page": {
                                                    "type": "string"
                                                }
                                            }
                                        },
                                        "working_days": {
                                            "description": "The C1 form's «روزهای …، به وقت …» line: working days (ISO weekdays, 1 = Monday) and the time zone.",
                                            "anyOf": [
                                                {
                                                    "type": "array"
                                                },
                                                {
                                                    "type": "array",
                                                    "prefixItems": [
                                                        {
                                                            "type": "integer",
                                                            "const": 1
                                                        },
                                                        {
                                                            "type": "integer",
                                                            "const": 2
                                                        },
                                                        {
                                                            "type": "integer",
                                                            "const": 3
                                                        },
                                                        {
                                                            "type": "integer",
                                                            "const": 4
                                                        },
                                                        {
                                                            "type": "integer",
                                                            "const": 5
                                                        }
                                                    ],
                                                    "minItems": 5,
                                                    "maxItems": 5
                                                }
                                            ]
                                        },
                                        "timezone": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "name",
                                        "phone",
                                        "snapshot",
                                        "working_days",
                                        "timezone"
                                    ]
                                },
                                "example": {
                                    "name": "عرفان",
                                    "phone": "09123456789",
                                    "snapshot": {
                                        "brand": "آوند",
                                        "plan": "free",
                                        "share": 18.8,
                                        "gaps": 2,
                                        "last_run_at": "2026-11-25T10:30:00Z",
                                        "source_page": "r2"
                                    },
                                    "working_days": [
                                        1,
                                        2,
                                        3,
                                        4,
                                        5
                                    ],
                                    "timezone": "UTC"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Prefill the expert request form",
                "description": "Name, last used phone and the account snapshot that is attached automatically. Fires `consultation_form_opened`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C1",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Prefill consultation form",
                    "folder": "06 Consultation (C1)"
                }
            }
        },
        "/consultations/{id}": {
            "get": {
                "operationId": "get-consultations-id",
                "tags": [
                    "Talk to an expert"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Postman variable `{{consultationId}}`",
                        "x-rawi-variable": "consultationId",
                        "example": 23
                    }
                ],
                "responses": {
                    "200": {
                        "description": "ConsultationRequest",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "phone": {
                                            "type": "string",
                                            "description": "Mobile number."
                                        },
                                        "method": {
                                            "type": "string"
                                        },
                                        "time_slot": {
                                            "type": "string"
                                        },
                                        "preferred_days": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "note": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "source_page": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "Current status."
                                        },
                                        "due_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "snapshot": {
                                            "type": "object",
                                            "properties": {
                                                "brand": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "plan": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "string",
                                                            "enum": [
                                                                "free"
                                                            ]
                                                        }
                                                    ],
                                                    "description": "Plan: `free` (Free) or `paid` (Pro)."
                                                },
                                                "share": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "gaps": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Missed questions: AI named a competitor and not you."
                                                },
                                                "last_run_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "source_page": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "brand",
                                                "plan",
                                                "share",
                                                "gaps",
                                                "last_run_at",
                                                "source_page"
                                            ]
                                        },
                                        "created_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "When it was created (ISO 8601)."
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "name",
                                        "phone",
                                        "method",
                                        "time_slot",
                                        "preferred_days",
                                        "note",
                                        "source_page",
                                        "status",
                                        "due_at",
                                        "snapshot",
                                        "created_at"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown id (or not owned by the caller)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Get own expert request",
                "description": "One of the caller's own requests.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C1 confirmation",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Get own consultation request",
                    "folder": "06 Consultation (C1)"
                }
            },
            "patch": {
                "operationId": "patch-consultations-id",
                "tags": [
                    "Talk to an expert"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Postman variable `{{consultationId}}`",
                        "x-rawi-variable": "consultationId",
                        "example": 23
                    }
                ],
                "responses": {
                    "200": {
                        "description": "ConsultationRequest",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "name": {
                                            "type": "string"
                                        },
                                        "phone": {
                                            "type": "string",
                                            "description": "Mobile number."
                                        },
                                        "method": {
                                            "type": "string"
                                        },
                                        "time_slot": {
                                            "type": "string"
                                        },
                                        "preferred_days": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "note": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "source_page": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "Current status."
                                        },
                                        "due_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "snapshot": {
                                            "type": "object",
                                            "properties": {
                                                "brand": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "plan": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "string",
                                                            "enum": [
                                                                "free"
                                                            ]
                                                        }
                                                    ],
                                                    "description": "Plan: `free` (Free) or `paid` (Pro)."
                                                },
                                                "share": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "gaps": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Missed questions: AI named a competitor and not you."
                                                },
                                                "last_run_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "source_page": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "brand",
                                                "plan",
                                                "share",
                                                "gaps",
                                                "last_run_at",
                                                "source_page"
                                            ]
                                        },
                                        "created_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "When it was created (ISO 8601)."
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "name",
                                        "phone",
                                        "method",
                                        "time_slot",
                                        "preferred_days",
                                        "note",
                                        "source_page",
                                        "status",
                                        "due_at",
                                        "snapshot",
                                        "created_at"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Already picked up by a consultant: `{\"code\":\"forbidden\"}`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown id (or not owned by the caller)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (as POST)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Edit expert request",
                "description": "Same body as create. Only while the request is still `new`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "C1 «ویرایش درخواست»",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "x-rawi-template": "{\n  \"name\": \"نسرین کاظمی\",\n  \"phone\": \"09123456789\",\n  \"method\": \"meet\",\n  \"time_slot\": \"evening\",\n  \"note\": \"ترجیح می‌دهم جلسه آنلاین باشد.\",\n  \"source_page\": \"r2\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Edit consultation request",
                                    "value": {
                                        "name": "نسرین کاظمی",
                                        "phone": "09123456789",
                                        "method": "meet",
                                        "time_slot": "evening",
                                        "note": "ترجیح می‌دهم جلسه آنلاین باشد.",
                                        "source_page": "r2"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "name": "نسرین کاظمی",
                                        "phone": "09123456789",
                                        "method": "meet",
                                        "time_slot": "evening",
                                        "note": "ترجیح می‌دهم جلسه آنلاین باشد.",
                                        "source_page": "r2"
                                    }
                                }
                            }
                        }
                    }
                },
                "x-postman": {
                    "name": "Edit consultation request",
                    "folder": "06 Consultation (C1)"
                }
            }
        },
        "/events": {
            "post": {
                "operationId": "post-events",
                "tags": [
                    "Analytics events"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "enum": [
                                            "report_viewed",
                                            "upgrade_page_opened"
                                        ],
                                        "maxLength": 60
                                    },
                                    "props": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "string"
                                        },
                                        "maxItems": 10,
                                        "description": "free JSON object"
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            },
                            "x-rawi-template": "{\n  \"name\": \"report_viewed\",\n  \"props\": {\n    \"page\": \"overview\"\n  }\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Track client event",
                                    "value": {
                                        "name": "report_viewed",
                                        "props": {
                                            "page": "overview"
                                        }
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "name": "report_viewed",
                                        "props": {
                                            "page": "overview"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "No content"
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (name)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                },
                "summary": "Track client event",
                "description": "Stores a client-side analytics event. The frontend sends `report_viewed` (props.page = overview|gaps|citations|questions|trend) and `upgrade_page_opened` (props.from). The first `report_viewed` also records `first_report_viewed`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "AppShell, C2",
                "x-rawi-throttle": "60/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Track client event",
                    "folder": "10 Analytics events (spec §10)"
                }
            }
        },
        "/industries": {
            "get": {
                "operationId": "get-industries",
                "tags": [
                    "Onboarding"
                ],
                "responses": {
                    "200": {
                        "description": "Industry[]",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "array"
                                        },
                                        {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "group": {
                                                        "type": "string"
                                                    },
                                                    "default_sales_model": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "group",
                                                    "default_sales_model"
                                                ]
                                            }
                                        }
                                    ]
                                },
                                "example": [
                                    {
                                        "id": 1,
                                        "name": "نرم‌افزار حسابداری و مالی",
                                        "group": "فناوری اطلاعات و نرم‌افزار",
                                        "default_sales_model": "b2b"
                                    },
                                    {
                                        "id": 84,
                                        "name": "آژانس مسافرتی",
                                        "group": "گردشگری و مهمان‌نوازی",
                                        "default_sales_model": "b2c"
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Search industries",
                "description": "Industry picker (group → industry). Empty `q` returns the most used industries first; otherwise name matches rank above group/keyword matches. Max 20.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O3",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "required": false,
                        "description": "search text (fa or en)",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "x-postman": {
                    "name": "Search industries",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/industries/groups": {
            "get": {
                "operationId": "get-industries-groups",
                "summary": "Industry groups",
                "tags": [
                    "Onboarding"
                ],
                "responses": {
                    "200": {
                        "description": "{name: string}[]",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "name": {
                                                "type": "string"
                                            }
                                        },
                                        "required": [
                                            "name"
                                        ]
                                    }
                                },
                                "example": [
                                    {
                                        "name": "فناوری اطلاعات و نرم‌افزار"
                                    },
                                    {
                                        "name": "خدمات حرفه‌ای و کسب‌وکار"
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "description": "Localized industry group names for the B2B customer card («به چه شرکت‌هایی می‌فروشید؟»).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O5",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Industry groups",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/me": {
            "get": {
                "operationId": "get-me",
                "tags": [
                    "Auth & profile"
                ],
                "responses": {
                    "200": {
                        "description": "Me",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "phone_verified": {
                                            "type": "boolean"
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "name": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "locale": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ],
                                            "description": "Language: `fa` or `en`."
                                        },
                                        "plan": {
                                            "type": "string",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ],
                                            "description": "Plan: `free` (Free) or `paid` (Pro)."
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "onboarding_step": {
                                            "type": "integer"
                                        },
                                        "onboarding_completed": {
                                            "type": "boolean"
                                        },
                                        "referral_code": {
                                            "type": "string"
                                        },
                                        "limits": {
                                            "type": "object",
                                            "properties": {
                                                "engines": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "AI assistants included."
                                                },
                                                "questions": {
                                                    "type": "integer"
                                                },
                                                "products": {
                                                    "type": "integer"
                                                },
                                                "customers": {
                                                    "type": "integer"
                                                },
                                                "cells": {
                                                    "type": "integer"
                                                },
                                                "changes_per_month": {
                                                    "type": "integer"
                                                },
                                                "run_frequencies": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "discovered_limit": {
                                                    "type": "integer"
                                                },
                                                "citations_full": {
                                                    "type": "boolean"
                                                },
                                                "all_runs": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "description": "Limits of the account's plan."
                                        },
                                        "brand": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "initial": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "domain",
                                                "initial"
                                            ]
                                        },
                                        "gaps_count": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "last_run": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "description": "Current status."
                                                },
                                                "engines": {
                                                    "type": "array",
                                                    "items": {},
                                                    "description": "AI assistants included."
                                                },
                                                "started_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it started (ISO 8601)."
                                                },
                                                "finished_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it finished (ISO 8601)."
                                                },
                                                "done": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "kind",
                                                "status",
                                                "engines",
                                                "started_at",
                                                "finished_at",
                                                "done",
                                                "total"
                                            ]
                                        },
                                        "next_run_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "run_frequency": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "R1 plan widget: the schedule the user chose in S4 (the plan's allowed value, as RunService schedules it).",
                                            "enum": [
                                                "weekly",
                                                "monthly",
                                                null
                                            ]
                                        },
                                        "queue": {
                                            "type": [
                                                "array",
                                                "null"
                                            ],
                                            "items": {}
                                        },
                                        "notify_requested": {
                                            "type": "boolean",
                                            "description": "Sidebar plan widget «On the Pro list»: «Notify me» pressed (C2 or /signup?notify=pro) and not answered yet."
                                        },
                                        "run_issue": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "description": "The latest run failed: automatic retry state for the app shell banner (RunService::issue; null otherwise).",
                                            "properties": {
                                                "state": {
                                                    "type": "string",
                                                    "enum": [
                                                        "retrying",
                                                        "stopped"
                                                    ]
                                                },
                                                "attempts": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "max_retries": {
                                                    "type": "integer",
                                                    "const": 3
                                                },
                                                "has_report": {
                                                    "type": "boolean"
                                                },
                                                "next_retry_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next_run_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "description": "Human-readable message in the request language."
                                                }
                                            },
                                            "required": [
                                                "state",
                                                "attempts",
                                                "max_retries",
                                                "has_report",
                                                "next_retry_at",
                                                "next_run_at",
                                                "message"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "email",
                                        "phone",
                                        "phone_verified",
                                        "sms_notifications",
                                        "name",
                                        "locale",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "onboarding_step",
                                        "onboarding_completed",
                                        "referral_code",
                                        "limits",
                                        "brand",
                                        "gaps_count",
                                        "last_run",
                                        "next_run_at",
                                        "run_frequency",
                                        "queue",
                                        "notify_requested",
                                        "run_issue"
                                    ]
                                },
                                "example": {
                                    "id": 1,
                                    "email": "demo@rawi.local",
                                    "phone": "+989120000077",
                                    "phone_verified": true,
                                    "sms_notifications": true,
                                    "name": "عرفان",
                                    "locale": "fa",
                                    "plan": "free",
                                    "billing_period": null,
                                    "plan_expires_at": null,
                                    "onboarding_step": 9,
                                    "onboarding_completed": true,
                                    "referral_code": "wth1ftkn",
                                    "limits": {
                                        "engines": [
                                            "chatgpt"
                                        ],
                                        "questions": 10,
                                        "products": 1,
                                        "customers": 1,
                                        "cells": 1,
                                        "changes_per_month": 2,
                                        "run_frequencies": [
                                            "monthly"
                                        ],
                                        "discovered_limit": 10,
                                        "citations_full": false,
                                        "all_runs": false
                                    },
                                    "brand": {
                                        "id": 40,
                                        "name": "آوند",
                                        "domain": "avand.example",
                                        "initial": "آ"
                                    },
                                    "gaps_count": 2,
                                    "last_run": {
                                        "id": 38,
                                        "kind": "scheduled",
                                        "status": "complete",
                                        "engines": [
                                            "chatgpt"
                                        ],
                                        "started_at": "2026-11-25T10:16:00Z",
                                        "finished_at": "2026-11-25T10:30:00Z",
                                        "done": 10,
                                        "total": 10
                                    },
                                    "next_run_at": "2026-12-25T10:30:00Z",
                                    "queue": null
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Get current user",
                "description": "Account (`email` may be null for phone-only accounts; `phone` = verified mobile in E.164 or null, `phone_verified`, `sms_notifications`), plan, limits, brand, last run, next run, `run_frequency` (the schedule chosen in the app: `weekly`|`monthly`, `monthly` when the plan does not allow weekly; null before a brand exists; shown in the sidebar plan widget), free-queue position and `notify_requested` (pressed «Notify me» for Pro and not told yet: the sidebar widget says “On the Pro list”). The frontend routes users by `onboarding_step` (2..8 = next O-step, 9 = finished).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "shell, all /app pages",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Get current user",
                    "folder": "01 Auth & profile (user)"
                }
            },
            "patch": {
                "operationId": "patch-me",
                "tags": [
                    "Auth & profile"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "locale": {
                                        "type": "string",
                                        "enum": [
                                            "fa",
                                            "en"
                                        ],
                                        "description": "`fa` | `en`"
                                    },
                                    "name": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 120
                                    }
                                }
                            },
                            "x-rawi-template": "{\n  \"locale\": \"fa\",\n  \"name\": \"عرفان\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Update profile",
                                    "value": {
                                        "locale": "fa",
                                        "name": "عرفان"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "locale": "fa",
                                        "name": "عرفان"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Me",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "phone_verified": {
                                            "type": "boolean"
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "name": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "locale": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ],
                                            "description": "Language: `fa` or `en`."
                                        },
                                        "plan": {
                                            "type": "string",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ],
                                            "description": "Plan: `free` (Free) or `paid` (Pro)."
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "onboarding_step": {
                                            "type": "integer"
                                        },
                                        "onboarding_completed": {
                                            "type": "boolean"
                                        },
                                        "referral_code": {
                                            "type": "string"
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "brand": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "initial": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "domain",
                                                "initial"
                                            ]
                                        },
                                        "gaps_count": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "last_run": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "description": "Current status."
                                                },
                                                "engines": {
                                                    "type": "array",
                                                    "items": {},
                                                    "description": "AI assistants included."
                                                },
                                                "started_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it started (ISO 8601)."
                                                },
                                                "finished_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it finished (ISO 8601)."
                                                },
                                                "done": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "kind",
                                                "status",
                                                "engines",
                                                "started_at",
                                                "finished_at",
                                                "done",
                                                "total"
                                            ]
                                        },
                                        "next_run_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "run_frequency": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "R1 plan widget: the schedule the user chose in S4 (the plan's allowed value, as RunService schedules it).",
                                            "enum": [
                                                "weekly",
                                                "monthly",
                                                null
                                            ]
                                        },
                                        "queue": {
                                            "type": [
                                                "array",
                                                "null"
                                            ],
                                            "items": {}
                                        },
                                        "notify_requested": {
                                            "type": "boolean",
                                            "description": "Sidebar plan widget «On the Pro list»: «Notify me» pressed (C2 or /signup?notify=pro) and not answered yet."
                                        },
                                        "run_issue": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "description": "The latest run failed: automatic retry state for the app shell banner (RunService::issue; null otherwise).",
                                            "properties": {
                                                "state": {
                                                    "type": "string",
                                                    "enum": [
                                                        "retrying",
                                                        "stopped"
                                                    ]
                                                },
                                                "attempts": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "max_retries": {
                                                    "type": "integer",
                                                    "const": 3
                                                },
                                                "has_report": {
                                                    "type": "boolean"
                                                },
                                                "next_retry_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "next_run_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "message": {
                                                    "type": "string",
                                                    "description": "Human-readable message in the request language."
                                                }
                                            },
                                            "required": [
                                                "state",
                                                "attempts",
                                                "max_retries",
                                                "has_report",
                                                "next_retry_at",
                                                "next_run_at",
                                                "message"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "email",
                                        "phone",
                                        "phone_verified",
                                        "sms_notifications",
                                        "name",
                                        "locale",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "onboarding_step",
                                        "onboarding_completed",
                                        "referral_code",
                                        "limits",
                                        "brand",
                                        "gaps_count",
                                        "last_run",
                                        "next_run_at",
                                        "run_frequency",
                                        "queue",
                                        "notify_requested",
                                        "run_issue"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (locale, name)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Update profile",
                "description": "Changes the panel language or the display name.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "language switcher",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Update profile",
                    "folder": "01 Auth & profile (user)"
                }
            }
        },
        "/onboarding": {
            "get": {
                "operationId": "get-onboarding",
                "tags": [
                    "Onboarding"
                ],
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "object",
                                            "properties": {
                                                "engines": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "AI assistants included."
                                                },
                                                "questions": {
                                                    "type": "integer"
                                                },
                                                "products": {
                                                    "type": "integer"
                                                },
                                                "customers": {
                                                    "type": "integer"
                                                },
                                                "cells": {
                                                    "type": "integer"
                                                },
                                                "changes_per_month": {
                                                    "type": "integer"
                                                },
                                                "run_frequencies": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "discovered_limit": {
                                                    "type": "integer"
                                                },
                                                "citations_full": {
                                                    "type": "boolean"
                                                },
                                                "all_runs": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                },
                                "example": {
                                    "step": 9,
                                    "brand": {
                                        "name": "آوند",
                                        "domain": "avand.example",
                                        "name_variants": [
                                            "Avand",
                                            "آوند حساب",
                                            "اوند"
                                        ],
                                        "site_read_status": "ok"
                                    },
                                    "industry": {
                                        "id": 1,
                                        "name": "نرم‌افزار حسابداری و مالی",
                                        "group": "فناوری اطلاعات و نرم‌افزار",
                                        "default_sales_model": "b2b"
                                    },
                                    "industry_other": null,
                                    "sales_model": "b2b",
                                    "primary_customer": null,
                                    "products": [
                                        {
                                            "id": 39,
                                            "name": "آوند ابری",
                                            "generic_name": "نرم‌افزار حسابداری ابری",
                                            "type": "software",
                                            "features": [
                                                "صدور فاکتور رسمی",
                                                "اتصال به سامانه مودیان",
                                                "دسترسی چندکاربره"
                                            ],
                                            "position": 1
                                        }
                                    ],
                                    "customers": [
                                        {
                                            "id": 41,
                                            "kind": "b2b",
                                            "name": "شرکت‌های خرد و کوچک در ایران",
                                            "industries": [
                                                "خدمات",
                                                "بازرگانی"
                                            ],
                                            "sizes": [
                                                "micro",
                                                "small"
                                            ],
                                            "decision_makers": [
                                                "مدیر مالی",
                                                "مدیرعامل"
                                            ],
                                            "country": "ایران",
                                            "province": null,
                                            "city": null,
                                            "main_need": "حسابداری ساده و قانونی",
                                            "position": 1
                                        }
                                    ],
                                    "competitors": [
                                        {
                                            "id": 163,
                                            "name": "نیک‌حساب",
                                            "domain": "nikhesab.example",
                                            "position": 1,
                                            "source": "suggested"
                                        },
                                        {
                                            "id": 164,
                                            "name": "ترازنو",
                                            "domain": "taraznoo.example",
                                            "position": 2,
                                            "source": "suggested"
                                        }
                                    ],
                                    "cells": [
                                        {
                                            "id": 9,
                                            "product_id": 39,
                                            "target_customer_id": 41,
                                            "label": "نرم‌افزار حسابداری ابری، برای شرکت‌های خرد و کوچک در ایران",
                                            "active": true,
                                            "position": 1
                                        }
                                    ],
                                    "question_language": "fa",
                                    "suggestions": {
                                        "industry_id": null,
                                        "industry": null,
                                        "industry_alternatives": [],
                                        "name_variants": [],
                                        "products": [],
                                        "customers": [],
                                        "competitors": []
                                    },
                                    "limits": {
                                        "engines": [
                                            "chatgpt"
                                        ],
                                        "questions": 10,
                                        "products": 1,
                                        "customers": 1,
                                        "cells": 1,
                                        "changes_per_month": 2,
                                        "run_frequencies": [
                                            "monthly"
                                        ],
                                        "discovered_limit": 10,
                                        "citations_full": false,
                                        "all_runs": false
                                    },
                                    "industries_count": 120,
                                    "question_languages": [
                                        {
                                            "code": "fa",
                                            "name": "فارسی",
                                            "native_name": "فارسی"
                                        },
                                        {
                                            "code": "en",
                                            "name": "English",
                                            "native_name": "English"
                                        }
                                    ],
                                    "question_set": {
                                        "exists": true,
                                        "edited": false,
                                        "approved": false
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Get onboarding state",
                "description": "Current answers for every step plus the site-reader suggestions and plan limits.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O2–O8",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Get onboarding state",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/approve": {
            "post": {
                "operationId": "post-onboarding-approve",
                "tags": [
                    "Onboarding"
                ],
                "responses": {
                    "200": {
                        "description": "ApproveResponse\n\nQueued variant: `{\"status\":\"queued\",\"reason\":\"first\",\"run\":null,\"queue\":{\"position\":3,\"eta_days\":2,\"boost_per_invite\":10,\"invite_max\":5},\"next_run_at\":null}`.\nScheduled variant (no manual run allowed now): `{\"status\":\"scheduled\",\"reason\":null,\"run\":null,\"queue\":null,\"next_run_at\":\"2026-12-25T10:30:00Z\"}`.\nThe running variant also carries `\"reason\":\"first\"|\"setup\"|\"changed\"` and `\"next_run_at\":null`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "status": {
                                            "type": "string",
                                            "enum": [
                                                "running",
                                                "queued",
                                                "scheduled"
                                            ],
                                            "description": "Current status."
                                        },
                                        "reason": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "enum": [
                                                "changed",
                                                "setup",
                                                "first",
                                                null
                                            ]
                                        },
                                        "run": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "kind": {
                                                    "type": "string"
                                                },
                                                "status": {
                                                    "type": "string",
                                                    "description": "Current status."
                                                },
                                                "engines": {
                                                    "type": "array",
                                                    "items": {},
                                                    "description": "AI assistants included."
                                                },
                                                "started_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it started (ISO 8601)."
                                                },
                                                "finished_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it finished (ISO 8601)."
                                                },
                                                "done": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "kind",
                                                "status",
                                                "engines",
                                                "started_at",
                                                "finished_at",
                                                "done",
                                                "total"
                                            ]
                                        },
                                        "queue": {
                                            "type": [
                                                "array",
                                                "null"
                                            ],
                                            "items": {}
                                        },
                                        "next_run_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "status",
                                        "reason",
                                        "run",
                                        "queue",
                                        "next_run_at"
                                    ]
                                },
                                "example": {
                                    "status": "running",
                                    "run": {
                                        "id": 57,
                                        "kind": "first",
                                        "status": "queued",
                                        "engines": [
                                            "chatgpt"
                                        ],
                                        "started_at": "2026-11-25T09:45:02Z",
                                        "finished_at": null,
                                        "done": 0,
                                        "total": 10
                                    },
                                    "queue": null
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "A run of the brand is in progress: `{\"message\":\"…\",\"code\":\"run_active\"}`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ConfirmRequired"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`questions` — no active questions)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Throttle 6 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Approve & start first scan",
                "description": "«تأیید و شروع»: finishes onboarding (step 9), records the approval of the current question set and starts a run **only\nwhen one is allowed** (`reason`):\n\n- `first` — the brand never ran. A free account's first run still goes through the free queue: when others are\n  waiting, the monthly first-run cap is full or the free spend cap (`free_monthly_cap_usd`) is reached, the user joins\n  the queue (`status: queued`).\n- `setup` — a paid account with no run since its latest successful payment (the post-payment setup, the app → the app/the app).\n- `changed` — a paid (or test) account whose question set changed since the last run.\n\nOtherwise the approval is saved and nothing starts (`status: scheduled`, `next_run_at`): free accounts keep the monthly\nschedule, paid ones their weekly/monthly one. While a run of the brand is active (`waiting`/`queued`/`running`) the call\nis refused with 409 `run_active` and nothing is saved. Throttle: 6 per minute (own counter).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O8 → O9",
                "x-rawi-throttle": "6/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O8 Approve & start first run",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/brand": {
            "post": {
                "operationId": "post-onboarding-brand",
                "tags": [
                    "Onboarding"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "minLength": 2,
                                        "maxLength": 80
                                    },
                                    "domain": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 253,
                                        "description": "max 253; scheme/path stripped; must be a valid host"
                                    },
                                    "name_variants": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "maxLength": 80
                                        },
                                        "maxItems": 12,
                                        "description": "max 12 items, each max 80"
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            },
                            "x-rawi-template": "{\n  \"name\": \"آوند\",\n  \"domain\": \"avand.example\",\n  \"name_variants\": [\n    \"Avand\",\n    \"آوند حساب\",\n    \"اوند\"\n  ]\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: O2 Save brand (reads the site)",
                                    "value": {
                                        "name": "آوند",
                                        "domain": "avand.example",
                                        "name_variants": [
                                            "Avand",
                                            "آوند حساب",
                                            "اوند"
                                        ]
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "name": "آوند",
                                        "domain": "avand.example",
                                        "name_variants": [
                                            "Avand",
                                            "آوند حساب",
                                            "اوند"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (name, domain («دامنه درست نیست»))",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                },
                "summary": "Save brand (reads the site)",
                "description": "Saves name/domain/name variants and reads the site (8 s timeout) to fill `suggestions` for the app. `site_read_status` = `ok` | `failed` ( «سایت خوانده نشد»: the user continues with manual forms). Domains ending in `.example` use the built-in accounting fixture.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O2",
                "x-rawi-throttle": "30/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O2 Save brand (reads the site)",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/brand/reread": {
            "post": {
                "operationId": "post-onboarding-brand-reread",
                "tags": [
                    "Onboarding"
                ],
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                },
                "summary": "Re-read site",
                "description": "Reads the saved domain again («دوباره بخوان»).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O2",
                "x-rawi-throttle": "5/10min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O2 Re-read site",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/competitors": {
            "put": {
                "operationId": "put-onboarding-competitors",
                "tags": [
                    "Onboarding"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "competitors": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "minLength": 2,
                                                    "maxLength": 80
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 253,
                                                    "description": "Site domain."
                                                }
                                            },
                                            "required": [
                                                "name"
                                            ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 5,
                                        "description": "1–5 items, in order of importance"
                                    }
                                },
                                "required": [
                                    "competitors"
                                ]
                            },
                            "x-rawi-template": "{\n  \"competitors\": [\n    {\n      \"name\": \"نیک‌حساب\",\n      \"domain\": \"nikhesab.example\"\n    },\n    {\n      \"name\": \"ترازنو\",\n      \"domain\": \"taraznoo.example\"\n    },\n    {\n      \"name\": \"دفتریار\",\n      \"domain\": \"daftaryar.example\"\n    },\n    {\n      \"name\": \"رایان‌دفتر\",\n      \"domain\": \"rayandaftar.example\"\n    },\n    {\n      \"name\": \"مهرگان‌سیستم\",\n      \"domain\": \"mehregan.example\"\n    }\n  ]\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: O6 Save competitors",
                                    "value": {
                                        "competitors": [
                                            {
                                                "name": "نیک‌حساب",
                                                "domain": "nikhesab.example"
                                            },
                                            {
                                                "name": "ترازنو",
                                                "domain": "taraznoo.example"
                                            },
                                            {
                                                "name": "دفتریار",
                                                "domain": "daftaryar.example"
                                            },
                                            {
                                                "name": "رایان‌دفتر",
                                                "domain": "rayandaftar.example"
                                            },
                                            {
                                                "name": "مهرگان‌سیستم",
                                                "domain": "mehregan.example"
                                            }
                                        ]
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "competitors": [
                                            {
                                                "name": "نیک‌حساب",
                                                "domain": "nikhesab.example"
                                            },
                                            {
                                                "name": "ترازنو",
                                                "domain": "taraznoo.example"
                                            },
                                            {
                                                "name": "دفتریار",
                                                "domain": "daftaryar.example"
                                            },
                                            {
                                                "name": "رایان‌دفتر",
                                                "domain": "rayandaftar.example"
                                            },
                                            {
                                                "name": "مهرگان‌سیستم",
                                                "domain": "mehregan.example"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed («حداقل یک رقیب» / «حداکثر ۵ رقیب»)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Save competitors",
                "description": "Ordered list of 1–5 competitors. Order matters: competitor and comparison questions start from competitor #1.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O6",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O6 Save competitors",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/customers": {
            "put": {
                "operationId": "put-onboarding-customers",
                "tags": [
                    "Onboarding"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "customers": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Unique ID."
                                                },
                                                "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                        "b2b",
                                                        "b2c"
                                                    ]
                                                },
                                                "industries": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "maxLength": 120
                                                    },
                                                    "maxItems": 6
                                                },
                                                "sizes": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "micro",
                                                            "small",
                                                            "medium",
                                                            "large"
                                                        ]
                                                    },
                                                    "maxItems": 2
                                                },
                                                "decision_makers": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "maxLength": 80
                                                    },
                                                    "maxItems": 4
                                                },
                                                "country": {
                                                    "type": "string",
                                                    "maxLength": 80
                                                },
                                                "province": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 80
                                                },
                                                "city": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 80
                                                },
                                                "main_need": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 200
                                                }
                                            },
                                            "required": [
                                                "kind",
                                                "country"
                                            ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 2,
                                        "description": "1–2 items"
                                    }
                                },
                                "required": [
                                    "customers"
                                ]
                            },
                            "x-rawi-template": "{\n  \"customers\": [\n    {\n      \"id\": {{customerId}},\n      \"kind\": \"b2b\",\n      \"industries\": [\n        \"خدمات\",\n        \"بازرگانی\"\n      ],\n      \"sizes\": [\n        \"micro\",\n        \"small\"\n      ],\n      \"decision_makers\": [\n        \"مدیر مالی\",\n        \"مدیرعامل\"\n      ],\n      \"country\": \"ایران\",\n      \"province\": null,\n      \"city\": null,\n      \"main_need\": \"حسابداری ساده و قانونی\"\n    }\n  ]\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: O5 Save target customers",
                                    "value": {
                                        "customers": [
                                            {
                                                "id": 41,
                                                "kind": "b2b",
                                                "industries": [
                                                    "خدمات",
                                                    "بازرگانی"
                                                ],
                                                "sizes": [
                                                    "micro",
                                                    "small"
                                                ],
                                                "decision_makers": [
                                                    "مدیر مالی",
                                                    "مدیرعامل"
                                                ],
                                                "country": "ایران",
                                                "province": null,
                                                "city": null,
                                                "main_need": "حسابداری ساده و قانونی"
                                            }
                                        ]
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "customers": [
                                            {
                                                "id": 41,
                                                "kind": "b2b",
                                                "industries": [
                                                    "خدمات",
                                                    "بازرگانی"
                                                ],
                                                "sizes": [
                                                    "micro",
                                                    "small"
                                                ],
                                                "decision_makers": [
                                                    "مدیر مالی",
                                                    "مدیرعامل"
                                                ],
                                                "country": "ایران",
                                                "province": null,
                                                "city": null,
                                                "main_need": "حسابداری ساده و قانونی"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit` — more customers than the plan allows",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`customers.N.sizes` required / not adjacent, …)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Save target customers",
                "description": "B2B: industries, 1–2 adjacent company sizes, decision makers, location, main need. B2C: location only. The server builds `name` (e.g. «شرکت‌های خرد و کوچک در ایران»). Free 1, paid up to 2.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O5",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O5 Save target customers",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/industry": {
            "put": {
                "operationId": "put-onboarding-industry",
                "tags": [
                    "Onboarding"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "industry_id": {
                                        "type": [
                                            "integer",
                                            "null"
                                        ],
                                        "description": "exists in industries; required without `industry_other`"
                                    },
                                    "industry_other": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 120,
                                        "description": "max 120; required without `industry_id`"
                                    },
                                    "sales_model": {
                                        "type": "string",
                                        "enum": [
                                            "b2b",
                                            "b2c",
                                            "both"
                                        ],
                                        "description": "`b2b` | `b2c` | `both`"
                                    },
                                    "primary_customer": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "b2b",
                                            "b2c",
                                            null
                                        ],
                                        "description": "`b2b` | `b2c`; required when `sales_model=both`"
                                    }
                                },
                                "required": [
                                    "sales_model"
                                ]
                            },
                            "x-rawi-template": "{\n  \"industry_id\": 1,\n  \"sales_model\": \"b2b\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: O3 Save industry & sales model",
                                    "value": {
                                        "industry_id": 1,
                                        "sales_model": "b2b"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "industry_id": 1,
                                        "sales_model": "b2b"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (industry_id, sales_model, primary_customer)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Save industry & sales model",
                "description": "Industry from the reference taxonomy (or free text) and who the brand sells to. `both` requires the primary customer kind, which picks the buying-journey template.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O3",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O3 Save industry & sales model",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/matrix": {
            "put": {
                "operationId": "put-onboarding-matrix",
                "tags": [
                    "Onboarding"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "cells": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "product_id": {
                                                    "type": "integer"
                                                },
                                                "target_customer_id": {
                                                    "type": "integer"
                                                },
                                                "active": {
                                                    "type": "boolean"
                                                },
                                                "position": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 20
                                                }
                                            },
                                            "required": [
                                                "product_id",
                                                "target_customer_id",
                                                "active",
                                                "position"
                                            ]
                                        },
                                        "maxItems": 6,
                                        "description": "max 6 items"
                                    },
                                    "question_language": {
                                        "type": "string",
                                        "description": "a language with `questions_enabled` (A4), e.g. `fa`, `en`"
                                    }
                                },
                                "required": [
                                    "question_language"
                                ]
                            },
                            "x-rawi-template": "{\n  \"cells\": [\n    {\n      \"product_id\": {{productId}},\n      \"target_customer_id\": {{customerId}},\n      \"active\": true,\n      \"position\": 1\n    }\n  ],\n  \"question_language\": \"fa\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: O7 Save matrix & question language",
                                    "value": {
                                        "cells": [
                                            {
                                                "product_id": 39,
                                                "target_customer_id": 41,
                                                "active": true,
                                                "position": 1
                                            }
                                        ],
                                        "question_language": "fa"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "cells": [
                                            {
                                                "product_id": 39,
                                                "target_customer_id": 41,
                                                "active": true,
                                                "position": 1
                                            }
                                        ],
                                        "question_language": "fa"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit` — more active cells than the plan allows",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`cells` unknown cell / none active, `question_language`)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Save matrix & question language",
                "description": "Active product × customer cells and their order (paid, max 4 active) and the question language. Free accounts send only `question_language`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O7",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O7 Save matrix & question language",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/products": {
            "put": {
                "operationId": "put-onboarding-products",
                "tags": [
                    "Onboarding"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "products": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "maxLength": 120
                                                },
                                                "generic_name": {
                                                    "type": "string",
                                                    "minLength": 2,
                                                    "maxLength": 120
                                                },
                                                "type": {
                                                    "type": "string",
                                                    "enum": [
                                                        "software",
                                                        "service",
                                                        "physical",
                                                        "other"
                                                    ]
                                                },
                                                "features": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "maxLength": 80
                                                    },
                                                    "maxItems": 3
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "generic_name",
                                                "type"
                                            ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 3,
                                        "description": "1–3 items"
                                    }
                                },
                                "required": [
                                    "products"
                                ]
                            },
                            "x-rawi-template": "{\n  \"products\": [\n    {\n      \"id\": {{productId}},\n      \"name\": \"آوند ابری\",\n      \"generic_name\": \"نرم‌افزار حسابداری ابری\",\n      \"type\": \"software\",\n      \"features\": [\n        \"صدور فاکتور رسمی\",\n        \"اتصال به سامانه مودیان\",\n        \"دسترسی چندکاربره\"\n      ]\n    }\n  ]\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: O4 Save products",
                                    "value": {
                                        "products": [
                                            {
                                                "id": 39,
                                                "name": "آوند ابری",
                                                "generic_name": "نرم‌افزار حسابداری ابری",
                                                "type": "software",
                                                "features": [
                                                    "صدور فاکتور رسمی",
                                                    "اتصال به سامانه مودیان",
                                                    "دسترسی چندکاربره"
                                                ]
                                            }
                                        ]
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "products": [
                                            {
                                                "id": 39,
                                                "name": "آوند ابری",
                                                "generic_name": "نرم‌افزار حسابداری ابری",
                                                "type": "software",
                                                "features": [
                                                    "صدور فاکتور رسمی",
                                                    "اتصال به سامانه مودیان",
                                                    "دسترسی چندکاربره"
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OnboardingState",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "step": {
                                            "type": "integer"
                                        },
                                        "brand": {
                                            "type": "object",
                                            "properties": {
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Site domain."
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "description": "«Other forms of the name»: the name itself is always matched, so it is not listed as another form.",
                                                    "items": {}
                                                },
                                                "site_read_status": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "domain",
                                                "name_variants",
                                                "site_read_status"
                                            ]
                                        },
                                        "industry": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string"
                                                },
                                                "group": {
                                                    "type": "string"
                                                },
                                                "default_sales_model": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "name",
                                                "group",
                                                "default_sales_model"
                                            ]
                                        },
                                        "industry_other": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "sales_model": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "primary_customer": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "industry_id": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "industry": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "id": {
                                                            "type": "integer",
                                                            "description": "Unique ID."
                                                        },
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "group": {
                                                            "type": "string"
                                                        },
                                                        "default_sales_model": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "id",
                                                        "name",
                                                        "group",
                                                        "default_sales_model"
                                                    ]
                                                },
                                                "industry_alternatives": {
                                                    "anyOf": [
                                                        {
                                                            "type": "array",
                                                            "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        },
                                                        {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "id": {
                                                                        "type": "integer"
                                                                    },
                                                                    "name": {
                                                                        "type": "string"
                                                                    },
                                                                    "group": {
                                                                        "type": "string"
                                                                    },
                                                                    "default_sales_model": {
                                                                        "type": "string"
                                                                    }
                                                                },
                                                                "required": [
                                                                    "id",
                                                                    "name",
                                                                    "group",
                                                                    "default_sales_model"
                                                                ]
                                                            }
                                                        }
                                                    ]
                                                },
                                                "name_variants": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "products": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "customers": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "competitors": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "industry_id",
                                                "industry",
                                                "industry_alternatives",
                                                "name_variants",
                                                "products",
                                                "customers",
                                                "competitors"
                                            ]
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "industries_count": {
                                            "type": "integer",
                                            "description": "O3 search helper: «در N صنعت جست‌وجو می‌شود».",
                                            "minimum": 0
                                        },
                                        "question_languages": {
                                            "type": "array",
                                            "description": "O7: question languages switched on in A4 (code + localized name).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "code": {
                                                        "type": "string",
                                                        "description": "Machine-readable code."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "native_name": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "code",
                                                    "name",
                                                    "native_name"
                                                ]
                                            }
                                        },
                                        "question_set": {
                                            "type": "object",
                                            "description": "O7 «ساخت پرسش‌ها» rebuilds the whole set: the page asks first when the current set has edits or was approved.",
                                            "properties": {
                                                "exists": {
                                                    "type": "boolean"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                },
                                                "approved": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "exists",
                                                "edited",
                                                "approved"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "step",
                                        "brand",
                                        "industry",
                                        "industry_other",
                                        "sales_model",
                                        "primary_customer",
                                        "products",
                                        "customers",
                                        "competitors",
                                        "cells",
                                        "question_language",
                                        "suggestions",
                                        "limits",
                                        "industries_count",
                                        "question_languages",
                                        "question_set"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "More products than the plan allows: `{\"message\":\"این امکان در طرح پولی است.\",\"code\":\"plan_limit\"}`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`products.N.generic_name` contains the brand name, …)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Save products",
                "description": "Replaces the product list (rows without `id` are created, missing ones deleted) and syncs the matrix. Free: 1 product, paid: up to 3.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O4",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O4 Save products",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/onboarding/questions": {
            "post": {
                "operationId": "post-onboarding-questions",
                "tags": [
                    "Onboarding"
                ],
                "responses": {
                    "200": {
                        "description": "QuestionsResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "questions": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "stage": {
                                                        "type": "string",
                                                        "description": "Buying stage of the question."
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "text": {
                                                        "type": "string"
                                                    },
                                                    "language": {
                                                        "type": "string"
                                                    },
                                                    "cell_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "the question's own language: lang/dir on its text (as in the reports)"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "edited": {
                                                        "type": "boolean"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "stage",
                                                    "type",
                                                    "text",
                                                    "language",
                                                    "cell_id",
                                                    "position",
                                                    "edited"
                                                ]
                                            }
                                        },
                                        "stage_counts": {
                                            "type": "object",
                                            "properties": {
                                                "problem": {
                                                    "type": "integer"
                                                },
                                                "solution": {
                                                    "type": "integer"
                                                },
                                                "criteria": {
                                                    "type": "integer"
                                                },
                                                "selection": {
                                                    "type": "integer"
                                                },
                                                "validation": {
                                                    "type": "integer"
                                                }
                                            },
                                            "description": "Number of questions per buying stage."
                                        },
                                        "changes": {
                                            "type": "object",
                                            "properties": {
                                                "used": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "limit": {
                                                    "type": "integer"
                                                },
                                                "remaining": {},
                                                "month": {},
                                                "resets_at": {
                                                    "type": "string"
                                                },
                                                "counting": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "used",
                                                "limit",
                                                "remaining",
                                                "month",
                                                "resets_at",
                                                "counting"
                                            ]
                                        },
                                        "language": {
                                            "type": "string"
                                        },
                                        "engine_label": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "questions",
                                        "stage_counts",
                                        "changes",
                                        "language",
                                        "engine_label"
                                    ]
                                },
                                "example": {
                                    "questions": [
                                        {
                                            "id": 345,
                                            "stage": "problem",
                                            "type": "unbranded",
                                            "text": "نشانه‌های اینکه یک شرکت کوچک به نرم‌افزار حسابداری ابری نیاز دارد چیست؟",
                                            "language": "fa",
                                            "cell_id": 9,
                                            "position": 1,
                                            "edited": true
                                        },
                                        {
                                            "id": 346,
                                            "stage": "solution",
                                            "type": "unbranded",
                                            "text": "انواع نرم‌افزار حسابداری ابری چیست و هر کدام برای چه شرکتی مناسب است؟",
                                            "language": "fa",
                                            "cell_id": 9,
                                            "position": 2,
                                            "edited": false
                                        }
                                    ],
                                    "stage_counts": {
                                        "problem": 1,
                                        "solution": 2,
                                        "criteria": 2,
                                        "selection": 4,
                                        "validation": 1
                                    },
                                    "changes": {
                                        "used": 0,
                                        "limit": 2,
                                        "remaining": 2,
                                        "month": "1405-09",
                                        "resets_at": "2026-12-21T20:30:00Z",
                                        "counting": false
                                    },
                                    "language": "fa",
                                    "engine_label": "ChatGPT"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`questions` — no product/customer yet)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Generate question set",
                "description": "(Re)builds the question set from templates: per-stage counts from the plan (free 1/2/2/4/1, paid 3/4/4/10/4) split across active cells. Old questions are deactivated, never deleted. The new set waits for approval.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O8",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "O8 Generate question set",
                    "folder": "03 Onboarding (O2–O8)"
                }
            }
        },
        "/openapi.json": {
            "get": {
                "operationId": "get-openapi-json",
                "description": "The public copy generated by `php artisan docs:openapi` (customer and public endpoints only; also published by\nthe web app at /openapi.json). The full spec with the admin API (resources/openapi/openapi.internal.json) is not served.",
                "summary": "OpenAPI document (public)",
                "tags": [
                    "Documentation"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json; charset=utf-8": {
                                "schema": {
                                    "type": [
                                        "string",
                                        "object"
                                    ]
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "public, max-age=300"
                                }
                            }
                        }
                    },
                    "404": {
                        "$ref": "#/components/responses/ModelNotFoundException"
                    }
                },
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "security": [],
                "x-postman": {
                    "name": "OpenAPI document (public)",
                    "folder": "02 Public"
                }
            }
        },
        "/public/options": {
            "get": {
                "operationId": "get-public-options",
                "summary": "Public site options",
                "tags": [
                    "Public"
                ],
                "responses": {
                    "200": {
                        "description": "PublicOptions",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "legal": {
                                            "type": "object",
                                            "properties": {
                                                "company_name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "address": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "support_email": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "governing_law": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "reviewed": {},
                                                "updated_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it was last changed (ISO 8601)."
                                                }
                                            },
                                            "required": [
                                                "company_name",
                                                "address",
                                                "support_email",
                                                "governing_law",
                                                "reviewed",
                                                "updated_at"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "legal"
                                    ]
                                },
                                "example": {
                                    "legal": {
                                        "company_name": "Rawi Labs Ltd",
                                        "address": "1 Example Street, London",
                                        "support_email": "support@rawi.example",
                                        "governing_law": "England and Wales",
                                        "reviewed": false,
                                        "updated_at": "2026-11-20"
                                    }
                                }
                            }
                        }
                    }
                },
                "description": "The legal entity the legal pages quote: company legal name, registered address, support email, governing law, whether\ncounsel reviewed the texts and the «Last updated» date. Each value is the one saved in the admin panel\n(`PUT /admin/legal`), else the server `.env` (`RAWI_LEGAL_*`, `RAWI_SUPPORT_EMAIL`). Never a placeholder: an unknown\ncompany name is `null` (the site shows its own name) and an unknown support email falls back to `MAIL_FROM_ADDRESS`.",
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "x-rawi-access-note": "Public — no token",
                "x-rawi-screen": "/terms, /privacy, /refunds",
                "security": [],
                "x-postman": {
                    "name": "Public site options (legal entity)",
                    "folder": "02 Public"
                }
            }
        },
        "/public/plans": {
            "get": {
                "operationId": "get-public-plans",
                "summary": "Public plans & prices",
                "tags": [
                    "Public"
                ],
                "responses": {
                    "200": {
                        "description": "PlansResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "currency": {
                                            "type": "string",
                                            "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                        },
                                        "monthly_price": {
                                            "type": "integer"
                                        },
                                        "vat_percent": {
                                            "type": "integer"
                                        },
                                        "periods": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "key": {
                                                        "type": "string"
                                                    },
                                                    "months": {
                                                        "type": "integer"
                                                    },
                                                    "discount_percent": {
                                                        "type": "integer"
                                                    },
                                                    "price": {},
                                                    "full_price": {
                                                        "type": "integer"
                                                    },
                                                    "monthly_price": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "key",
                                                    "months",
                                                    "discount_percent",
                                                    "price",
                                                    "full_price",
                                                    "monthly_price"
                                                ]
                                            }
                                        },
                                        "online_payment_available": {
                                            "type": "boolean"
                                        },
                                        "gateway": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "provider": {
                                                    "type": "string"
                                                },
                                                "mode": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "provider",
                                                "mode"
                                            ]
                                        },
                                        "auto_renew_available": {
                                            "type": "boolean"
                                        },
                                        "limits": {
                                            "type": "object",
                                            "properties": {
                                                "free": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "paid": {
                                                    "type": "array",
                                                    "items": {}
                                                }
                                            },
                                            "required": [
                                                "free",
                                                "paid"
                                            ],
                                            "description": "Limits of the account's plan."
                                        }
                                    },
                                    "required": [
                                        "currency",
                                        "monthly_price",
                                        "vat_percent",
                                        "periods",
                                        "online_payment_available",
                                        "gateway",
                                        "auto_renew_available",
                                        "limits"
                                    ]
                                },
                                "example": {
                                    "currency": "IRT",
                                    "monthly_price": 1800000,
                                    "vat_percent": 10,
                                    "periods": [
                                        {
                                            "key": "monthly",
                                            "months": 1,
                                            "discount_percent": 0,
                                            "price": 1800000,
                                            "full_price": 1800000,
                                            "monthly_price": 1800000
                                        },
                                        {
                                            "key": "quarterly",
                                            "months": 3,
                                            "discount_percent": 10,
                                            "price": 4860000,
                                            "full_price": 5400000,
                                            "monthly_price": 1620000
                                        }
                                    ],
                                    "online_payment_available": true
                                }
                            }
                        }
                    }
                },
                "description": "Monthly price, VAT and the active billing periods with their discounts, for the landing and pricing pages.\nPrices are in the market's `default_currency` (USD internationally, IRT in Iran) when it has a price, in its minor unit.\n`online_payment_available` is `true` when at least one gateway can take a payment: switched on, a provider with a driver\n(`mock`, `zarinpal`, `stripe`), in a currency the provider supports and that has a price.\n\nThe landing and pricing pages also accept `?code=X` (`/?code=X`, `/pricing?code=X`): the web app stores the code in\nlocalStorage `rawi_discount_code`, and the app (`/app/upgrade`) and the app (`/app/checkout`) send it to `POST /billing/quote` and\n`/billing/checkout`. No API change.",
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "x-rawi-access-note": "Public — no token",
                "x-rawi-screen": "P1, P2",
                "security": [],
                "x-postman": {
                    "name": "Public plans & prices",
                    "folder": "02 Public"
                }
            }
        },
        "/questions": {
            "get": {
                "operationId": "get-questions",
                "tags": [
                    "Questions"
                ],
                "responses": {
                    "200": {
                        "description": "QuestionsResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "questions": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "stage": {
                                                        "type": "string",
                                                        "description": "Buying stage of the question."
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "text": {
                                                        "type": "string"
                                                    },
                                                    "language": {
                                                        "type": "string"
                                                    },
                                                    "cell_id": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "the question's own language: lang/dir on its text (as in the reports)"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "edited": {
                                                        "type": "boolean"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "stage",
                                                    "type",
                                                    "text",
                                                    "language",
                                                    "cell_id",
                                                    "position",
                                                    "edited"
                                                ]
                                            }
                                        },
                                        "stage_counts": {
                                            "type": "string",
                                            "description": "Number of questions per buying stage."
                                        },
                                        "changes": {
                                            "type": "object",
                                            "properties": {
                                                "used": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "limit": {
                                                    "type": "integer"
                                                },
                                                "remaining": {},
                                                "month": {},
                                                "resets_at": {
                                                    "type": "string"
                                                },
                                                "counting": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "used",
                                                "limit",
                                                "remaining",
                                                "month",
                                                "resets_at",
                                                "counting"
                                            ]
                                        },
                                        "language": {
                                            "type": "string"
                                        },
                                        "engine_label": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "questions",
                                        "stage_counts",
                                        "changes",
                                        "language",
                                        "engine_label"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "List questions",
                "description": "Active questions with stage counts, the monthly change counter and the engine label. Each question carries its own `language` (the language it is asked and answered in): clients set `lang`/`dir` on the question text from it, since it can differ from the panel language.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O8, S3",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "List questions",
                    "folder": "04 Questions (O8, S3)"
                }
            }
        },
        "/questions/{id}": {
            "patch": {
                "operationId": "patch-questions-id",
                "tags": [
                    "Questions"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Postman variable `{{questionId}}`",
                        "x-rawi-variable": "questionId",
                        "example": 345
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "text": {
                                        "type": "string",
                                        "maxLength": 300,
                                        "description": "10–300 chars; no own-brand name in unbranded/competitor questions"
                                    }
                                },
                                "required": [
                                    "text"
                                ]
                            },
                            "x-rawi-template": "{\n  \"text\": \"نشانه‌های اینکه یک شرکت کوچک به نرم‌افزار حسابداری ابری نیاز دارد چیست؟\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: Edit question text",
                                    "value": {
                                        "text": "نشانه‌های اینکه یک شرکت کوچک به نرم‌افزار حسابداری ابری نیاز دارد چیست؟"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "text": "نشانه‌های اینکه یک شرکت کوچک به نرم‌افزار حسابداری ابری نیاز دارد چیست؟"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Question",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "stage": {
                                            "type": "string",
                                            "description": "Buying stage of the question."
                                        },
                                        "type": {
                                            "type": "string"
                                        },
                                        "text": {
                                            "type": "string"
                                        },
                                        "language": {
                                            "type": "string"
                                        },
                                        "cell_id": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "the question's own language: lang/dir on its text (as in the reports)"
                                        },
                                        "position": {
                                            "type": "integer"
                                        },
                                        "edited": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "stage",
                                        "type",
                                        "text",
                                        "language",
                                        "cell_id",
                                        "position",
                                        "edited"
                                    ]
                                },
                                "example": {
                                    "id": 345,
                                    "stage": "problem",
                                    "type": "unbranded",
                                    "text": "نشانه‌های اینکه یک شرکت کوچک به نرم‌افزار حسابداری ابری نیاز دارد چیست؟",
                                    "language": "fa",
                                    "cell_id": 9,
                                    "position": 1,
                                    "edited": true
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit` — no changes left this month («تغییر مجاز این ماه»)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown id (or not owned by the caller)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`text` length / brand name)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Edit question text",
                "description": "Inline edit. The text is re-checked: 10–300 chars and unbranded/competitor questions may not contain the user's own brand name.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O8, S3",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Edit question text",
                    "folder": "04 Questions (O8, S3)"
                }
            }
        },
        "/questions/{id}/replace": {
            "post": {
                "operationId": "post-questions-id-replace",
                "tags": [
                    "Questions"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Postman variable `{{questionId}}`",
                        "x-rawi-variable": "questionId",
                        "example": 345
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Question",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "stage": {
                                            "type": "string",
                                            "description": "Buying stage of the question."
                                        },
                                        "type": {
                                            "type": "string"
                                        },
                                        "text": {
                                            "type": "string"
                                        },
                                        "language": {
                                            "type": "string"
                                        },
                                        "cell_id": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "the question's own language: lang/dir on its text (as in the reports)"
                                        },
                                        "position": {
                                            "type": "integer"
                                        },
                                        "edited": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "id",
                                        "stage",
                                        "type",
                                        "text",
                                        "language",
                                        "cell_id",
                                        "position",
                                        "edited"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit` — no changes left",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown id (or not owned by the caller)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`question` — no alternative template left)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Replace question («پرسش دیگر»)",
                "description": "Swaps the question for the next unused template of the same stage/type/cell.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O8, S3",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Replace question («پرسش دیگر»)",
                    "folder": "04 Questions (O8, S3)"
                }
            }
        },
        "/referrals": {
            "get": {
                "operationId": "get-referrals",
                "tags": [
                    "Referrals"
                ],
                "responses": {
                    "200": {
                        "description": "ReferralSummary",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "link": {
                                            "type": "string"
                                        },
                                        "code": {
                                            "type": "string",
                                            "description": "Machine-readable code."
                                        },
                                        "signups": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "purchases": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "months_earned": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "months_pending": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "reward_delay_days": {
                                            "type": "integer"
                                        },
                                        "gift_enabled": {
                                            "type": "boolean"
                                        },
                                        "gift_percent": {
                                            "type": "integer"
                                        },
                                        "max_free_months_per_year": {
                                            "type": "integer"
                                        },
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "revoke_reason": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "month_revoked": {
                                                        "type": "boolean"
                                                    },
                                                    "email_masked": {
                                                        "type": [
                                                            "string",
                                                            "null",
                                                            "array",
                                                            "object"
                                                        ]
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "phone-only account"
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "reward_due_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "revoke_reason",
                                                    "month_revoked",
                                                    "email_masked",
                                                    "status",
                                                    "date",
                                                    "reward_due_at"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "link",
                                        "code",
                                        "signups",
                                        "purchases",
                                        "months_earned",
                                        "months_pending",
                                        "reward_delay_days",
                                        "gift_enabled",
                                        "gift_percent",
                                        "max_free_months_per_year",
                                        "items"
                                    ]
                                },
                                "example": {
                                    "link": "http://localhost:3010/signup?ref=wth1ftkn",
                                    "code": "wth1ftkn",
                                    "signups": 2,
                                    "purchases": 1,
                                    "months_earned": 0,
                                    "months_pending": 1,
                                    "reward_delay_days": 14,
                                    "gift_enabled": true,
                                    "gift_percent": 20,
                                    "max_free_months_per_year": 12,
                                    "items": [
                                        {
                                            "revoke_reason": null,
                                            "month_revoked": false,
                                            "email_masked": "in***@avand-shop.example",
                                            "status": "purchased",
                                            "date": "2026-11-18T11:42:00Z",
                                            "reward_due_at": "2026-12-02T11:42:00Z"
                                        },
                                        {
                                            "revoke_reason": null,
                                            "month_revoked": false,
                                            "email_masked": "sa***@persia.example",
                                            "status": "signed_up",
                                            "date": "2026-11-03T09:32:12Z",
                                            "reward_due_at": null
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Referral summary",
                "description": "Personal invite link, signups and purchases, free months earned/pending. A reward (+1 free month, email) is granted `reward_delay_days` (14) after the referred user pays.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S6",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Referral summary",
                    "folder": "09 Referrals (S6)"
                }
            }
        },
        "/reports/citations": {
            "get": {
                "operationId": "get-reports-citations",
                "tags": [
                    "Scans & reports"
                ],
                "responses": {
                    "200": {
                        "description": "CitationsReport\n\nPaid source item: `{\"domain\":\"compare-soft.example\",\"type\":\"review\",\"answers\":16,\"opportunity\":false,\"names_brand\":true,\"names_competitor\":true,\"engines\":[\"chatgpt\",\"claude\"],\"pages\":[{\"url\":\"https://compare-soft.example/review-2026\",\"question_id\":357,\"engine\":\"chatgpt\"}]}`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "context": {
                                            "type": "object",
                                            "properties": {
                                                "…": {
                                                    "type": "string"
                                                }
                                            },
                                            "description": "The filters this report was built with (scan, AI assistant, audience)."
                                        },
                                        "answers_with_sources": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "answers_total": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "total_sources": {
                                            "type": "integer",
                                            "description": "denominator: every answer (all questions, all samples) in scope"
                                        },
                                        "own_sources": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "opportunities": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "by_type": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "count": {
                                                        "type": "integer",
                                                        "minimum": 0
                                                    }
                                                },
                                                "required": [
                                                    "type",
                                                    "count"
                                                ]
                                            }
                                        },
                                        "sources": {
                                            "anyOf": [
                                                {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "domain": {
                                                                "type": "string"
                                                            },
                                                            "initial": {
                                                                "type": "string"
                                                            },
                                                            "type": {
                                                                "anyOf": [
                                                                    {
                                                                        "type": "string"
                                                                    },
                                                                    {
                                                                        "type": "string",
                                                                        "enum": [
                                                                            "other"
                                                                        ]
                                                                    }
                                                                ]
                                                            },
                                                            "answers": {
                                                                "type": "integer"
                                                            },
                                                            "opportunity": {
                                                                "type": "boolean"
                                                            },
                                                            "names_brand": {
                                                                "type": "string"
                                                            },
                                                            "names_competitor": {
                                                                "type": "string"
                                                            },
                                                            "engines": {
                                                                "type": "array",
                                                                "items": {}
                                                            },
                                                            "pages": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "required": [
                                                            "domain",
                                                            "initial",
                                                            "type",
                                                            "answers",
                                                            "opportunity",
                                                            "names_brand",
                                                            "names_competitor",
                                                            "engines",
                                                            "pages"
                                                        ]
                                                    }
                                                },
                                                {
                                                    "type": "array"
                                                }
                                            ]
                                        },
                                        "locked": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "context",
                                        "answers_with_sources",
                                        "answers_total",
                                        "total_sources",
                                        "own_sources",
                                        "opportunities",
                                        "by_type",
                                        "sources",
                                        "locked"
                                    ]
                                },
                                "example": {
                                    "context": {
                                        "…": "ReportContext — same shape as in GET /reports/overview"
                                    },
                                    "answers_with_sources": 10,
                                    "total_sources": 23,
                                    "own_sources": 2,
                                    "opportunities": 6,
                                    "by_type": [
                                        {
                                            "type": "own",
                                            "count": 2
                                        },
                                        {
                                            "type": "competitor",
                                            "count": 7
                                        }
                                    ],
                                    "sources": [
                                        {
                                            "domain": "hesab-review.example",
                                            "initial": "H",
                                            "type": "review",
                                            "answers": 5,
                                            "opportunity": true,
                                            "names_brand": false,
                                            "names_competitor": true,
                                            "engines": [
                                                "chatgpt"
                                            ],
                                            "pages": []
                                        },
                                        {
                                            "domain": "nikhesab.example",
                                            "initial": "N",
                                            "type": "competitor",
                                            "answers": 4,
                                            "opportunity": false,
                                            "names_brand": true,
                                            "names_competitor": true,
                                            "engines": [
                                                "chatgpt"
                                            ],
                                            "pages": []
                                        }
                                    ],
                                    "locked": true
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand / unknown run or cell",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Sources",
                "description": "Cited domains classified into 7 source types (own, competitor, media, review, forum, reference, other) and citation opportunities (a source whose answer names a competitor but not the brand). Free: counts by type + 3 sample sources without page URLs (`locked: true`). Paid: every source with page URLs.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R3",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "parameters": [
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "run to show; 0/absent = default run. Free: only the default run",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`all` (default) | `chatgpt` | `gemini` | `claude` (must be in the plan)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cell_id",
                        "in": "query",
                        "required": false,
                        "description": "matrix cell; 0/absent = all cells",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "x-postman": {
                    "name": "R3 Citations",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/reports/gaps": {
            "get": {
                "operationId": "get-reports-gaps",
                "tags": [
                    "Scans & reports"
                ],
                "responses": {
                    "200": {
                        "description": "GapsReport",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "context": {
                                            "type": "object",
                                            "properties": {
                                                "…": {
                                                    "type": "string"
                                                }
                                            },
                                            "description": "The filters this report was built with (scan, AI assistant, audience)."
                                        },
                                        "total_selection": {
                                            "type": "integer"
                                        },
                                        "limits": {
                                            "type": "object",
                                            "description": "Plan sizes for the footer («Free plan: 10 questions, N of them about choosing a vendor»), from PlanLimits.",
                                            "properties": {
                                                "questions": {
                                                    "type": "integer"
                                                },
                                                "paid_questions": {
                                                    "type": "integer"
                                                },
                                                "free_questions": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "questions",
                                                "paid_questions",
                                                "free_questions"
                                            ]
                                        },
                                        "gaps": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "question_id": {
                                                        "type": "integer",
                                                        "description": "ID of the question."
                                                    },
                                                    "text": {
                                                        "type": "string"
                                                    },
                                                    "engine": {
                                                        "type": "string",
                                                        "description": "AI assistant key, e.g. `chatgpt`, `gemini` or `claude`."
                                                    },
                                                    "named": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "key": {
                                                                    "type": "string"
                                                                },
                                                                "name": {
                                                                    "type": "string"
                                                                },
                                                                "initial": {
                                                                    "type": "string"
                                                                },
                                                                "is_own": {
                                                                    "type": "boolean",
                                                                    "description": "True for your own brand."
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "brand_named": {
                                                        "type": "boolean"
                                                    },
                                                    "competitors_named": {
                                                        "type": "integer"
                                                    },
                                                    "engines_status": {
                                                        "type": "object",
                                                        "properties": {
                                                            "chatgpt": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "description": "Result per AI assistant, keyed by the assistant."
                                                    },
                                                    "gap_engines": {
                                                        "type": "integer"
                                                    },
                                                    "change": {
                                                        "type": "object",
                                                        "properties": {
                                                            "status": {
                                                                "type": "string",
                                                                "description": "Current status."
                                                            },
                                                            "since": {
                                                                "type": "string"
                                                            },
                                                            "scans": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                }
                                            },
                                            "description": "Missed questions: AI named a competitor and not you."
                                        },
                                        "present": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "question_id": {
                                                        "type": "integer",
                                                        "description": "ID of the question."
                                                    },
                                                    "text": {
                                                        "type": "string"
                                                    },
                                                    "engine": {
                                                        "type": "string",
                                                        "description": "AI assistant key, e.g. `chatgpt`, `gemini` or `claude`."
                                                    },
                                                    "named": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "key": {
                                                                    "type": "string"
                                                                },
                                                                "name": {
                                                                    "type": "string"
                                                                },
                                                                "initial": {
                                                                    "type": "string"
                                                                },
                                                                "is_own": {
                                                                    "type": "boolean",
                                                                    "description": "True for your own brand."
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "brand_named": {
                                                        "type": "boolean"
                                                    },
                                                    "competitors_named": {
                                                        "type": "integer"
                                                    },
                                                    "engines_status": {
                                                        "type": "object",
                                                        "properties": {
                                                            "chatgpt": {
                                                                "type": "string"
                                                            }
                                                        },
                                                        "description": "Result per AI assistant, keyed by the assistant."
                                                    },
                                                    "gap_engines": {
                                                        "type": "integer"
                                                    },
                                                    "change": {
                                                        "type": "object",
                                                        "properties": {
                                                            "status": {
                                                                "type": "string",
                                                                "description": "Current status."
                                                            },
                                                            "since": {
                                                                "type": "string"
                                                            },
                                                            "scans": {
                                                                "type": "integer"
                                                            }
                                                        }
                                                    }
                                                }
                                            },
                                            "description": "Questions where you were named."
                                        },
                                        "neither": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "top_competitor": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "properties": {
                                                "name": {
                                                    "type": "string"
                                                },
                                                "gaps": {
                                                    "type": "integer",
                                                    "description": "Missed questions: AI named a competitor and not you."
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "gaps"
                                            ]
                                        },
                                        "changes": {
                                            "description": "Compared with the previous finished scan: {previous_run_id, previous_date, won_back, lost, still}; null without one.",
                                            "anyOf": [
                                                {
                                                    "type": "object",
                                                    "properties": {
                                                        "previous_run_id": {
                                                            "type": "integer"
                                                        },
                                                        "previous_date": {
                                                            "type": [
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "won_back": {
                                                            "type": "integer"
                                                        },
                                                        "lost": {
                                                            "type": "integer"
                                                        },
                                                        "still": {
                                                            "type": "integer"
                                                        }
                                                    },
                                                    "required": [
                                                        "previous_run_id",
                                                        "previous_date",
                                                        "won_back",
                                                        "lost",
                                                        "still"
                                                    ]
                                                },
                                                {
                                                    "type": "string"
                                                },
                                                {
                                                    "type": "null"
                                                }
                                            ]
                                        },
                                        "suggestions": {
                                            "type": "object",
                                            "properties": {
                                                "used": {
                                                    "type": "integer"
                                                },
                                                "limit": {
                                                    "type": "integer"
                                                },
                                                "remaining": {
                                                    "type": "integer"
                                                },
                                                "resets_at": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    },
                                    "required": [
                                        "context",
                                        "total_selection",
                                        "limits",
                                        "gaps",
                                        "present",
                                        "neither",
                                        "top_competitor",
                                        "changes",
                                        "suggestions"
                                    ]
                                },
                                "example": {
                                    "context": {
                                        "…": "ReportContext — same shape as in GET /reports/overview"
                                    },
                                    "total_selection": 3,
                                    "gaps": [
                                        {
                                            "question_id": 350,
                                            "text": "بهترین نرم‌افزارهای حسابداری ابری در ایران کدام‌اند؟",
                                            "engine": "chatgpt",
                                            "named": [
                                                {
                                                    "key": "c163",
                                                    "name": "نیک‌حساب",
                                                    "initial": "ن",
                                                    "is_own": false
                                                },
                                                {
                                                    "key": "c164",
                                                    "name": "ترازنو",
                                                    "initial": "ت",
                                                    "is_own": false
                                                }
                                            ],
                                            "brand_named": false,
                                            "competitors_named": 4,
                                            "engines_status": {
                                                "chatgpt": "not_named"
                                            },
                                            "gap_engines": 1,
                                            "change": {
                                                "status": "new",
                                                "since": "2026-10-25T10:30:00Z",
                                                "scans": 1
                                            }
                                        },
                                        {
                                            "question_id": 351,
                                            "text": "بهترین نرم‌افزارهای حسابداری ابری برای شرکت‌های کوچک کدام‌اند؟",
                                            "engine": "chatgpt",
                                            "named": [
                                                {
                                                    "key": "c163",
                                                    "name": "نیک‌حساب",
                                                    "initial": "ن",
                                                    "is_own": false
                                                },
                                                {
                                                    "key": "c164",
                                                    "name": "ترازنو",
                                                    "initial": "ت",
                                                    "is_own": false
                                                }
                                            ],
                                            "brand_named": false,
                                            "competitors_named": 3,
                                            "engines_status": {
                                                "chatgpt": "not_named"
                                            },
                                            "gap_engines": 1,
                                            "change": {
                                                "status": "still",
                                                "since": null,
                                                "scans": 3
                                            }
                                        }
                                    ],
                                    "present": [
                                        {
                                            "question_id": 352,
                                            "text": "بهترین نرم‌افزارهای حسابداری ابری با اتصال به سامانه مودیان کدام‌اند؟",
                                            "engine": "chatgpt",
                                            "named": [
                                                {
                                                    "key": "own",
                                                    "name": "آوند",
                                                    "initial": "آ",
                                                    "is_own": true
                                                },
                                                {
                                                    "key": "c163",
                                                    "name": "نیک‌حساب",
                                                    "initial": "ن",
                                                    "is_own": false
                                                }
                                            ],
                                            "brand_named": true,
                                            "competitors_named": 2,
                                            "engines_status": {
                                                "chatgpt": "named"
                                            },
                                            "gap_engines": 0,
                                            "change": {
                                                "status": "won_back",
                                                "since": "2026-10-25T10:30:00Z",
                                                "scans": 0
                                            }
                                        }
                                    ],
                                    "neither": [],
                                    "top_competitor": {
                                        "name": "نیک‌حساب",
                                        "gaps": 2
                                    },
                                    "changes": {
                                        "previous_run_id": 37,
                                        "previous_date": "2026-10-25T10:30:00Z",
                                        "won_back": 1,
                                        "lost": 1,
                                        "still": 1
                                    },
                                    "suggestions": {
                                        "used": 1,
                                        "limit": 3,
                                        "remaining": 2,
                                        "resets_at": "2026-12-21T20:30:00Z"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand / unknown run or cell",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Missed questions",
                "description": "Unbranded `selection` questions where ≥1 competitor is named and the brand is not (`gaps`), where the brand is named (`present`), and where nobody from the list is named (`neither`), with per-engine status and the competitor with most gaps.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R2",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "parameters": [
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "run to show; 0/absent = default run. Free: only the default run",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`all` (default) | `chatgpt` | `gemini` | `claude` (must be in the plan)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cell_id",
                        "in": "query",
                        "required": false,
                        "description": "matrix cell; 0/absent = all cells",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "x-postman": {
                    "name": "R2 Gaps",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/reports/gaps/{questionId}/suggestion": {
            "post": {
                "operationId": "post-reports-gaps-questionid-suggestion",
                "tags": [
                    "Scans & reports"
                ],
                "parameters": [
                    {
                        "name": "questionId",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "a question in `gaps` of `GET /reports/gaps` (Postman `{{questionId}}`)",
                        "x-rawi-variable": "questionId",
                        "example": 345
                    },
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "same as R2; default run when absent (free: only the default run)",
                        "schema": {
                            "type": "integer"
                        },
                        "example": "{{runId}}"
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`chatgpt` | `gemini` | `claude`; absent/`all` = the first engine where this question is a gap",
                        "schema": {
                            "type": "string"
                        },
                        "example": "chatgpt"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "AiSuggestionResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "suggestion": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "question_id": {
                                                    "type": "integer",
                                                    "description": "ID of the question."
                                                },
                                                "run_id": {
                                                    "type": "integer",
                                                    "description": "ID of the scan."
                                                },
                                                "engine": {
                                                    "type": "string",
                                                    "description": "AI assistant key, e.g. `chatgpt`, `gemini` or `claude`."
                                                },
                                                "locale": {
                                                    "type": "string",
                                                    "description": "Language: `fa` or `en`."
                                                },
                                                "summary": {
                                                    "type": "string"
                                                },
                                                "steps": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "title": {
                                                                "type": "string"
                                                            },
                                                            "detail": {
                                                                "type": "string"
                                                            },
                                                            "source_domain": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "sources_to_target": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "generated_by": {
                                                    "type": "string"
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "description": "When it was created (ISO 8601)."
                                                }
                                            }
                                        },
                                        "cached": {
                                            "type": "boolean"
                                        },
                                        "usage": {
                                            "type": "object",
                                            "properties": {
                                                "used": {
                                                    "type": "integer"
                                                },
                                                "limit": {
                                                    "type": "integer"
                                                },
                                                "remaining": {
                                                    "type": "integer"
                                                },
                                                "resets_at": {
                                                    "type": "string"
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "suggestion": {
                                        "id": 1,
                                        "question_id": 350,
                                        "run_id": 38,
                                        "engine": "chatgpt",
                                        "locale": "fa",
                                        "summary": "ChatGPT در پاسخ به این پرسش از نیک‌حساب، ترازنو و دفتریار نام برد و از آوند نه. منبع‌هایی که نقل کرد: hesab-review.example، nikhesab.example و fanavari-news.example. …",
                                        "steps": [
                                            {
                                                "title": "در hesab-review.example دیده شوید",
                                                "detail": "ChatGPT برای این پرسش از hesab-review.example (سایت نقد و مقایسه) نقل کرد. …",
                                                "source_domain": "hesab-review.example"
                                            },
                                            {
                                                "title": "صفحه‌ای که مستقیم به این پرسش جواب بدهد",
                                                "detail": "در avand.example صفحه‌ای با عنوانی نزدیک به «…» بسازید …",
                                                "source_domain": "avand.example"
                                            },
                                            {
                                                "title": "نظر مشتریان را در سایت‌های نقد جمع کنید",
                                                "detail": "از مشتریان راضی بخواهید …",
                                                "source_domain": null
                                            }
                                        ],
                                        "sources_to_target": [
                                            "hesab-review.example",
                                            "fanavari-news.example"
                                        ],
                                        "generated_by": "mock",
                                        "created_at": "2026-11-25T11:16:30+00:00"
                                    },
                                    "cached": false,
                                    "usage": {
                                        "used": 1,
                                        "limit": 3,
                                        "remaining": 2,
                                        "resets_at": "2026-12-21T20:30:00Z"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token: `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`{\"code\":\"plan_limit\",\"remaining\":0,\"used\":3,\"limit\":3,\"resets_at\":\"…\",\"plan\":\"free\",\"paid_limit\":30,\"message\":\"…\"}` monthly allowance used up (`resets_at` = first day of the next Persian month, Asia/Tehran; the UI shows the upgrade link only when `plan` is `free`); also `plan_limit` for an older run / locked engine (as on R2)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "`{\"code\":\"not_a_gap\"}` the question is not a gap in this run and engine; no brand / unknown run",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`{\"code\":\"in_progress\"}` the same suggestion is being made right now",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ConfirmRequired"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "invalid `run_id` / `engine`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "more than 20 requests a minute",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    },
                    "502": {
                        "description": "`{\"code\":\"ai_unavailable\",\"message\":\"سرویس هوش مصنوعی الان در دسترس نیست…\"}` the AI call failed or returned unusable output (not counted)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "AI suggestion for a missed question",
                "description": "Advice for one gap (question × engine × run) in the panel language (`Accept-Language` fa|en): a summary, 3–5 numbered steps and the cited sources to get into. Built from the gap answer text, the brands it named, the sources it cited with their types, and the brand / product / target-customer context, through the `advisor` task route (same connection as `answer_analyzer`; mock connection = deterministic suggestion from the data). See docs/AI-JARVIS.md §5.\n\n- Cached in `ai_suggestions` per (brand, run, question, engine, locale): the first call returns **201**, a repeat returns the stored row with **200** and `cached: true` (not counted).\n- Limit before any paid call: plan `ai_suggestions_per_month` (free 3, paid 30) new suggestions per calendar month; failed attempts do not count.\n- Model output is untrusted: the server parses JSON robustly, strips HTML, bounds every string and keeps only valid domains. Clients must render it as text.\n- One Idempotency-Key per request is sent to Jarvis and stored on the row.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R2 «پیشنهاد هوش مصنوعی»",
                "x-rawi-throttle": "20/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "R2 AI suggestion for a gap",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/reports/overview": {
            "get": {
                "operationId": "get-reports-overview",
                "tags": [
                    "Scans & reports"
                ],
                "responses": {
                    "200": {
                        "description": "OverviewReport\n\nPaid: 3 engines in `shares[].by_engine`, all discovered brands, and `by_cell` (SoV per target customer), e.g. `[{\"cell_id\":10,\"label\":\"شرکت‌های خرد و کوچک در ایران\",\"share\":9.1,\"questions\":4}]`. An engine that failed in the run has `available:false` («در این اجرا در دسترس نبود») and is left out of the numbers.\nQueued (`state: \"queued\"`): `\"queue\": {\"position\":3,\"eta_days\":2,\"boost_per_invite\":10,\"invite_max\":5}`, same object as in\n`GET /me`. The R1 queue card reads «با هر کسی که با لینک دعوت شما ثبت‌نام کند، {boost_per_invite} پله در صف جلو می‌روید. تا\n{invite_max} دعوت شمرده می‌شود.» The ETA counts to the end of the current Persian (Jalali) month when the free cap is full.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "context": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "state": {
                                                    "type": "string",
                                                    "description": "no_brand: the brand has no share of voice — never named (visibility 0) or named only outside the selection\nquestions SoV counts (visible elsewhere, share 0). R1 then explains instead of «you are N-th of N».",
                                                    "enum": [
                                                        "empty_market",
                                                        "no_brand",
                                                        "ready"
                                                    ]
                                                },
                                                "progress": {
                                                    "type": "object",
                                                    "properties": {
                                                        "done": {
                                                            "type": "integer"
                                                        },
                                                        "total": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "steps": {
                                                            "type": "array",
                                                            "prefixItems": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "generated"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "asking"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "analyzing"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "building"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "done",
                                                                                "current",
                                                                                "pending"
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                }
                                                            ],
                                                            "minItems": 4,
                                                            "maxItems": 4
                                                        },
                                                        "engines_status": {
                                                            "type": "string"
                                                        },
                                                        "attempt": {},
                                                        "mentioned_so_far": {
                                                            "type": "object",
                                                            "additionalProperties": {}
                                                        }
                                                    },
                                                    "required": [
                                                        "done",
                                                        "total",
                                                        "steps",
                                                        "engines_status",
                                                        "attempt",
                                                        "mentioned_so_far"
                                                    ]
                                                },
                                                "own": {
                                                    "type": "object",
                                                    "properties": {
                                                        "share": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "string"
                                                                },
                                                                {
                                                                    "type": "number",
                                                                    "const": 0
                                                                }
                                                            ]
                                                        },
                                                        "rank": {
                                                            "type": [
                                                                "integer",
                                                                "null"
                                                            ]
                                                        },
                                                        "tied_with": {
                                                            "type": "integer",
                                                            "description": "Other brands with exactly the same share (rank above is shared with them: «tied for 2nd of 6»)."
                                                        },
                                                        "brands_count": {
                                                            "type": "integer"
                                                        },
                                                        "delta": {
                                                            "type": [
                                                                "number",
                                                                "string",
                                                                "null"
                                                            ]
                                                        },
                                                        "visibility": {
                                                            "type": "number"
                                                        },
                                                        "visible_answers": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "total_answers": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "unbranded_answers": {
                                                            "type": "integer",
                                                            "description": "Explicit names for the visibility denominator: answers (all samples) to unbranded questions.",
                                                            "minimum": 0
                                                        },
                                                        "unbranded_answers_named": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "selection_answers": {
                                                            "type": "integer",
                                                            "description": "Share of voice counts mentions in the answers to unbranded «vendor selection» questions only.",
                                                            "minimum": 0
                                                        },
                                                        "sources_count": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        }
                                                    },
                                                    "required": [
                                                        "share",
                                                        "rank",
                                                        "tied_with",
                                                        "brands_count",
                                                        "delta",
                                                        "visibility",
                                                        "visible_answers",
                                                        "total_answers",
                                                        "unbranded_answers",
                                                        "unbranded_answers_named",
                                                        "selection_answers",
                                                        "sources_count"
                                                    ]
                                                },
                                                "leader": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "name": {
                                                            "type": "string"
                                                        },
                                                        "share": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "required": [
                                                        "name",
                                                        "share"
                                                    ]
                                                },
                                                "shares": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "key": {
                                                                "type": "string"
                                                            },
                                                            "name": {
                                                                "type": "string"
                                                            },
                                                            "initial": {
                                                                "type": "string"
                                                            },
                                                            "is_own": {
                                                                "type": "string"
                                                            },
                                                            "is_competitor": {
                                                                "type": "boolean"
                                                            },
                                                            "share": {
                                                                "type": "string"
                                                            },
                                                            "mentions": {
                                                                "type": "string"
                                                            },
                                                            "delta": {
                                                                "type": [
                                                                    "number",
                                                                    "null"
                                                                ]
                                                            },
                                                            "by_engine": {
                                                                "type": "array",
                                                                "items": {}
                                                            }
                                                        },
                                                        "required": [
                                                            "key",
                                                            "name",
                                                            "initial",
                                                            "is_own",
                                                            "is_competitor",
                                                            "share",
                                                            "mentions",
                                                            "delta",
                                                            "by_engine"
                                                        ]
                                                    }
                                                },
                                                "selection_questions": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "gaps_count": {
                                                    "type": "integer"
                                                },
                                                "discovered": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "discovered_total": {
                                                    "type": "integer"
                                                },
                                                "coverage": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "stage": {
                                                                "type": "string"
                                                            },
                                                            "parent": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "enum": [
                                                                    "selection",
                                                                    null
                                                                ]
                                                            },
                                                            "asked": {
                                                                "type": "integer"
                                                            },
                                                            "total": {}
                                                        },
                                                        "required": [
                                                            "stage",
                                                            "parent",
                                                            "asked",
                                                            "total"
                                                        ]
                                                    }
                                                },
                                                "cited_sources_when_empty": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "queue": {
                                                    "type": "null"
                                                },
                                                "by_cell": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "cell_id": {
                                                                "type": "string"
                                                            },
                                                            "label": {
                                                                "type": "string"
                                                            },
                                                            "share": {
                                                                "type": "string"
                                                            },
                                                            "questions": {
                                                                "type": "integer",
                                                                "minimum": 0
                                                            }
                                                        },
                                                        "required": [
                                                            "cell_id",
                                                            "label",
                                                            "share",
                                                            "questions"
                                                        ]
                                                    }
                                                },
                                                "samples": {
                                                    "type": "integer"
                                                },
                                                "sov_range": {
                                                    "type": [
                                                        "object",
                                                        "null"
                                                    ],
                                                    "properties": {
                                                        "low": {
                                                            "type": "number"
                                                        },
                                                        "high": {
                                                            "type": "number"
                                                        }
                                                    },
                                                    "required": [
                                                        "low",
                                                        "high"
                                                    ]
                                                },
                                                "basis": {
                                                    "type": "object",
                                                    "description": "What the share of voice rests on (R1 «Based on m mentions in k answers from s scan»): tracked-brand\nmentions in the answers to unbranded vendor-selection questions of this one scan.",
                                                    "properties": {
                                                        "mentions": {
                                                            "type": "integer"
                                                        },
                                                        "answers": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "questions": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "scans": {
                                                            "type": "integer",
                                                            "const": 1
                                                        }
                                                    },
                                                    "required": [
                                                        "mentions",
                                                        "answers",
                                                        "questions",
                                                        "scans"
                                                    ]
                                                },
                                                "changes": {
                                                    "description": "Missed questions compared with the previous finished scan (null without one).",
                                                    "anyOf": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "previous_run_id": {
                                                                    "type": "integer"
                                                                },
                                                                "previous_date": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "won_back": {
                                                                    "type": "integer"
                                                                },
                                                                "lost": {
                                                                    "type": "integer"
                                                                },
                                                                "still": {
                                                                    "type": "integer"
                                                                }
                                                            },
                                                            "required": [
                                                                "previous_run_id",
                                                                "previous_date",
                                                                "won_back",
                                                                "lost",
                                                                "still"
                                                            ]
                                                        },
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "null"
                                                        }
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "context",
                                                "state",
                                                "progress",
                                                "own",
                                                "leader",
                                                "shares",
                                                "selection_questions",
                                                "gaps_count",
                                                "discovered",
                                                "discovered_total",
                                                "coverage",
                                                "cited_sources_when_empty",
                                                "queue",
                                                "by_cell",
                                                "samples",
                                                "sov_range",
                                                "basis",
                                                "changes"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "context": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "state": {
                                                    "type": "string",
                                                    "const": "failed"
                                                },
                                                "progress": {
                                                    "type": "object",
                                                    "properties": {
                                                        "done": {
                                                            "type": "integer"
                                                        },
                                                        "total": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "steps": {
                                                            "type": "array",
                                                            "prefixItems": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "generated"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "asking"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "analyzing"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "building"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "done",
                                                                                "current",
                                                                                "pending"
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                }
                                                            ],
                                                            "minItems": 4,
                                                            "maxItems": 4
                                                        },
                                                        "engines_status": {
                                                            "type": "string"
                                                        },
                                                        "attempt": {},
                                                        "mentioned_so_far": {
                                                            "type": "object",
                                                            "additionalProperties": {}
                                                        }
                                                    },
                                                    "required": [
                                                        "done",
                                                        "total",
                                                        "steps",
                                                        "engines_status",
                                                        "attempt",
                                                        "mentioned_so_far"
                                                    ]
                                                },
                                                "own": {
                                                    "type": "null"
                                                },
                                                "leader": {
                                                    "type": "null"
                                                },
                                                "shares": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "selection_questions": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "gaps_count": {
                                                    "type": "integer",
                                                    "const": 0
                                                },
                                                "discovered": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "discovered_total": {
                                                    "type": "integer",
                                                    "const": 0
                                                },
                                                "coverage": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "stage": {
                                                                "type": "string"
                                                            },
                                                            "parent": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "enum": [
                                                                    "selection",
                                                                    null
                                                                ]
                                                            },
                                                            "asked": {
                                                                "type": "integer"
                                                            },
                                                            "total": {}
                                                        },
                                                        "required": [
                                                            "stage",
                                                            "parent",
                                                            "asked",
                                                            "total"
                                                        ]
                                                    }
                                                },
                                                "cited_sources_when_empty": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "queue": {
                                                    "type": "null"
                                                },
                                                "by_cell": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "samples": {
                                                    "type": "integer",
                                                    "const": 1
                                                },
                                                "sov_range": {
                                                    "type": "null"
                                                },
                                                "basis": {
                                                    "type": "null"
                                                },
                                                "changes": {
                                                    "type": "null"
                                                }
                                            },
                                            "required": [
                                                "context",
                                                "state",
                                                "progress",
                                                "own",
                                                "leader",
                                                "shares",
                                                "selection_questions",
                                                "gaps_count",
                                                "discovered",
                                                "discovered_total",
                                                "coverage",
                                                "cited_sources_when_empty",
                                                "queue",
                                                "by_cell",
                                                "samples",
                                                "sov_range",
                                                "basis",
                                                "changes"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "context": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "state": {
                                                    "type": "string",
                                                    "const": "building"
                                                },
                                                "progress": {
                                                    "type": "object",
                                                    "properties": {
                                                        "done": {
                                                            "type": "integer"
                                                        },
                                                        "total": {
                                                            "type": "integer",
                                                            "minimum": 0
                                                        },
                                                        "steps": {
                                                            "type": "array",
                                                            "prefixItems": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "generated"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "asking"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "analyzing"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "const": "done"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "key": {
                                                                            "type": "string",
                                                                            "const": "building"
                                                                        },
                                                                        "status": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "done",
                                                                                "current",
                                                                                "pending"
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "key",
                                                                        "status"
                                                                    ]
                                                                }
                                                            ],
                                                            "minItems": 4,
                                                            "maxItems": 4
                                                        },
                                                        "engines_status": {
                                                            "type": "string"
                                                        },
                                                        "attempt": {},
                                                        "mentioned_so_far": {
                                                            "type": "object",
                                                            "additionalProperties": {}
                                                        }
                                                    },
                                                    "required": [
                                                        "done",
                                                        "total",
                                                        "steps",
                                                        "engines_status",
                                                        "attempt",
                                                        "mentioned_so_far"
                                                    ]
                                                },
                                                "own": {
                                                    "type": "null"
                                                },
                                                "leader": {
                                                    "type": "null"
                                                },
                                                "shares": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "selection_questions": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "gaps_count": {
                                                    "type": "integer",
                                                    "const": 0
                                                },
                                                "discovered": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "discovered_total": {
                                                    "type": "integer",
                                                    "const": 0
                                                },
                                                "coverage": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "stage": {
                                                                "type": "string"
                                                            },
                                                            "parent": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "enum": [
                                                                    "selection",
                                                                    null
                                                                ]
                                                            },
                                                            "asked": {
                                                                "type": "integer"
                                                            },
                                                            "total": {}
                                                        },
                                                        "required": [
                                                            "stage",
                                                            "parent",
                                                            "asked",
                                                            "total"
                                                        ]
                                                    }
                                                },
                                                "cited_sources_when_empty": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "queue": {
                                                    "type": "null"
                                                },
                                                "by_cell": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "samples": {
                                                    "type": "integer",
                                                    "const": 1
                                                },
                                                "sov_range": {
                                                    "type": "null"
                                                },
                                                "basis": {
                                                    "type": "null"
                                                },
                                                "changes": {
                                                    "type": "null"
                                                }
                                            },
                                            "required": [
                                                "context",
                                                "state",
                                                "progress",
                                                "own",
                                                "leader",
                                                "shares",
                                                "selection_questions",
                                                "gaps_count",
                                                "discovered",
                                                "discovered_total",
                                                "coverage",
                                                "cited_sources_when_empty",
                                                "queue",
                                                "by_cell",
                                                "samples",
                                                "sov_range",
                                                "basis",
                                                "changes"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "context": {
                                                    "type": "array",
                                                    "items": {}
                                                },
                                                "state": {
                                                    "type": "string",
                                                    "enum": [
                                                        "queued",
                                                        "building"
                                                    ]
                                                },
                                                "progress": {
                                                    "type": "null"
                                                },
                                                "own": {
                                                    "type": "null"
                                                },
                                                "leader": {
                                                    "type": "null"
                                                },
                                                "shares": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "selection_questions": {
                                                    "type": "integer",
                                                    "const": 0
                                                },
                                                "gaps_count": {
                                                    "type": "integer",
                                                    "const": 0
                                                },
                                                "discovered": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "discovered_total": {
                                                    "type": "integer",
                                                    "const": 0
                                                },
                                                "coverage": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "stage": {
                                                                "type": "string"
                                                            },
                                                            "parent": {
                                                                "type": [
                                                                    "string",
                                                                    "null"
                                                                ],
                                                                "enum": [
                                                                    "selection",
                                                                    null
                                                                ]
                                                            },
                                                            "asked": {
                                                                "type": "integer"
                                                            },
                                                            "total": {}
                                                        },
                                                        "required": [
                                                            "stage",
                                                            "parent",
                                                            "asked",
                                                            "total"
                                                        ]
                                                    }
                                                },
                                                "cited_sources_when_empty": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "queue": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "by_cell": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                },
                                                "samples": {
                                                    "type": "integer",
                                                    "const": 1
                                                },
                                                "sov_range": {
                                                    "type": "null"
                                                },
                                                "basis": {
                                                    "type": "null"
                                                },
                                                "changes": {
                                                    "type": "null"
                                                }
                                            },
                                            "required": [
                                                "context",
                                                "state",
                                                "progress",
                                                "own",
                                                "leader",
                                                "shares",
                                                "selection_questions",
                                                "gaps_count",
                                                "discovered",
                                                "discovered_total",
                                                "coverage",
                                                "cited_sources_when_empty",
                                                "queue",
                                                "by_cell",
                                                "samples",
                                                "sov_range",
                                                "basis",
                                                "changes"
                                            ]
                                        }
                                    ]
                                },
                                "example": {
                                    "context": {
                                        "run": {
                                            "id": 38,
                                            "kind": "scheduled",
                                            "status": "complete",
                                            "engines": [
                                                "chatgpt"
                                            ],
                                            "started_at": "2026-11-25T10:16:00Z",
                                            "finished_at": "2026-11-25T10:30:00Z",
                                            "done": 10,
                                            "total": 10
                                        },
                                        "previous_run": {
                                            "id": 37,
                                            "kind": "scheduled",
                                            "status": "complete",
                                            "engines": [
                                                "chatgpt"
                                            ],
                                            "started_at": "2026-10-25T10:16:00Z",
                                            "finished_at": "2026-10-25T10:30:00Z",
                                            "done": 10,
                                            "total": 10
                                        },
                                        "latest_run": {
                                            "id": 38,
                                            "kind": "scheduled",
                                            "status": "complete",
                                            "engines": [
                                                "chatgpt"
                                            ],
                                            "started_at": "2026-11-25T10:16:00Z",
                                            "finished_at": "2026-11-25T10:30:00Z",
                                            "done": 10,
                                            "total": 10
                                        },
                                        "runs": [
                                            {
                                                "id": 38,
                                                "kind": "scheduled",
                                                "status": "complete",
                                                "engines": [
                                                    "chatgpt"
                                                ],
                                                "started_at": "2026-11-25T10:16:00Z",
                                                "finished_at": "2026-11-25T10:30:00Z",
                                                "done": 10,
                                                "total": 10
                                            }
                                        ],
                                        "engines": [
                                            {
                                                "engine": "chatgpt",
                                                "available": true,
                                                "locked": false
                                            },
                                            {
                                                "engine": "gemini",
                                                "available": false,
                                                "locked": true
                                            }
                                        ],
                                        "cells": [
                                            {
                                                "id": 9,
                                                "product_id": 39,
                                                "target_customer_id": 41,
                                                "label": "نرم‌افزار حسابداری ابری، برای شرکت‌های خرد و کوچک در ایران",
                                                "short_label": "شرکت‌های خرد و کوچک در ایران",
                                                "active": true,
                                                "position": 1
                                            }
                                        ],
                                        "filters": {
                                            "run_id": 38,
                                            "engine": "all",
                                            "cell_id": 0
                                        },
                                        "building": false,
                                        "small_sample": false,
                                        "engines_offline": false
                                    },
                                    "state": "ready",
                                    "progress": null,
                                    "own": {
                                        "share": 18.8,
                                        "rank": 3,
                                        "brands_count": 6,
                                        "delta": 2.6,
                                        "visibility": 37.5,
                                        "visible_answers": 3,
                                        "total_answers": 8,
                                        "sources_count": 23,
                                        "tied_with": 0
                                    },
                                    "leader": {
                                        "name": "نیک‌حساب",
                                        "share": 34.4
                                    },
                                    "shares": [
                                        {
                                            "key": "c163",
                                            "name": "نیک‌حساب",
                                            "initial": "ن",
                                            "is_own": false,
                                            "is_competitor": true,
                                            "share": 34.4,
                                            "mentions": 11,
                                            "delta": -0.7,
                                            "by_engine": {
                                                "chatgpt": 34.4
                                            }
                                        },
                                        {
                                            "key": "c164",
                                            "name": "ترازنو",
                                            "initial": "ت",
                                            "is_own": false,
                                            "is_competitor": true,
                                            "share": 25,
                                            "mentions": 8,
                                            "delta": -2,
                                            "by_engine": {
                                                "chatgpt": 25
                                            }
                                        }
                                    ],
                                    "selection_questions": 3,
                                    "gaps_count": 2,
                                    "discovered": [
                                        {
                                            "key": "d:حسابیار",
                                            "name": "حساب‌یار",
                                            "initial": "ح",
                                            "answers": 2
                                        },
                                        {
                                            "key": "d:پارسدفتر",
                                            "name": "پارس‌دفتر",
                                            "initial": "پ",
                                            "answers": 1
                                        }
                                    ],
                                    "discovered_total": 2,
                                    "coverage": [
                                        {
                                            "stage": "problem",
                                            "parent": null,
                                            "asked": 1,
                                            "total": 3
                                        },
                                        {
                                            "stage": "selection",
                                            "parent": null,
                                            "asked": 3,
                                            "total": 8
                                        },
                                        {
                                            "stage": "alternative",
                                            "parent": "selection",
                                            "asked": 1,
                                            "total": 2
                                        }
                                    ],
                                    "cited_sources_when_empty": [],
                                    "queue": null,
                                    "by_cell": [],
                                    "samples": 1,
                                    "sov_range": null,
                                    "basis": {
                                        "mentions": 32,
                                        "answers": 3,
                                        "questions": 3,
                                        "scans": 1
                                    },
                                    "changes": {
                                        "previous_run_id": 37,
                                        "previous_date": "2026-10-25T10:30:00Z",
                                        "won_back": 1,
                                        "lost": 1,
                                        "still": 1
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit` — older run or locked engine on the free plan",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand / unknown `run_id` or `cell_id`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (run_id, engine, cell_id)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Market overview",
                "description": "Share of voice table (brand + competitors, per engine, delta vs previous run), own rank/visibility/sources, leader, discovered brands, stage coverage. `state`: `building` (first run in progress, partial numbers «در حال کامل شدن»), `queued` (free queue), `ready`, `empty_market` (nobody named — `cited_sources_when_empty` filled), `no_brand` (own SoV 0 → suggest the app), `failed`. Fires `first_report_viewed` once.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R1 (+ O9 building state)",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "parameters": [
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "run to show; 0/absent = default run. Free: only the default run",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`all` (default) | `chatgpt` | `gemini` | `claude` (must be in the plan)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cell_id",
                        "in": "query",
                        "required": false,
                        "description": "matrix cell; 0/absent = all cells",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "x-postman": {
                    "name": "R1 Overview (market)",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/reports/questions": {
            "get": {
                "operationId": "get-reports-questions",
                "tags": [
                    "Scans & reports"
                ],
                "responses": {
                    "200": {
                        "description": "QuestionsReport",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "context": {
                                            "type": "object",
                                            "properties": {
                                                "…": {
                                                    "type": "string"
                                                }
                                            },
                                            "description": "The filters this report was built with (scan, AI assistant, audience)."
                                        },
                                        "asked": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "answers_with_brand": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "answered": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "questions_count": {
                                            "type": "integer",
                                            "description": "Same numbers under explicit names: questions asked, answers (all questions, engines, samples) naming you.",
                                            "minimum": 0
                                        },
                                        "answers_named": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "answers_total": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "coverage": {
                                            "type": "array",
                                            "description": "The same coverage breakdown as R1 (same groups as the list below, same counting rule).",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "stage": {
                                                        "type": "string",
                                                        "description": "Buying stage of the question."
                                                    },
                                                    "parent": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "enum": [
                                                            "selection",
                                                            null
                                                        ]
                                                    },
                                                    "asked": {
                                                        "type": "integer"
                                                    },
                                                    "total": {}
                                                },
                                                "required": [
                                                    "stage",
                                                    "parent",
                                                    "asked",
                                                    "total"
                                                ]
                                            }
                                        },
                                        "groups": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "key": {
                                                        "type": "string"
                                                    },
                                                    "parent": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "«alternative» (names a competitor) is shown as part of vendor selection.",
                                                        "enum": [
                                                            "selection",
                                                            null
                                                        ]
                                                    },
                                                    "present": {
                                                        "type": "integer",
                                                        "description": "present / total: question × engine pairs where the brand is named (kept for older clients)."
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "questions_count": {
                                                        "type": "integer",
                                                        "description": "Explicit denominators: questions in the group, and answers (every engine and sample) naming the brand.",
                                                        "minimum": 0
                                                    },
                                                    "answers_named": {
                                                        "type": "integer"
                                                    },
                                                    "answers_total": {
                                                        "type": "integer"
                                                    },
                                                    "questions": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "additionalProperties": {
                                                                "type": "string"
                                                            }
                                                        }
                                                    }
                                                },
                                                "required": [
                                                    "key",
                                                    "parent",
                                                    "present",
                                                    "total",
                                                    "questions_count",
                                                    "answers_named",
                                                    "answers_total",
                                                    "questions"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "context",
                                        "asked",
                                        "answers_with_brand",
                                        "answered",
                                        "questions_count",
                                        "answers_named",
                                        "answers_total",
                                        "coverage",
                                        "groups"
                                    ]
                                },
                                "example": {
                                    "context": {
                                        "…": "ReportContext — same shape as in GET /reports/overview"
                                    },
                                    "asked": 10,
                                    "answers_with_brand": 4,
                                    "answered": 10,
                                    "coverage": [
                                        {
                                            "stage": "problem",
                                            "asked": 1,
                                            "total": 3
                                        },
                                        {
                                            "stage": "solution",
                                            "asked": 2,
                                            "total": 4
                                        }
                                    ],
                                    "groups": [
                                        {
                                            "key": "problem",
                                            "present": 0,
                                            "total": 1,
                                            "questions": [
                                                {
                                                    "id": 345,
                                                    "stage": "problem",
                                                    "type": "unbranded",
                                                    "text": "نشانه‌های اینکه یک شرکت کوچک به نرم‌افزار حسابداری ابری نیاز دارد چیست؟",
                                                    "brand_named": false,
                                                    "engines_named": {
                                                        "chatgpt": false
                                                    },
                                                    "status": "ok"
                                                }
                                            ]
                                        },
                                        {
                                            "key": "solution",
                                            "present": 1,
                                            "total": 2,
                                            "questions": [
                                                {
                                                    "id": 346,
                                                    "stage": "solution",
                                                    "type": "unbranded",
                                                    "text": "انواع نرم‌افزار حسابداری ابری چیست و هر کدام برای چه شرکتی مناسب است؟",
                                                    "brand_named": false,
                                                    "engines_named": {
                                                        "chatgpt": false
                                                    },
                                                    "status": "ok"
                                                },
                                                {
                                                    "id": 347,
                                                    "stage": "solution",
                                                    "type": "unbranded",
                                                    "text": "برای یک شرکت کوچک، نرم‌افزار حسابداری ابری بهتر است یا برون‌سپاری به دفتر حسابداری؟",
                                                    "brand_named": true,
                                                    "engines_named": {
                                                        "chatgpt": true
                                                    },
                                                    "status": "ok"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand / unknown run or cell",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Questions & answers (list)",
                "description": "Questions grouped by stage plus the separate groups `alternative` (competitor/comparison: «حضور به‌عنوان جایگزین») and `branded` («وقتی نام شما را می‌پرسند»), each with whether the brand was named per engine.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R4",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "parameters": [
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "run to show; 0/absent = default run. Free: only the default run",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`all` (default) | `chatgpt` | `gemini` | `claude` (must be in the plan)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cell_id",
                        "in": "query",
                        "required": false,
                        "description": "matrix cell; 0/absent = all cells",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "x-postman": {
                    "name": "R4 Questions & answers (list)",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/reports/questions/{id}": {
            "get": {
                "operationId": "get-reports-questions-id",
                "tags": [
                    "Scans & reports"
                ],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Postman variable `{{questionId}}`",
                        "x-rawi-variable": "questionId",
                        "example": 345
                    },
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "run to show; 0/absent = default run. Free: only the default run",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`all` (default) | `chatgpt` | `gemini` | `claude` (must be in the plan)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cell_id",
                        "in": "query",
                        "required": false,
                        "description": "matrix cell; 0/absent = all cells",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "QuestionDetail\n\nFree plan source item: `{\"domain\":\"hesab-review.example\",\"url\":null,\"initial\":\"H\",\"type\":\"review\"}`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "context": {
                                            "type": "object",
                                            "properties": {
                                                "…": {
                                                    "type": "string"
                                                }
                                            },
                                            "description": "The filters this report was built with (scan, AI assistant, audience)."
                                        },
                                        "question": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "stage": {
                                                    "type": "string",
                                                    "description": "Buying stage of the question."
                                                },
                                                "type": {
                                                    "type": "string"
                                                },
                                                "text": {
                                                    "type": "string"
                                                },
                                                "language": {
                                                    "type": "string",
                                                    "description": "The question's (and its answers') language, for lang/dir on data text in the UI (fa answers in the en UI)."
                                                },
                                                "cell_id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ]
                                                },
                                                "position": {
                                                    "type": "integer"
                                                },
                                                "edited": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "stage",
                                                "type",
                                                "text",
                                                "language",
                                                "cell_id",
                                                "position",
                                                "edited"
                                            ]
                                        },
                                        "answers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "engine": {
                                                        "type": "string",
                                                        "description": "AI assistant key, e.g. `chatgpt`, `gemini` or `claude`."
                                                    },
                                                    "sample": {
                                                        "type": "integer"
                                                    },
                                                    "run_id": {
                                                        "type": "integer",
                                                        "description": "0-based ask number within the run (AI route `repeats`)"
                                                    },
                                                    "run_date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "text": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "named": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "brand_named": {
                                                        "type": "boolean"
                                                    },
                                                    "highlights": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "start": {
                                                                    "type": "integer"
                                                                },
                                                                "end": {
                                                                    "type": "integer"
                                                                },
                                                                "key": {
                                                                    "type": "string"
                                                                },
                                                                "is_own": {
                                                                    "type": "boolean",
                                                                    "description": "True for your own brand."
                                                                }
                                                            }
                                                        }
                                                    },
                                                    "sources": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "domain": {
                                                                    "type": "string",
                                                                    "description": "Site domain."
                                                                },
                                                                "url": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ],
                                                                    "description": "Full address (URL)."
                                                                },
                                                                "initial": {
                                                                    "type": "string"
                                                                },
                                                                "type": {
                                                                    "type": "string"
                                                                }
                                                            },
                                                            "required": [
                                                                "domain",
                                                                "url",
                                                                "initial",
                                                                "type"
                                                            ]
                                                        }
                                                    }
                                                },
                                                "required": [
                                                    "engine",
                                                    "sample",
                                                    "run_id",
                                                    "run_date",
                                                    "status",
                                                    "text",
                                                    "named",
                                                    "brand_named",
                                                    "highlights",
                                                    "sources"
                                                ]
                                            }
                                        },
                                        "next_question_id": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "ID of the next question in the list (null on the last one)."
                                        },
                                        "prev_question_id": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "ID of the previous question in the list (null on the first one)."
                                        }
                                    },
                                    "required": [
                                        "context",
                                        "question",
                                        "answers",
                                        "next_question_id",
                                        "prev_question_id"
                                    ]
                                },
                                "example": {
                                    "context": {
                                        "…": "ReportContext — same shape as in GET /reports/overview"
                                    },
                                    "question": {
                                        "id": 350,
                                        "stage": "selection",
                                        "type": "unbranded",
                                        "text": "بهترین نرم‌افزارهای حسابداری ابری در ایران کدام‌اند؟",
                                        "cell_id": 9,
                                        "position": 6,
                                        "edited": false
                                    },
                                    "answers": [
                                        {
                                            "engine": "chatgpt",
                                            "run_id": 38,
                                            "run_date": "2026-11-25T10:30:00Z",
                                            "status": "ok",
                                            "text": "برای شرکت‌های خرد و کوچک در ایران، چند نرم‌افزار حسابداری ابری بیشتر از بقیه پیشنهاد می‌شوند. نیک‌حساب برای شرکت‌هایی مناسب است که انبار و فروش را هم می‌خواهند. ترازنو قیمت پایین‌تری دارد و برای شروع …",
                                            "named": [
                                                {
                                                    "key": "c163",
                                                    "name": "نیک‌حساب",
                                                    "initial": "ن",
                                                    "is_own": false
                                                },
                                                {
                                                    "key": "c164",
                                                    "name": "ترازنو",
                                                    "initial": "ت",
                                                    "is_own": false
                                                }
                                            ],
                                            "brand_named": false,
                                            "highlights": [
                                                {
                                                    "start": 101,
                                                    "end": 109,
                                                    "key": "c163",
                                                    "is_own": false
                                                },
                                                {
                                                    "start": 164,
                                                    "end": 170,
                                                    "key": "c164",
                                                    "is_own": false
                                                }
                                            ],
                                            "sources": [
                                                {
                                                    "domain": "hesab-review.example",
                                                    "url": "https://hesab-review.example/best-cloud-accounting-1405",
                                                    "initial": "H",
                                                    "type": "review"
                                                },
                                                {
                                                    "domain": "nikhesab.example",
                                                    "url": "https://nikhesab.example/",
                                                    "initial": "N",
                                                    "type": "competitor"
                                                }
                                            ]
                                        }
                                    ],
                                    "next_question_id": 351,
                                    "prev_question_id": 349
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Unknown id (or not owned by the caller); the UI shows «این پرسش پیدا نشد.»",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Question detail",
                "description": "Full answer text of each engine, named brands and cited sources, with prev/next navigation. Free: answers of the selected (latest) run only; paid: every run.\n\n- `highlights`: where the own brand (`key: own`) and the named competitors (`c<id>`) appear in `text`, as code-point offsets (`end` exclusive, sorted, non-overlapping). Found with every name variant and the analysis tolerances (Arabic/Persian letter forms, diacritics, ZWNJ, case); only brands recorded as mentions of that answer are marked. The UI marks them in the answer text.\n- `sources[].url`: exact citation pages follow the the app rule. On the free plan (`citations_full: false`) `url` is `null` and only the domain is returned.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R4 detail",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "R4 Question detail",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/reports/share-card": {
            "get": {
                "operationId": "get-reports-share-card",
                "tags": [
                    "Scans & reports"
                ],
                "responses": {
                    "200": {
                        "description": "ShareCard",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "brand": {
                                            "type": "string"
                                        },
                                        "share": {
                                            "anyOf": [
                                                {
                                                    "type": "string"
                                                },
                                                {
                                                    "type": "number",
                                                    "const": 0
                                                }
                                            ]
                                        },
                                        "rank": {
                                            "type": [
                                                "integer",
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "brands_count": {
                                            "type": [
                                                "string",
                                                "integer"
                                            ]
                                        },
                                        "engine_label": {
                                            "type": "string"
                                        },
                                        "date": {
                                            "type": "string"
                                        },
                                        "rows": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "masked": {
                                            "type": "boolean"
                                        }
                                    },
                                    "required": [
                                        "brand",
                                        "share",
                                        "rank",
                                        "brands_count",
                                        "engine_label",
                                        "date",
                                        "rows",
                                        "masked"
                                    ]
                                },
                                "example": {
                                    "brand": "آوند",
                                    "share": 18.8,
                                    "rank": 3,
                                    "brands_count": 6,
                                    "engine_label": "ChatGPT",
                                    "date": "2026-11-25T10:30:00Z",
                                    "rows": [
                                        {
                                            "label": "رقیب ۱",
                                            "share": 34.4,
                                            "is_own": false
                                        },
                                        {
                                            "label": "رقیب ۲",
                                            "share": 25,
                                            "is_own": false
                                        }
                                    ],
                                    "masked": true
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Share card",
                "description": "Data for the shareable SoV card. Competitor names are masked as «رقیب ۱…» unless `masked=0`. Fires `share_card_created`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R1 «ساخت کارت قابل اشتراک»",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "parameters": [
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "run to show; 0/absent = default run. Free: only the default run",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`all` (default) | `chatgpt` | `gemini` | `claude` (must be in the plan)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cell_id",
                        "in": "query",
                        "required": false,
                        "description": "matrix cell; 0/absent = all cells",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "masked",
                        "in": "query",
                        "required": false,
                        "description": "`1` (default) or `0`/`false` for real names",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "x-postman": {
                    "name": "R1 Share card",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/reports/trend": {
            "get": {
                "operationId": "get-reports-trend",
                "tags": [
                    "Scans & reports"
                ],
                "parameters": [
                    {
                        "name": "metric",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "enum": [
                                "sov",
                                "visibility",
                                null
                            ]
                        },
                        "description": "`sov` (default) | `visibility`"
                    },
                    {
                        "name": "run_id",
                        "in": "query",
                        "required": false,
                        "description": "run to show; 0/absent = default run. Free: only the default run",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "engine",
                        "in": "query",
                        "required": false,
                        "description": "`all` (default) | `chatgpt` | `gemini` | `claude` (must be in the plan)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "cell_id",
                        "in": "query",
                        "required": false,
                        "description": "matrix cell; 0/absent = all cells",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "TrendReport",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "context": {
                                            "type": "object",
                                            "properties": {
                                                "…": {
                                                    "type": "string"
                                                }
                                            },
                                            "description": "The filters this report was built with (scan, AI assistant, audience)."
                                        },
                                        "metric": {
                                            "type": "string",
                                            "enum": [
                                                "visibility",
                                                "sov"
                                            ]
                                        },
                                        "runs_count": {
                                            "type": "integer",
                                            "minimum": 0
                                        },
                                        "next_run_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "series": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "key": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "is_own": {
                                                        "type": "boolean",
                                                        "description": "True for your own brand."
                                                    },
                                                    "points": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "object",
                                                            "properties": {
                                                                "run_id": {
                                                                    "type": "integer",
                                                                    "description": "ID of the scan."
                                                                },
                                                                "date": {
                                                                    "type": [
                                                                        "string",
                                                                        "null"
                                                                    ]
                                                                },
                                                                "value": {
                                                                    "type": [
                                                                        "number",
                                                                        "null"
                                                                    ]
                                                                }
                                                            },
                                                            "required": [
                                                                "run_id",
                                                                "date",
                                                                "value"
                                                            ]
                                                        }
                                                    }
                                                },
                                                "required": [
                                                    "key",
                                                    "name",
                                                    "is_own",
                                                    "points"
                                                ]
                                            }
                                        },
                                        "question_set_changes": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "run_id": {
                                                        "type": "integer",
                                                        "description": "ID of the scan."
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "changed": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "run_id",
                                                    "date",
                                                    "changed"
                                                ]
                                            }
                                        },
                                        "engine_changes": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "run_id": {
                                                        "type": "integer",
                                                        "description": "ID of the scan."
                                                    },
                                                    "date": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "changes": {
                                                        "type": "array",
                                                        "items": {
                                                            "anyOf": [
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "engine": {
                                                                            "type": "string"
                                                                        },
                                                                        "field": {
                                                                            "type": "string",
                                                                            "const": "added"
                                                                        },
                                                                        "old": {
                                                                            "type": "null"
                                                                        },
                                                                        "new": {
                                                                            "type": "null"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "engine",
                                                                        "field",
                                                                        "old",
                                                                        "new"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "engine": {
                                                                            "type": "string"
                                                                        },
                                                                        "field": {
                                                                            "type": "string",
                                                                            "const": "removed"
                                                                        },
                                                                        "old": {
                                                                            "type": "null"
                                                                        },
                                                                        "new": {
                                                                            "type": "null"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "engine",
                                                                        "field",
                                                                        "old",
                                                                        "new"
                                                                    ]
                                                                },
                                                                {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "engine": {
                                                                            "type": "string"
                                                                        },
                                                                        "field": {
                                                                            "type": "string",
                                                                            "enum": [
                                                                                "web_search",
                                                                                "model"
                                                                            ]
                                                                        },
                                                                        "old": {
                                                                            "type": "string"
                                                                        },
                                                                        "new": {
                                                                            "type": "string"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "engine",
                                                                        "field",
                                                                        "old",
                                                                        "new"
                                                                    ]
                                                                }
                                                            ]
                                                        }
                                                    }
                                                },
                                                "required": [
                                                    "run_id",
                                                    "date",
                                                    "changes"
                                                ]
                                            }
                                        },
                                        "first": {
                                            "type": "object",
                                            "properties": {
                                                "share": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "number",
                                                            "const": 0
                                                        }
                                                    ]
                                                },
                                                "visibility": {
                                                    "type": "number"
                                                },
                                                "visible_answers": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "total_answers": {
                                                    "type": "integer",
                                                    "minimum": 0
                                                },
                                                "date": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "share",
                                                "visibility",
                                                "visible_answers",
                                                "total_answers",
                                                "date"
                                            ]
                                        },
                                        "summary": {
                                            "type": "object",
                                            "properties": {
                                                "from": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "number",
                                                            "const": 0
                                                        }
                                                    ]
                                                },
                                                "to": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "number",
                                                            "const": 0
                                                        }
                                                    ]
                                                },
                                                "leader": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "gap_from": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                },
                                                "gap_to": {
                                                    "type": [
                                                        "number",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "from",
                                                "to",
                                                "leader",
                                                "gap_from",
                                                "gap_to"
                                            ]
                                        },
                                        "by_engine": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "engine": {
                                                        "type": "string",
                                                        "description": "AI assistant key, e.g. `chatgpt`, `gemini` or `claude`."
                                                    },
                                                    "from": {
                                                        "type": [
                                                            "number",
                                                            "null"
                                                        ]
                                                    },
                                                    "to": {
                                                        "type": [
                                                            "number",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "engine",
                                                    "from",
                                                    "to"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "context",
                                        "metric",
                                        "runs_count",
                                        "next_run_at",
                                        "series",
                                        "question_set_changes",
                                        "engine_changes",
                                        "first",
                                        "summary",
                                        "by_engine"
                                    ]
                                },
                                "example": {
                                    "context": {
                                        "…": "ReportContext — same shape as in GET /reports/overview"
                                    },
                                    "metric": "sov",
                                    "runs_count": 4,
                                    "next_run_at": "2026-12-25T10:30:00Z",
                                    "series": [
                                        {
                                            "key": "own",
                                            "name": "آوند",
                                            "is_own": true,
                                            "points": [
                                                {
                                                    "run_id": 35,
                                                    "date": "2026-08-25T10:30:00Z",
                                                    "value": 11.8
                                                },
                                                {
                                                    "run_id": 36,
                                                    "date": "2026-09-25T10:30:00Z",
                                                    "value": 14.3
                                                }
                                            ]
                                        },
                                        {
                                            "key": "c163",
                                            "name": "نیک‌حساب",
                                            "is_own": false,
                                            "points": [
                                                {
                                                    "run_id": 35,
                                                    "date": "2026-08-25T10:30:00Z",
                                                    "value": 38.2
                                                },
                                                {
                                                    "run_id": 36,
                                                    "date": "2026-09-25T10:30:00Z",
                                                    "value": 37.1
                                                }
                                            ]
                                        }
                                    ],
                                    "question_set_changes": [
                                        {
                                            "run_id": 37,
                                            "date": "2026-10-25T10:30:00Z",
                                            "changed": 2
                                        }
                                    ],
                                    "engine_changes": [
                                        {
                                            "run_id": 36,
                                            "date": "2026-09-25T10:30:00Z",
                                            "changes": [
                                                {
                                                    "engine": "chatgpt",
                                                    "field": "model",
                                                    "old": "gpt-5",
                                                    "new": "gpt-5.1"
                                                }
                                            ]
                                        }
                                    ],
                                    "first": {
                                        "share": 11.8,
                                        "visibility": 37.5,
                                        "visible_answers": 3,
                                        "total_answers": 8,
                                        "date": "2026-08-25T10:30:00Z"
                                    },
                                    "summary": {
                                        "from": 11.8,
                                        "to": 18.8,
                                        "leader": "نیک‌حساب",
                                        "gap_from": 26.4,
                                        "gap_to": 15.6
                                    },
                                    "by_engine": [
                                        {
                                            "engine": "chatgpt",
                                            "from": 11.8,
                                            "to": 18.8
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (metric)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Trend",
                "description": "SoV or visibility per run for the brand and the top 3 competitors, question-set change markers, engine change markers, first-run baseline, from→to summary and per-engine change. Before the second run the UI shows «بعد از اجرای بعدی، روند اینجا دیده می‌شود» with `next_run_at`.\n\n`engine_changes`: one item per run (from the second on) where, compared with the previous run, a plan engine was added (`added`) or left out (`removed`), or an admin changed an engine route's model (`model`, `old` → `new`) or web search (`web_search`, `on`/`off`) in the admin panel between the two runs' starts (rows of `engine_changes`). Only engines of the plan and of the `engine` filter count. The app draws a dotted «تغییر موتور» line on that run with the details in a tooltip.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R5",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "R5 Trend",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/runs": {
            "get": {
                "operationId": "get-runs",
                "summary": "List scans",
                "tags": [
                    "Scans & reports"
                ],
                "responses": {
                    "200": {
                        "description": "RunSummary[]",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "type": [
                                            "object",
                                            "null"
                                        ],
                                        "properties": {
                                            "id": {
                                                "type": "integer",
                                                "description": "Unique ID."
                                            },
                                            "kind": {
                                                "type": "string"
                                            },
                                            "status": {
                                                "type": "string",
                                                "description": "Current status."
                                            },
                                            "engines": {
                                                "type": "array",
                                                "items": {},
                                                "description": "AI assistants included."
                                            },
                                            "started_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "When it started (ISO 8601)."
                                            },
                                            "finished_at": {
                                                "type": [
                                                    "string",
                                                    "null"
                                                ],
                                                "description": "When it finished (ISO 8601)."
                                            },
                                            "done": {
                                                "type": "integer"
                                            },
                                            "total": {
                                                "type": "integer"
                                            }
                                        },
                                        "required": [
                                            "id",
                                            "kind",
                                            "status",
                                            "engines",
                                            "started_at",
                                            "finished_at",
                                            "done",
                                            "total"
                                        ]
                                    }
                                },
                                "example": [
                                    {
                                        "id": 38,
                                        "kind": "scheduled",
                                        "status": "complete",
                                        "engines": [
                                            "chatgpt"
                                        ],
                                        "started_at": "2026-11-25T10:16:00Z",
                                        "finished_at": "2026-11-25T10:30:00Z",
                                        "done": 10,
                                        "total": 10
                                    },
                                    {
                                        "id": 37,
                                        "kind": "scheduled",
                                        "status": "complete",
                                        "engines": [
                                            "chatgpt"
                                        ],
                                        "started_at": "2026-10-25T10:16:00Z",
                                        "finished_at": "2026-10-25T10:30:00Z",
                                        "done": 10,
                                        "total": 10
                                    }
                                ]
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand yet",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "description": "All runs of the brand, newest first.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "R* run picker",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "List runs",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/runs/current": {
            "get": {
                "operationId": "get-runs-current",
                "summary": "Current scan + progress",
                "tags": [
                    "Scans & reports"
                ],
                "responses": {
                    "200": {
                        "description": "RunSummary & {progress}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "id": {
                                            "type": "integer",
                                            "description": "Unique ID."
                                        },
                                        "kind": {
                                            "type": "string"
                                        },
                                        "status": {
                                            "type": "string",
                                            "description": "Current status."
                                        },
                                        "engines": {
                                            "type": "array",
                                            "items": {
                                                "type": "string"
                                            },
                                            "description": "AI assistants included."
                                        },
                                        "started_at": {
                                            "type": "string",
                                            "description": "When it started (ISO 8601)."
                                        },
                                        "finished_at": {
                                            "type": "string",
                                            "description": "When it finished (ISO 8601)."
                                        },
                                        "done": {
                                            "type": "integer"
                                        },
                                        "total": {
                                            "type": "integer"
                                        },
                                        "progress": {
                                            "type": "object",
                                            "properties": {
                                                "done": {
                                                    "type": "integer"
                                                },
                                                "total": {
                                                    "type": "integer"
                                                },
                                                "steps": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "key": {
                                                                "type": "string"
                                                            },
                                                            "status": {
                                                                "type": "string",
                                                                "description": "Current status."
                                                            }
                                                        }
                                                    }
                                                },
                                                "engines_status": {
                                                    "type": "object",
                                                    "properties": {
                                                        "chatgpt": {
                                                            "type": "string"
                                                        }
                                                    },
                                                    "description": "Result per AI assistant, keyed by the assistant."
                                                },
                                                "attempt": {},
                                                "mentioned_so_far": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                "example": {
                                    "id": 38,
                                    "kind": "scheduled",
                                    "status": "complete",
                                    "engines": [
                                        "chatgpt"
                                    ],
                                    "started_at": "2026-11-25T10:16:00Z",
                                    "finished_at": "2026-11-25T10:30:00Z",
                                    "done": 10,
                                    "total": 10,
                                    "progress": {
                                        "done": 10,
                                        "total": 10,
                                        "steps": [
                                            {
                                                "key": "generated",
                                                "status": "done"
                                            },
                                            {
                                                "key": "asking",
                                                "status": "done"
                                            }
                                        ],
                                        "engines_status": {
                                            "chatgpt": "ok"
                                        },
                                        "attempt": null,
                                        "mentioned_so_far": [
                                            "نیک‌حساب",
                                            "ترازنو",
                                            "دفتریار",
                                            "حساب‌یار",
                                            "پارس‌دفتر",
                                            "مهرگان‌سیستم",
                                            "رایان‌دفتر"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "No brand or no run yet: `{\"message\":\"…\"}`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "description": "Newest run with the the app progress block (steps, per-engine status, retry attempt, brands mentioned so far). Poll while `status` is `queued`/`running`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "O9",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "Current run + progress",
                    "folder": "05 Runs & reports (O9, R1–R5)"
                }
            }
        },
        "/settings/account": {
            "get": {
                "operationId": "get-settings-account",
                "tags": [
                    "Settings"
                ],
                "responses": {
                    "200": {
                        "description": "AccountSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "email_notifications": {
                                            "type": "object",
                                            "properties": {
                                                "reminders": {
                                                    "type": "boolean"
                                                },
                                                "report_ready": {
                                                    "type": "boolean"
                                                },
                                                "renewal": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "reminders",
                                                "report_ready",
                                                "renewal"
                                            ]
                                        },
                                        "plan": {
                                            "type": "string",
                                            "description": "S5: reminders, report_ready, renewal",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ]
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "renewal": {
                                            "type": "object",
                                            "description": "Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription).",
                                            "properties": {
                                                "auto": {
                                                    "type": "boolean"
                                                },
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Current status."
                                                },
                                                "can_cancel": {
                                                    "type": "boolean",
                                                    "description": "active | past_due | cancel_at_period_end | none"
                                                },
                                                "can_resume": {
                                                    "type": "boolean"
                                                },
                                                "renews_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ends_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "auto",
                                                "status",
                                                "can_cancel",
                                                "can_resume",
                                                "renews_at",
                                                "ends_at"
                                            ]
                                        },
                                        "brand_names": {
                                            "type": "array",
                                            "description": "«Delete account» accepts any of these (or the email) as the typed confirmation.",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "email",
                                        "phone",
                                        "sms_notifications",
                                        "email_notifications",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "payments",
                                        "renewal",
                                        "brand_names"
                                    ]
                                },
                                "example": {
                                    "email": "demo@rawi.local",
                                    "phone": "+989120000077",
                                    "sms_notifications": true,
                                    "plan": "paid",
                                    "billing_period": "quarterly",
                                    "plan_expires_at": "2027-01-25T00:00:00Z",
                                    "payments": [
                                        {
                                            "id": 19,
                                            "period": "quarterly",
                                            "status": "success",
                                            "base_amount": 5400000,
                                            "period_discount": 540000,
                                            "code_discount": 1458000,
                                            "vat": 340200,
                                            "total": 3742200,
                                            "currency": "IRT",
                                            "tracking_code": "427999304",
                                            "gateway_message": null,
                                            "gateway_name": "درگاه بانکی (آزمایشی)",
                                            "period_start": "2026-10-25T00:00:00Z",
                                            "period_end": "2027-01-25T00:00:00Z",
                                            "paid_at": "2026-10-25T11:42:00Z",
                                            "created_at": "2026-10-25T11:42:00Z",
                                            "auto_renew": false,
                                            "renewal_amount": null
                                        }
                                    ],
                                    "renewal": {
                                        "auto": false,
                                        "status": "none",
                                        "can_cancel": false,
                                        "can_resume": false,
                                        "renews_at": null,
                                        "ends_at": "2027-01-25T00:00:00Z"
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Get account & receipts",
                "description": "Email (null for phone-only accounts), verified phone, SMS-notification switch, plan, period, renewal date and receipts (successful/refunded payments).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S5 Get account & receipts",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            },
            "delete": {
                "operationId": "delete-settings-account",
                "tags": [
                    "Settings"
                ],
                "parameters": [
                    {
                        "name": "confirm_email",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 255
                        }
                    },
                    {
                        "name": "confirm_brand",
                        "in": "query",
                        "schema": {
                            "type": [
                                "string",
                                "null"
                            ],
                            "maxLength": 255
                        }
                    },
                    {
                        "name": "reauth_token",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "deleted": {
                                            "type": "boolean"
                                        },
                                        "purge_at": {
                                            "type": "string"
                                        },
                                        "retention_days": {
                                            "type": "integer"
                                        }
                                    },
                                    "required": [
                                        "deleted",
                                        "purge_at",
                                        "retention_days"
                                    ]
                                },
                                "example": {
                                    "deleted": true,
                                    "purge_at": "2026-12-26T10:00:00Z",
                                    "retention_days": 30
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`confirm_email` does not match)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                },
                "summary": "Delete account",
                "description": "**Destructive.** After re-typing the email, the brand name or — for phone-only accounts — the mobile number, the account is\nclosed at once: all tokens are revoked, the email and phone are freed for a new sign-up, the free-queue entry is removed,\nscheduled runs stop and a Stripe subscription is cancelled. After `RAWI_DELETION_RETENTION_DAYS` (default 30) the daily\n`rawi:purge-deleted` deletes the brand and everything under it (questions, runs, answers, reports, suggestions),\nconsultation requests, email/SMS logs and sign-in codes, and clears the personal fields. Payment rows are kept,\nanonymised (no card hash), as accounting law requires.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-rawi-destructive": "danger",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "x-rawi-template": "{\n  \"confirm_email\": \"{{userEmail}}\",\n  \"reauth_token\": \"{{reauthToken}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Delete account",
                                    "value": {
                                        "confirm_email": "demo@rawi.local",
                                        "reauth_token": ""
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "confirm_email": "demo@rawi.local"
                                    }
                                }
                            }
                        }
                    }
                },
                "x-postman": {
                    "name": "S5 Delete account",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/brand": {
            "get": {
                "operationId": "get-settings-brand",
                "tags": [
                    "Settings"
                ],
                "responses": {
                    "200": {
                        "description": "{name, domain, name_variants[], extra_domains[], competitors: Competitor[]}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "name": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "domain": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Site domain."
                                        },
                                        "name_variants": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "extra_domains": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "name",
                                        "domain",
                                        "name_variants",
                                        "extra_domains",
                                        "competitors"
                                    ]
                                },
                                "example": {
                                    "name": "آوند",
                                    "domain": "avand.example",
                                    "name_variants": [
                                        "Avand",
                                        "آوند حساب",
                                        "اوند"
                                    ],
                                    "extra_domains": [
                                        "blog.avand.example"
                                    ],
                                    "competitors": [
                                        {
                                            "id": 163,
                                            "name": "نیک‌حساب",
                                            "domain": "nikhesab.example",
                                            "position": 1,
                                            "source": "suggested"
                                        },
                                        {
                                            "id": 164,
                                            "name": "ترازنو",
                                            "domain": "taraznoo.example",
                                            "position": 2,
                                            "source": "suggested"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Get brand & competitors",
                "description": "Brand name/domain, name variants, extra domains and the ordered competitor list.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S1",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S1 Get brand & competitors",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            },
            "put": {
                "operationId": "put-settings-brand",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name_variants": {
                                        "type": "array",
                                        "items": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "maxLength": 100
                                        },
                                        "maxItems": 10,
                                        "description": "max 10, each max 100"
                                    },
                                    "extra_domains": {
                                        "type": "array",
                                        "items": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "maxLength": 253
                                        },
                                        "maxItems": 5,
                                        "description": "max 5 valid hosts"
                                    },
                                    "competitors": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "maxLength": 80
                                                },
                                                "domain": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 253,
                                                    "description": "Site domain."
                                                }
                                            },
                                            "required": [
                                                "name"
                                            ]
                                        },
                                        "minItems": 1,
                                        "maxItems": 5,
                                        "description": "1–5"
                                    }
                                },
                                "required": [
                                    "name_variants",
                                    "extra_domains",
                                    "competitors"
                                ]
                            },
                            "x-rawi-template": "{\n  \"name_variants\": [\n    \"Avand\",\n    \"آوند حساب\",\n    \"اوند\"\n  ],\n  \"extra_domains\": [\n    \"blog.avand.example\"\n  ],\n  \"competitors\": [\n    {\n      \"id\": 163,\n      \"name\": \"نیک‌حساب\",\n      \"domain\": \"nikhesab.example\"\n    },\n    {\n      \"id\": 164,\n      \"name\": \"ترازنو\",\n      \"domain\": \"taraznoo.example\"\n    },\n    {\n      \"id\": 165,\n      \"name\": \"دفتریار\",\n      \"domain\": \"daftaryar.example\"\n    },\n    {\n      \"id\": 166,\n      \"name\": \"رایان‌دفتر\",\n      \"domain\": \"rayandaftar.example\"\n    },\n    {\n      \"id\": 167,\n      \"name\": \"مهرگان‌سیستم\",\n      \"domain\": \"mehregan.example\"\n    }\n  ]\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S1 Update brand & competitors",
                                    "value": {
                                        "name_variants": [
                                            "Avand",
                                            "آوند حساب",
                                            "اوند"
                                        ],
                                        "extra_domains": [
                                            "blog.avand.example"
                                        ],
                                        "competitors": [
                                            {
                                                "id": 163,
                                                "name": "نیک‌حساب",
                                                "domain": "nikhesab.example"
                                            },
                                            {
                                                "id": 164,
                                                "name": "ترازنو",
                                                "domain": "taraznoo.example"
                                            },
                                            {
                                                "id": 165,
                                                "name": "دفتریار",
                                                "domain": "daftaryar.example"
                                            },
                                            {
                                                "id": 166,
                                                "name": "رایان‌دفتر",
                                                "domain": "rayandaftar.example"
                                            },
                                            {
                                                "id": 167,
                                                "name": "مهرگان‌سیستم",
                                                "domain": "mehregan.example"
                                            }
                                        ]
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "name_variants": [
                                            "Avand",
                                            "آوند حساب",
                                            "اوند"
                                        ],
                                        "extra_domains": [
                                            "blog.avand.example"
                                        ],
                                        "competitors": [
                                            {
                                                "id": 163,
                                                "name": "نیک‌حساب",
                                                "domain": "nikhesab.example"
                                            },
                                            {
                                                "id": 164,
                                                "name": "ترازنو",
                                                "domain": "taraznoo.example"
                                            },
                                            {
                                                "id": 165,
                                                "name": "دفتریار",
                                                "domain": "daftaryar.example"
                                            },
                                            {
                                                "id": 166,
                                                "name": "رایان‌دفتر",
                                                "domain": "rayandaftar.example"
                                            },
                                            {
                                                "id": 167,
                                                "name": "مهرگان‌سیستم",
                                                "domain": "mehregan.example"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "same as GET",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "name": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "domain": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Site domain."
                                        },
                                        "name_variants": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "extra_domains": {
                                            "type": "array",
                                            "items": {}
                                        },
                                        "competitors": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "domain": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "Site domain."
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    },
                                                    "source": {
                                                        "type": "string"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "domain",
                                                    "position",
                                                    "source"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "name",
                                        "domain",
                                        "name_variants",
                                        "extra_domains",
                                        "competitors"
                                    ]
                                },
                                "example": {
                                    "…": "GET /settings/brand body after saving"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`extra_domains.N`, `competitors.N.name` (is the brand / duplicate), `competitors.N.domain`)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Update brand & competitors",
                "description": "Saves name variants, extra domains and competitors (order = importance). A competitor change rebuilds only competitor/comparison questions.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S1",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S1 Update brand & competitors",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/email/request-code": {
            "post": {
                "operationId": "post-settings-email-request-code",
                "tags": [
                    "Settings"
                ],
                "responses": {
                    "200": {
                        "description": "VerifyCodeResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "sent": {
                                            "type": "boolean"
                                        },
                                        "expires_in": {
                                            "type": "integer",
                                            "const": 600
                                        },
                                        "resend_in": {
                                            "type": "integer"
                                        },
                                        "dev_code": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "sent",
                                        "expires_in",
                                        "resend_in",
                                        "dev_code"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`email` invalid / taken)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Resend cooldown (45 s), or route throttle 10 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Request email verification code",
                "description": "Phone-only accounts add an email: sends a code to the new address.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5 «ایمیل»",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "x-rawi-template": "{\n  \"email\": \"erfan@avand.example\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Request email verification code",
                                    "value": {
                                        "email": "erfan@avand.example"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "email": "erfan@avand.example"
                                    }
                                }
                            }
                        }
                    }
                },
                "x-postman": {
                    "name": "S5 Request email verification code",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/email/verify": {
            "post": {
                "operationId": "post-settings-email-verify",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "code": {
                                        "type": "string",
                                        "maxLength": 12,
                                        "description": "6 digits"
                                    },
                                    "reauth_token": {
                                        "type": "string",
                                        "description": "from `POST /settings/reauth/verify`; missing/invalid → 422 `{\"code\":\"reauth_required\"}`"
                                    }
                                },
                                "required": [
                                    "code"
                                ]
                            },
                            "x-rawi-template": "{\n  \"email\": \"erfan@avand.example\",\n  \"code\": \"{{devCode}}\",\n  \"reauth_token\": \"{{reauthToken}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Verify email",
                                    "value": {
                                        "email": "erfan@avand.example",
                                        "code": "",
                                        "reauth_token": ""
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "email": "erfan@avand.example",
                                        "code": "552019"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "AccountSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "email_notifications": {
                                            "type": "object",
                                            "properties": {
                                                "reminders": {
                                                    "type": "boolean"
                                                },
                                                "report_ready": {
                                                    "type": "boolean"
                                                },
                                                "renewal": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "reminders",
                                                "report_ready",
                                                "renewal"
                                            ]
                                        },
                                        "plan": {
                                            "type": "string",
                                            "description": "S5: reminders, report_ready, renewal",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ]
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "renewal": {
                                            "type": "object",
                                            "description": "Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription).",
                                            "properties": {
                                                "auto": {
                                                    "type": "boolean"
                                                },
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Current status."
                                                },
                                                "can_cancel": {
                                                    "type": "boolean",
                                                    "description": "active | past_due | cancel_at_period_end | none"
                                                },
                                                "can_resume": {
                                                    "type": "boolean"
                                                },
                                                "renews_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ends_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "auto",
                                                "status",
                                                "can_cancel",
                                                "can_resume",
                                                "renews_at",
                                                "ends_at"
                                            ]
                                        },
                                        "brand_names": {
                                            "type": "array",
                                            "description": "«Delete account» accepts any of these (or the email) as the typed confirmation.",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "email",
                                        "phone",
                                        "sms_notifications",
                                        "email_notifications",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "payments",
                                        "renewal",
                                        "brand_names"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`code` wrong/expired, `email` invalid/taken)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Route throttle 20 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Verify email",
                "description": "Checks the code and saves the email on the account (fires `email_added`). Needs `reauth_token` (SEC-12): every other\nsession is then signed out and the previous address gets an email about the change.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "20/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S5 Verify email",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/export": {
            "post": {
                "operationId": "post-settings-export",
                "summary": "Download my data",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "reauth_token": {
                                        "type": "string",
                                        "description": "from `POST /settings/reauth/verify` (10 minutes); without it: 422 `{\"code\":\"reauth_required\"}`"
                                    }
                                }
                            },
                            "x-rawi-template": "{\n  \"reauth_token\": \"{{reauthToken}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Download my data",
                                    "value": {
                                        "reauth_token": ""
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "reauth_token": "Qm9…"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "format": {
                                            "type": "string",
                                            "const": "rawi-account-export"
                                        },
                                        "version": {
                                            "type": "integer",
                                            "const": 1
                                        },
                                        "exported_at": {
                                            "type": "string"
                                        },
                                        "account": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "description": "Unique ID."
                                                },
                                                "email": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Email address."
                                                },
                                                "phone": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Mobile number."
                                                },
                                                "name": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "locale": {
                                                    "type": "string",
                                                    "description": "Language: `fa` or `en`."
                                                },
                                                "plan": {
                                                    "type": "string",
                                                    "enum": [
                                                        "paid",
                                                        "free"
                                                    ],
                                                    "description": "Plan: `free` (Free) or `paid` (Pro)."
                                                },
                                                "billing_period": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "plan_expires_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "created_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "When it was created (ISO 8601)."
                                                },
                                                "last_login_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "email_notifications": {
                                                    "type": "object",
                                                    "properties": {
                                                        "reminders": {
                                                            "type": "boolean"
                                                        },
                                                        "report_ready": {
                                                            "type": "boolean"
                                                        },
                                                        "renewal": {
                                                            "type": "boolean"
                                                        }
                                                    },
                                                    "required": [
                                                        "reminders",
                                                        "report_ready",
                                                        "renewal"
                                                    ]
                                                },
                                                "sms_notifications": {
                                                    "type": "boolean"
                                                },
                                                "referral_code": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "id",
                                                "email",
                                                "phone",
                                                "name",
                                                "locale",
                                                "plan",
                                                "billing_period",
                                                "plan_expires_at",
                                                "created_at",
                                                "last_login_at",
                                                "email_notifications",
                                                "sms_notifications",
                                                "referral_code"
                                            ]
                                        },
                                        "brands": {
                                            "anyOf": [
                                                {
                                                    "type": "array",
                                                    "prefixItems": [
                                                        {
                                                            "type": "object",
                                                            "properties": {
                                                                "name": {
                                                                    "type": "string"
                                                                },
                                                                "domain": {
                                                                    "type": "string"
                                                                },
                                                                "name_variants": {
                                                                    "type": "array",
                                                                    "items": {}
                                                                },
                                                                "extra_domains": {
                                                                    "type": "array",
                                                                    "items": {}
                                                                },
                                                                "industry": {
                                                                    "type": "string"
                                                                },
                                                                "sales_model": {
                                                                    "type": "string"
                                                                },
                                                                "question_language": {
                                                                    "type": "string"
                                                                },
                                                                "run_frequency": {
                                                                    "type": "string"
                                                                },
                                                                "products": {
                                                                    "type": "string"
                                                                },
                                                                "target_customers": {
                                                                    "type": "string"
                                                                },
                                                                "competitors": {
                                                                    "type": "string"
                                                                },
                                                                "questions": {
                                                                    "type": "string"
                                                                },
                                                                "scans": {
                                                                    "type": "array",
                                                                    "items": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "id": {
                                                                                "type": "integer"
                                                                            },
                                                                            "kind": {
                                                                                "type": "string"
                                                                            },
                                                                            "status": {
                                                                                "type": "string"
                                                                            },
                                                                            "engines": {
                                                                                "type": "array",
                                                                                "items": {}
                                                                            },
                                                                            "started_at": {
                                                                                "type": [
                                                                                    "string",
                                                                                    "null"
                                                                                ]
                                                                            },
                                                                            "finished_at": {
                                                                                "type": [
                                                                                    "string",
                                                                                    "null"
                                                                                ]
                                                                            },
                                                                            "answers": {
                                                                                "type": "integer"
                                                                            },
                                                                            "answers_naming_you": {
                                                                                "type": "integer"
                                                                            }
                                                                        },
                                                                        "required": [
                                                                            "id",
                                                                            "kind",
                                                                            "status",
                                                                            "engines",
                                                                            "started_at",
                                                                            "finished_at",
                                                                            "answers",
                                                                            "answers_naming_you"
                                                                        ]
                                                                    }
                                                                }
                                                            },
                                                            "required": [
                                                                "name",
                                                                "domain",
                                                                "name_variants",
                                                                "extra_domains",
                                                                "industry",
                                                                "sales_model",
                                                                "question_language",
                                                                "run_frequency",
                                                                "products",
                                                                "target_customers",
                                                                "competitors",
                                                                "questions",
                                                                "scans"
                                                            ]
                                                        }
                                                    ],
                                                    "minItems": 1,
                                                    "maxItems": 1
                                                },
                                                {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "minItems": 0,
                                                    "maxItems": 0
                                                }
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "consultation_requests": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "phone": {
                                                        "type": "string",
                                                        "description": "Mobile number."
                                                    },
                                                    "method": {
                                                        "type": "string"
                                                    },
                                                    "time_slot": {
                                                        "type": "string"
                                                    },
                                                    "preferred_days": {
                                                        "type": [
                                                            "array",
                                                            "null"
                                                        ],
                                                        "items": {}
                                                    },
                                                    "note": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "phone",
                                                    "method",
                                                    "time_slot",
                                                    "preferred_days",
                                                    "note",
                                                    "status",
                                                    "created_at"
                                                ]
                                            }
                                        }
                                    },
                                    "required": [
                                        "format",
                                        "version",
                                        "exported_at",
                                        "account",
                                        "brands",
                                        "payments",
                                        "consultation_requests"
                                    ]
                                },
                                "example": {
                                    "format": "rawi-account-export",
                                    "version": 1,
                                    "exported_at": "2026-11-26T10:00:00Z",
                                    "account": {
                                        "id": 1,
                                        "email": "demo@rawi.local",
                                        "phone": null,
                                        "plan": "free",
                                        "locale": "en"
                                    },
                                    "brands": [
                                        {
                                            "name": "Acme Books",
                                            "domain": "acmebooks.example",
                                            "products": [],
                                            "target_customers": [],
                                            "competitors": [],
                                            "questions": [
                                                {
                                                    "id": 1,
                                                    "text": "…",
                                                    "stage": "selection",
                                                    "answers": 6,
                                                    "answers_naming_you": 2
                                                }
                                            ],
                                            "scans": [
                                                {
                                                    "id": 3,
                                                    "status": "complete",
                                                    "answers": 60,
                                                    "answers_naming_you": 14
                                                }
                                            ]
                                        }
                                    ],
                                    "payments": [],
                                    "consultation_requests": []
                                }
                            }
                        },
                        "headers": {
                            "Content-Disposition": {
                                "schema": {
                                    "type": "string"
                                }
                            },
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "`{\"code\":\"reauth_required\"}`: no valid `reauth_token`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "More than 5 downloads in an hour",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "description": "The account's data as one JSON document, sent as a download (`Content-Disposition: attachment; filename=\"rawi-data-YYYY-MM-DD.json\"`): the account (email, phone, plan, notification choices), the brand with its products, target customers, competitors and questions, a summary of every scan (answers, and answers naming the brand, per scan and per question; the answer texts stay in the reports), payments and consultation requests. Internal fields (AI costs and routing, admin notes, payer hashes) are left out. Personal data, so like email/phone changes and deletion it needs a fresh `reauth_token` (used up by the download). Throttle 5 per hour.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "5/60min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S5 Download my data",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/notifications": {
            "patch": {
                "operationId": "patch-settings-notifications",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "sms_notifications": {
                                        "type": "boolean",
                                        "description": ""
                                    },
                                    "email_notifications": {
                                        "type": "object",
                                        "properties": {
                                            "reminders": {
                                                "type": "boolean"
                                            },
                                            "report_ready": {
                                                "type": "boolean"
                                            },
                                            "renewal": {
                                                "type": "boolean"
                                            }
                                        }
                                    }
                                }
                            },
                            "x-rawi-template": "{\n  \"sms_notifications\": true\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 SMS notifications on/off",
                                    "value": {
                                        "sms_notifications": true
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "sms_notifications": true
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "AccountSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "email_notifications": {
                                            "type": "object",
                                            "properties": {
                                                "reminders": {
                                                    "type": "boolean"
                                                },
                                                "report_ready": {
                                                    "type": "boolean"
                                                },
                                                "renewal": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "reminders",
                                                "report_ready",
                                                "renewal"
                                            ]
                                        },
                                        "plan": {
                                            "type": "string",
                                            "description": "S5: reminders, report_ready, renewal",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ]
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "renewal": {
                                            "type": "object",
                                            "description": "Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription).",
                                            "properties": {
                                                "auto": {
                                                    "type": "boolean"
                                                },
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Current status."
                                                },
                                                "can_cancel": {
                                                    "type": "boolean",
                                                    "description": "active | past_due | cancel_at_period_end | none"
                                                },
                                                "can_resume": {
                                                    "type": "boolean"
                                                },
                                                "renews_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ends_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "auto",
                                                "status",
                                                "can_cancel",
                                                "can_resume",
                                                "renews_at",
                                                "ends_at"
                                            ]
                                        },
                                        "brand_names": {
                                            "type": "array",
                                            "description": "«Delete account» accepts any of these (or the email) as the typed confirmation.",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "email",
                                        "phone",
                                        "sms_notifications",
                                        "email_notifications",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "payments",
                                        "renewal",
                                        "brand_names"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (sms_notifications)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "SMS notifications on/off",
                "description": "Turns SMS notifications (sent next to email–email) on or off. Only a verified phone receives them.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5 «اطلاع‌رسانی با پیامک»",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S5 SMS notifications on/off",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/phone": {
            "delete": {
                "operationId": "delete-settings-phone",
                "tags": [
                    "Settings"
                ],
                "parameters": [
                    {
                        "name": "reauth_token",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "AccountSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "email_notifications": {
                                            "type": "object",
                                            "properties": {
                                                "reminders": {
                                                    "type": "boolean"
                                                },
                                                "report_ready": {
                                                    "type": "boolean"
                                                },
                                                "renewal": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "reminders",
                                                "report_ready",
                                                "renewal"
                                            ]
                                        },
                                        "plan": {
                                            "type": "string",
                                            "description": "S5: reminders, report_ready, renewal",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ]
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "renewal": {
                                            "type": "object",
                                            "description": "Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription).",
                                            "properties": {
                                                "auto": {
                                                    "type": "boolean"
                                                },
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Current status."
                                                },
                                                "can_cancel": {
                                                    "type": "boolean",
                                                    "description": "active | past_due | cancel_at_period_end | none"
                                                },
                                                "can_resume": {
                                                    "type": "boolean"
                                                },
                                                "renews_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ends_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "auto",
                                                "status",
                                                "can_cancel",
                                                "can_resume",
                                                "renews_at",
                                                "ends_at"
                                            ]
                                        },
                                        "brand_names": {
                                            "type": "array",
                                            "description": "«Delete account» accepts any of these (or the email) as the typed confirmation.",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "email",
                                        "phone",
                                        "sms_notifications",
                                        "email_notifications",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "payments",
                                        "renewal",
                                        "brand_names"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`phone` — the account has no email)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Remove phone",
                "description": "**Destructive.** Removes the mobile. Not allowed for a phone-only account (it would have no way to sign in). Body:\n`{\"reauth_token\":\"…\"}` from `POST /settings/reauth/verify` (SEC-12).",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-rawi-destructive": "danger",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "x-rawi-template": "{\n  \"reauth_token\": \"{{reauthToken}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Remove phone",
                                    "value": {
                                        "reauth_token": ""
                                    }
                                }
                            }
                        }
                    }
                },
                "x-postman": {
                    "name": "S5 Remove phone",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/phone/request-code": {
            "post": {
                "operationId": "post-settings-phone-request-code",
                "tags": [
                    "Settings"
                ],
                "responses": {
                    "200": {
                        "description": "VerifyCodeResponse",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "sent": {
                                            "type": "boolean"
                                        },
                                        "expires_in": {
                                            "type": "integer",
                                            "const": 600
                                        },
                                        "resend_in": {
                                            "type": "integer"
                                        },
                                        "dev_code": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "sent",
                                        "expires_in",
                                        "resend_in",
                                        "dev_code"
                                    ]
                                },
                                "example": {
                                    "sent": true,
                                    "expires_in": 600,
                                    "resend_in": 45,
                                    "dev_code": "318204"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`phone` invalid / «این شماره به حساب دیگری وصل است»)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Resend cooldown (45 s), or route throttle 10 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    },
                    "503": {
                        "description": "IPPanel rejected the send",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Message"
                                }
                            }
                        }
                    }
                },
                "summary": "Request phone verification code",
                "description": "Sends an SMS code (code guard `verify`) to add or change the account mobile.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5 «شماره موبایل»",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object"
                            },
                            "x-rawi-template": "{\n  \"phone\": \"{{userPhone}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Request phone verification code",
                                    "value": {
                                        "phone": "09120000077"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "phone": 9120000077
                                    }
                                }
                            }
                        }
                    }
                },
                "x-postman": {
                    "name": "S5 Request phone verification code",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/phone/verify": {
            "post": {
                "operationId": "post-settings-phone-verify",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "code": {
                                        "type": "string",
                                        "maxLength": 12,
                                        "description": "6 digits"
                                    },
                                    "reauth_token": {
                                        "type": "string",
                                        "description": "from `POST /settings/reauth/verify` (SEC-12); other sessions are signed out after the change"
                                    }
                                },
                                "required": [
                                    "code"
                                ]
                            },
                            "x-rawi-template": "{\n  \"phone\": \"{{userPhone}}\",\n  \"code\": \"{{devCode}}\",\n  \"reauth_token\": \"{{reauthToken}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Verify phone",
                                    "value": {
                                        "phone": "09120000077",
                                        "code": "",
                                        "reauth_token": ""
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "phone": "09120000077",
                                        "code": "318204"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "AccountSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "email": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Email address."
                                        },
                                        "phone": {
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "description": "Mobile number."
                                        },
                                        "sms_notifications": {
                                            "type": "boolean"
                                        },
                                        "email_notifications": {
                                            "type": "object",
                                            "properties": {
                                                "reminders": {
                                                    "type": "boolean"
                                                },
                                                "report_ready": {
                                                    "type": "boolean"
                                                },
                                                "renewal": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "required": [
                                                "reminders",
                                                "report_ready",
                                                "renewal"
                                            ]
                                        },
                                        "plan": {
                                            "type": "string",
                                            "description": "S5: reminders, report_ready, renewal",
                                            "enum": [
                                                "paid",
                                                "free"
                                            ]
                                        },
                                        "billing_period": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "plan_expires_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "payments": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "period": {
                                                        "type": "string"
                                                    },
                                                    "status": {
                                                        "type": "string",
                                                        "description": "Current status."
                                                    },
                                                    "base_amount": {
                                                        "type": "integer"
                                                    },
                                                    "period_discount": {
                                                        "type": "integer"
                                                    },
                                                    "code_discount": {
                                                        "type": "integer"
                                                    },
                                                    "vat": {
                                                        "type": "integer"
                                                    },
                                                    "total": {
                                                        "type": "integer"
                                                    },
                                                    "currency": {
                                                        "type": "string",
                                                        "description": "Currency code, e.g. `USD`, `EUR` or `IRT`."
                                                    },
                                                    "tracking_code": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_message": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "gateway_name": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_start": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "period_end": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "paid_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "created_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "description": "When it was created (ISO 8601)."
                                                    },
                                                    "auto_renew": {
                                                        "type": "boolean"
                                                    },
                                                    "renewal_amount": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ],
                                                        "description": "«Renew automatically» (Stripe subscription)"
                                                    },
                                                    "amount_refunded": {
                                                        "type": "integer",
                                                        "description": "Refunds (status refunded / partially_refunded): total refunded so far and when the last one was made."
                                                    },
                                                    "refunded_at": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "period",
                                                    "status",
                                                    "base_amount",
                                                    "period_discount",
                                                    "code_discount",
                                                    "vat",
                                                    "total",
                                                    "currency",
                                                    "tracking_code",
                                                    "gateway_message",
                                                    "gateway_name",
                                                    "period_start",
                                                    "period_end",
                                                    "paid_at",
                                                    "created_at",
                                                    "auto_renew",
                                                    "renewal_amount",
                                                    "amount_refunded",
                                                    "refunded_at"
                                                ]
                                            }
                                        },
                                        "renewal": {
                                            "type": "object",
                                            "description": "Automatic renewal (Stripe subscription): renews_at / ends_at, cancel or resume (POST /billing/subscription).",
                                            "properties": {
                                                "auto": {
                                                    "type": "boolean"
                                                },
                                                "status": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "description": "Current status."
                                                },
                                                "can_cancel": {
                                                    "type": "boolean",
                                                    "description": "active | past_due | cancel_at_period_end | none"
                                                },
                                                "can_resume": {
                                                    "type": "boolean"
                                                },
                                                "renews_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "ends_at": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                }
                                            },
                                            "required": [
                                                "auto",
                                                "status",
                                                "can_cancel",
                                                "can_resume",
                                                "renews_at",
                                                "ends_at"
                                            ]
                                        },
                                        "brand_names": {
                                            "type": "array",
                                            "description": "«Delete account» accepts any of these (or the email) as the typed confirmation.",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "email",
                                        "phone",
                                        "sms_notifications",
                                        "email_notifications",
                                        "plan",
                                        "billing_period",
                                        "plan_expires_at",
                                        "payments",
                                        "renewal",
                                        "brand_names"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (`code` wrong/expired, `phone` invalid/taken)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Route throttle 20 req/min",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Verify phone",
                "description": "Checks the code and saves the phone as verified (fires `phone_verified`). A verified phone receives SMS notifications and can be used to sign in.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "20/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S5 Verify phone",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/products": {
            "get": {
                "operationId": "get-settings-products",
                "tags": [
                    "Settings"
                ],
                "responses": {
                    "200": {
                        "description": "{products, customers, cells, limits, question_counts}",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "limits": {
                                            "type": "object",
                                            "properties": {
                                                "engines": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    },
                                                    "description": "AI assistants included."
                                                },
                                                "questions": {
                                                    "type": "integer"
                                                },
                                                "products": {
                                                    "type": "integer"
                                                },
                                                "customers": {
                                                    "type": "integer"
                                                },
                                                "cells": {
                                                    "type": "integer"
                                                },
                                                "changes_per_month": {
                                                    "type": "integer"
                                                },
                                                "run_frequencies": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string"
                                                    }
                                                },
                                                "discovered_limit": {
                                                    "type": "integer"
                                                },
                                                "citations_full": {
                                                    "type": "boolean"
                                                },
                                                "all_runs": {
                                                    "type": "boolean"
                                                }
                                            },
                                            "description": "Limits of the account's plan."
                                        },
                                        "question_counts": {
                                            "type": "object",
                                            "additionalProperties": {
                                                "type": "integer"
                                            }
                                        }
                                    },
                                    "required": [
                                        "products",
                                        "customers",
                                        "cells",
                                        "limits",
                                        "question_counts"
                                    ]
                                },
                                "example": {
                                    "products": [
                                        {
                                            "id": 39,
                                            "name": "آوند ابری",
                                            "generic_name": "نرم‌افزار حسابداری ابری",
                                            "type": "software",
                                            "features": [
                                                "صدور فاکتور رسمی",
                                                "اتصال به سامانه مودیان",
                                                "دسترسی چندکاربره"
                                            ],
                                            "position": 1
                                        }
                                    ],
                                    "customers": [
                                        {
                                            "id": 41,
                                            "kind": "b2b",
                                            "name": "شرکت‌های خرد و کوچک در ایران",
                                            "industries": [
                                                "خدمات",
                                                "بازرگانی"
                                            ],
                                            "sizes": [
                                                "micro",
                                                "small"
                                            ],
                                            "decision_makers": [
                                                "مدیر مالی",
                                                "مدیرعامل"
                                            ],
                                            "country": "ایران",
                                            "province": null,
                                            "city": null,
                                            "main_need": "حسابداری ساده و قانونی",
                                            "position": 1
                                        }
                                    ],
                                    "cells": [
                                        {
                                            "id": 9,
                                            "product_id": 39,
                                            "target_customer_id": 41,
                                            "label": "نرم‌افزار حسابداری ابری، برای شرکت‌های خرد و کوچک در ایران",
                                            "active": true,
                                            "position": 1
                                        }
                                    ],
                                    "limits": {
                                        "engines": [
                                            "chatgpt"
                                        ],
                                        "questions": 10,
                                        "products": 1,
                                        "customers": 1,
                                        "cells": 1,
                                        "changes_per_month": 2,
                                        "run_frequencies": [
                                            "monthly"
                                        ],
                                        "discovered_limit": 10,
                                        "citations_full": false,
                                        "all_runs": false
                                    },
                                    "question_counts": {
                                        "9": 10
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Get products, customers & cells",
                "description": "Products, target customers, matrix cells, plan limits and the number of questions per cell.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S2",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S2 Get products, customers & cells",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            },
            "put": {
                "operationId": "put-settings-products",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "products": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Unique ID."
                                                },
                                                "name": {
                                                    "type": "string",
                                                    "maxLength": 120
                                                },
                                                "generic_name": {
                                                    "type": "string",
                                                    "maxLength": 120
                                                },
                                                "type": {
                                                    "type": "string",
                                                    "enum": [
                                                        "software",
                                                        "service",
                                                        "physical",
                                                        "other"
                                                    ]
                                                },
                                                "features": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "maxLength": 80
                                                    },
                                                    "maxItems": 3
                                                }
                                            },
                                            "required": [
                                                "name",
                                                "generic_name",
                                                "type"
                                            ]
                                        },
                                        "minItems": 1,
                                        "description": "1..plan `products` (free 1, paid 3); same item rules as O4"
                                    },
                                    "customers": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "description": "Unique ID."
                                                },
                                                "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                        "b2b",
                                                        "b2c"
                                                    ]
                                                },
                                                "industries": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "maxLength": 80
                                                    },
                                                    "maxItems": 10
                                                },
                                                "sizes": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": "string",
                                                        "enum": [
                                                            "micro",
                                                            "small",
                                                            "medium",
                                                            "large"
                                                        ]
                                                    },
                                                    "maxItems": 2
                                                },
                                                "decision_makers": {
                                                    "type": [
                                                        "array",
                                                        "null"
                                                    ],
                                                    "items": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ],
                                                        "maxLength": 80
                                                    },
                                                    "maxItems": 5
                                                },
                                                "country": {
                                                    "type": "string",
                                                    "maxLength": 80
                                                },
                                                "province": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 80
                                                },
                                                "city": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 80
                                                },
                                                "main_need": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ],
                                                    "maxLength": 200
                                                }
                                            },
                                            "required": [
                                                "kind",
                                                "country"
                                            ]
                                        },
                                        "minItems": 1,
                                        "description": "1..plan `customers` (free 1, paid 2); same item rules as O5 (industries max 10, decision_makers max 5)"
                                    },
                                    "cells": {
                                        "type": [
                                            "array",
                                            "null"
                                        ],
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "product_id": {
                                                    "type": "integer"
                                                },
                                                "target_customer_id": {
                                                    "type": "integer"
                                                },
                                                "active": {
                                                    "type": "boolean"
                                                },
                                                "position": {
                                                    "type": [
                                                        "integer",
                                                        "null"
                                                    ],
                                                    "minimum": 1,
                                                    "maximum": 50
                                                }
                                            },
                                            "required": [
                                                "product_id",
                                                "target_customer_id",
                                                "active"
                                            ]
                                        },
                                        "maxItems": 12,
                                        "description": "max 12; `product_id`, `target_customer_id`, `active`, `position` 1–50; active ≤ plan `cells`"
                                    },
                                    "confirm": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "true = accept the question rebuild"
                                    }
                                },
                                "required": [
                                    "products",
                                    "customers"
                                ]
                            },
                            "x-rawi-template": "{\n  \"products\": [\n    {\n      \"id\": {{productId}},\n      \"name\": \"آوند ابری\",\n      \"generic_name\": \"نرم‌افزار حسابداری ابری\",\n      \"type\": \"software\",\n      \"features\": [\n        \"صدور فاکتور رسمی\",\n        \"اتصال به سامانه مودیان\",\n        \"دسترسی چندکاربره\"\n      ]\n    }\n  ],\n  \"customers\": [\n    {\n      \"id\": {{customerId}},\n      \"kind\": \"b2b\",\n      \"industries\": [\n        \"خدمات\",\n        \"بازرگانی\"\n      ],\n      \"sizes\": [\n        \"micro\",\n        \"small\"\n      ],\n      \"decision_makers\": [\n        \"مدیر مالی\",\n        \"مدیرعامل\"\n      ],\n      \"country\": \"ایران\",\n      \"province\": null,\n      \"city\": null,\n      \"main_need\": \"حسابداری ساده و قانونی\"\n    }\n  ],\n  \"cells\": [\n    {\n      \"product_id\": {{productId}},\n      \"target_customer_id\": {{customerId}},\n      \"active\": true,\n      \"position\": 1\n    }\n  ],\n  \"confirm\": false\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S2 Update products, customers & cells",
                                    "value": {
                                        "products": [
                                            {
                                                "id": 39,
                                                "name": "آوند ابری",
                                                "generic_name": "نرم‌افزار حسابداری ابری",
                                                "type": "software",
                                                "features": [
                                                    "صدور فاکتور رسمی",
                                                    "اتصال به سامانه مودیان",
                                                    "دسترسی چندکاربره"
                                                ]
                                            }
                                        ],
                                        "customers": [
                                            {
                                                "id": 41,
                                                "kind": "b2b",
                                                "industries": [
                                                    "خدمات",
                                                    "بازرگانی"
                                                ],
                                                "sizes": [
                                                    "micro",
                                                    "small"
                                                ],
                                                "decision_makers": [
                                                    "مدیر مالی",
                                                    "مدیرعامل"
                                                ],
                                                "country": "ایران",
                                                "province": null,
                                                "city": null,
                                                "main_need": "حسابداری ساده و قانونی"
                                            }
                                        ],
                                        "cells": [
                                            {
                                                "product_id": 39,
                                                "target_customer_id": 41,
                                                "active": true,
                                                "position": 1
                                            }
                                        ],
                                        "confirm": false
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "products": [
                                            {
                                                "id": 39,
                                                "name": "آوند ابری",
                                                "generic_name": "نرم‌افزار حسابداری ابری",
                                                "type": "software",
                                                "features": [
                                                    "صدور فاکتور رسمی",
                                                    "اتصال به سامانه مودیان",
                                                    "دسترسی چندکاربره"
                                                ]
                                            }
                                        ],
                                        "customers": [
                                            {
                                                "id": 41,
                                                "kind": "b2b",
                                                "industries": [
                                                    "خدمات",
                                                    "بازرگانی"
                                                ],
                                                "sizes": [
                                                    "micro",
                                                    "small"
                                                ],
                                                "decision_makers": [
                                                    "مدیر مالی",
                                                    "مدیرعامل"
                                                ],
                                                "country": "ایران",
                                                "province": null,
                                                "city": null,
                                                "main_need": "حسابداری ساده و قانونی"
                                            }
                                        ],
                                        "cells": [
                                            {
                                                "product_id": 39,
                                                "target_customer_id": 41,
                                                "active": true,
                                                "position": 1
                                            }
                                        ],
                                        "confirm": false
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "same as GET\n\n409 body (`ConfirmRequired`): `{\"message\":\"…\",\"requires_confirmation\":true,\"reason\":\"rebuild_questions\",\"questions_count\":10,\"changes\":[{\"field\":\"products.0.generic_name\",\"from\":\"نرم‌افزار حسابداری ابری\",\"to\":\"نرم‌افزار حسابداری آنلاین\"}]}`.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "products": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "generic_name": {
                                                        "type": "string"
                                                    },
                                                    "type": {
                                                        "type": "string"
                                                    },
                                                    "features": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "name",
                                                    "generic_name",
                                                    "type",
                                                    "features",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "customers": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "kind": {
                                                        "type": "string"
                                                    },
                                                    "name": {
                                                        "type": "string"
                                                    },
                                                    "industries": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "sizes": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "decision_makers": {
                                                        "type": "array",
                                                        "items": {}
                                                    },
                                                    "country": {
                                                        "type": "string"
                                                    },
                                                    "province": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "city": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "main_need": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "kind",
                                                    "name",
                                                    "industries",
                                                    "sizes",
                                                    "decision_makers",
                                                    "country",
                                                    "province",
                                                    "city",
                                                    "main_need",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "cells": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "id": {
                                                        "type": "integer",
                                                        "description": "Unique ID."
                                                    },
                                                    "product_id": {
                                                        "type": "integer"
                                                    },
                                                    "target_customer_id": {
                                                        "type": "integer"
                                                    },
                                                    "label": {
                                                        "type": "string"
                                                    },
                                                    "active": {
                                                        "type": "boolean"
                                                    },
                                                    "position": {
                                                        "type": "integer"
                                                    }
                                                },
                                                "required": [
                                                    "id",
                                                    "product_id",
                                                    "target_customer_id",
                                                    "label",
                                                    "active",
                                                    "position"
                                                ]
                                            }
                                        },
                                        "limits": {
                                            "type": "array",
                                            "items": {},
                                            "description": "Limits of the account's plan."
                                        },
                                        "question_counts": {
                                            "type": "object",
                                            "additionalProperties": {
                                                "type": "integer"
                                            }
                                        }
                                    },
                                    "required": [
                                        "products",
                                        "customers",
                                        "cells",
                                        "limits",
                                        "question_counts"
                                    ]
                                },
                                "example": {
                                    "…": "GET /settings/products body after saving"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`ConfirmRequired` — resend with `confirm: true`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ConfirmRequired"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (limits (`products` max, `cells` max/min), `products.N.generic_name` contains the brand, unknown ids)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Update products, customers & cells",
                "description": "Saves everything at once. Changing a generic name, product type, customer core fields or active cells rebuilds the questions and breaks the trend → 409 unless `confirm: true`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S2",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S2 Update products, customers & cells",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/reauth/request-code": {
            "post": {
                "operationId": "post-settings-reauth-request-code",
                "tags": [
                    "Settings"
                ],
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "sent": {
                                            "type": "boolean"
                                        },
                                        "channel": {
                                            "type": "string",
                                            "enum": [
                                                "email",
                                                "sms"
                                            ]
                                        },
                                        "to": {
                                            "type": "string"
                                        },
                                        "expires_in": {
                                            "type": "integer",
                                            "const": 600
                                        },
                                        "resend_in": {
                                            "type": "integer"
                                        },
                                        "dev_code": {
                                            "type": "string"
                                        }
                                    },
                                    "required": [
                                        "sent",
                                        "channel",
                                        "to",
                                        "expires_in",
                                        "resend_in",
                                        "dev_code"
                                    ]
                                },
                                "example": {
                                    "sent": true,
                                    "channel": "email",
                                    "to": "d***@rawi.local",
                                    "expires_in": 600,
                                    "resend_in": 45
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Resend timer, daily cap or sign-in lock: `{\"message\",\"resend_in\"}`",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/TooManyRequests"
                                }
                            }
                        }
                    }
                },
                "summary": "Confirm it's you: send a code to the current email or phone",
                "description": "Sends a 6-digit code (guard `reauth`) to the account's CURRENT email, or its verified phone when it has no email. The\ncode proves the person at the keyboard still controls the account before `POST /settings/email/verify`,\n`POST /settings/phone/verify`, `DELETE /settings/phone` or `DELETE /settings/account` (they all require\n`reauth_token`). Same timers and limits as sign-in codes; settings codes are capped per account per day\n(`RAWI_SETTINGS_CODES_DAILY`, default 10). Throttle 5/min.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "5/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S5 Confirm it's you: request code",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/reauth/verify": {
            "post": {
                "operationId": "post-settings-reauth-verify",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "code": {
                                        "type": "string",
                                        "maxLength": 12,
                                        "description": "the 6-digit code"
                                    }
                                },
                                "required": [
                                    "code"
                                ]
                            },
                            "x-rawi-template": "{\n  \"code\": \"{{devCode}}\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S5 Confirm it's you: verify code (get reauth_token)",
                                    "value": {
                                        "code": ""
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "reauth_token": {
                                            "type": "string"
                                        },
                                        "expires_in": {
                                            "type": "integer",
                                            "const": 600
                                        }
                                    },
                                    "required": [
                                        "reauth_token",
                                        "expires_in"
                                    ]
                                },
                                "example": {
                                    "reauth_token": "…",
                                    "expires_in": 600
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Wrong, expired or used-up code (`errors.code`)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    },
                    "429": {
                        "$ref": "#/components/responses/TooManyRequests"
                    }
                },
                "summary": "Confirm it's you: verify the code (get reauth_token)",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S5",
                "x-rawi-throttle": "10/1min",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S5 Confirm it's you: verify code (get reauth_token)",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/settings/run": {
            "get": {
                "operationId": "get-settings-run",
                "tags": [
                    "Settings"
                ],
                "responses": {
                    "200": {
                        "description": "RunSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "run_frequency": {
                                            "type": "string",
                                            "enum": [
                                                "weekly",
                                                "monthly"
                                            ]
                                        },
                                        "panel_locale": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "next_run_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "allowed_frequencies": {
                                            "type": "array",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "run_frequency",
                                        "panel_locale",
                                        "question_language",
                                        "next_run_at",
                                        "allowed_frequencies"
                                    ]
                                },
                                "example": {
                                    "run_frequency": "monthly",
                                    "panel_locale": "fa",
                                    "question_language": "fa",
                                    "next_run_at": "2026-12-25T10:30:00Z",
                                    "allowed_frequencies": [
                                        "monthly"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    }
                },
                "summary": "Get scan & language settings",
                "description": "Run frequency, panel language, question language, next run and the frequencies the plan allows.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S4",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S4 Get run & language settings",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            },
            "put": {
                "operationId": "put-settings-run",
                "tags": [
                    "Settings"
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "run_frequency": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "weekly",
                                            "monthly",
                                            null
                                        ],
                                        "description": "`weekly` (paid) | `monthly`"
                                    },
                                    "panel_locale": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "fa",
                                            "en",
                                            null
                                        ],
                                        "description": "`fa` | `en` (must be panel-enabled in A4)"
                                    },
                                    "question_language": {
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "enum": [
                                            "fa",
                                            "en",
                                            null
                                        ],
                                        "description": "`fa` | `en` (must be question-enabled in A4)"
                                    },
                                    "confirm": {
                                        "type": [
                                            "boolean",
                                            "null"
                                        ],
                                        "description": "accept the rebuild"
                                    }
                                }
                            },
                            "x-rawi-template": "{\n  \"run_frequency\": \"monthly\",\n  \"panel_locale\": \"fa\",\n  \"question_language\": \"fa\"\n}",
                            "examples": {
                                "postman": {
                                    "summary": "Postman: S4 Update run & language settings",
                                    "value": {
                                        "run_frequency": "monthly",
                                        "panel_locale": "fa",
                                        "question_language": "fa"
                                    }
                                },
                                "reference": {
                                    "summary": "Reference example",
                                    "value": {
                                        "run_frequency": "monthly",
                                        "panel_locale": "fa",
                                        "question_language": "fa"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "RunSettings",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "run_frequency": {
                                            "type": "string",
                                            "enum": [
                                                "weekly",
                                                "monthly"
                                            ]
                                        },
                                        "panel_locale": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "question_language": {
                                            "type": "string",
                                            "enum": [
                                                "en",
                                                "fa"
                                            ]
                                        },
                                        "next_run_at": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "allowed_frequencies": {
                                            "type": "array",
                                            "items": {}
                                        }
                                    },
                                    "required": [
                                        "run_frequency",
                                        "panel_locale",
                                        "question_language",
                                        "next_run_at",
                                        "allowed_frequencies"
                                    ]
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing/invalid token, or a token of the wrong owner (admin token on a user route or vice versa): `{\"message\":\"…\",\"code\":\"unauthenticated\"}` (message in the request language)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Unauthenticated"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "`plan_limit` — weekly on the free plan",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PlanLimit"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "`ConfirmRequired` (question language change)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ConfirmRequired"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Validation failed (language disabled in A4)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ValidationError"
                                }
                            }
                        }
                    }
                },
                "summary": "Update scan & language settings",
                "description": "Weekly runs are paid-only. Changing the question language rebuilds the whole set → 409 unless `confirm: true`.",
                "x-rawi-access": [
                    "user_free",
                    "user_paid"
                ],
                "x-rawi-access-note": "Customer token (Bearer) — free and paid users",
                "x-rawi-screen": "S4",
                "security": [
                    {
                        "userToken": []
                    }
                ],
                "x-postman": {
                    "name": "S4 Update run & language settings",
                    "folder": "08 Settings (S1, S2, S4, S5)"
                }
            }
        },
        "/status": {
            "get": {
                "operationId": "get-status",
                "description": "Whether the service is `live`, in planned `maintenance` or `updating` (a deploy in progress). Set with `php artisan rawi:down --mode=maintenance|updating --message=… --until=ISO8601` and cleared with `php artisan up` (see the maintenance-mode runbook). This route is excluded from Laravel's maintenance mode; while down, **every other** `/api/*` route answers `503` with `{\"error\":\"maintenance\",\"code\":\"maintenance\",\"state\",\"message\",\"until\",\"retry_after\"}` and a `Retry-After` header, and the web app switches to its maintenance / updating page and returns when `state` is `live`. `retry_after` (seconds) is null while live; while down it is the time left until `until` (5–300 s) or 30 s (maintenance) / 10 s (updating). Never cached (`Cache-Control: no-store`).",
                "summary": "Service status",
                "tags": [
                    "Public"
                ],
                "responses": {
                    "200": {
                        "description": "ServiceStatus",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "anyOf": [
                                        {
                                            "type": "object",
                                            "properties": {
                                                "state": {
                                                    "anyOf": [
                                                        {
                                                            "type": "string"
                                                        },
                                                        {
                                                            "type": "string",
                                                            "enum": [
                                                                "maintenance"
                                                            ]
                                                        }
                                                    ]
                                                },
                                                "message": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "until": {
                                                    "type": [
                                                        "string",
                                                        "null"
                                                    ]
                                                },
                                                "retry_after": {
                                                    "type": "integer"
                                                }
                                            },
                                            "required": [
                                                "state",
                                                "message",
                                                "until",
                                                "retry_after"
                                            ]
                                        },
                                        {
                                            "type": "object",
                                            "properties": {
                                                "state": {
                                                    "type": "string",
                                                    "const": "live"
                                                },
                                                "message": {
                                                    "type": "null"
                                                },
                                                "until": {
                                                    "type": "null"
                                                },
                                                "retry_after": {
                                                    "type": "null"
                                                }
                                            },
                                            "required": [
                                                "state",
                                                "message",
                                                "until",
                                                "retry_after"
                                            ]
                                        }
                                    ]
                                },
                                "example": {
                                    "state": "updating",
                                    "message": "Database upgrade",
                                    "until": "2026-12-01T02:00:00Z",
                                    "retry_after": 120
                                }
                            }
                        },
                        "headers": {
                            "Cache-Control": {
                                "schema": {
                                    "type": "string",
                                    "const": "no-store"
                                }
                            },
                            "Retry-After": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                },
                "x-rawi-access": [
                    "guest",
                    "user_free",
                    "user_paid",
                    "consultant",
                    "super"
                ],
                "x-rawi-access-note": "Public — no token, reachable while the API is down",
                "x-rawi-screen": "maintenance / updating pages",
                "security": [],
                "x-postman": {
                    "name": "Service status",
                    "folder": "02 Public"
                }
            }
        }
    },
    "components": {
        "responses": {
            "ModelNotFoundException": {
                "description": "Not found",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "properties": {
                                "message": {
                                    "type": "string",
                                    "description": "Error overview."
                                }
                            },
                            "required": [
                                "message"
                            ]
                        }
                    }
                }
            },
            "Unauthenticated": {
                "description": "Missing or invalid token, or a token of the wrong owner (user ↔ admin).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Unauthenticated"
                        }
                    }
                }
            },
            "ConfirmRequired": {
                "description": "The change needs confirmation (409).",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/ConfirmRequired"
                        }
                    }
                }
            },
            "TooManyRequests": {
                "description": "Rate limit or login-code resend cooldown. Headers: `Retry-After`, `X-RateLimit-*`.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/TooManyRequests"
                        }
                    }
                }
            }
        },
        "securitySchemes": {
            "userToken": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "Sanctum",
                "description": "Customer token from `POST /auth/verify` (email or mobile code). Rejected on admin routes (401)."
            }
        },
        "schemas": {
            "Message": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string"
                    }
                },
                "required": [
                    "message"
                ]
            },
            "Unauthenticated": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string",
                        "example": "Please sign in to continue; your session has ended or is not valid."
                    },
                    "code": {
                        "type": "string",
                        "example": "unauthenticated"
                    }
                },
                "required": [
                    "message"
                ]
            },
            "PlanLimit": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string",
                        "example": "این امکان در طرح راوی حرفه‌ای است."
                    },
                    "code": {
                        "type": "string",
                        "enum": [
                            "plan_limit",
                            "forbidden"
                        ]
                    }
                },
                "required": [
                    "message",
                    "code"
                ]
            },
            "ConfirmRequired": {
                "type": "object",
                "description": "Resend the same request with `\"confirm\": true` (or `\"confirm_below_floor\": true` for `below_floor`).",
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "requires_confirmation": {
                        "type": "boolean",
                        "const": true
                    },
                    "reason": {
                        "type": "string",
                        "examples": [
                            "rebuild_questions",
                            "below_floor"
                        ]
                    },
                    "questions_count": {
                        "type": "integer"
                    },
                    "changes": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "field": {
                                    "type": "string"
                                },
                                "from": {},
                                "to": {}
                            }
                        }
                    }
                },
                "required": [
                    "requires_confirmation"
                ]
            },
            "ValidationError": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "example": {
                            "email": [
                                "ایمیل معتبر نیست."
                            ]
                        }
                    }
                },
                "required": [
                    "message",
                    "errors"
                ]
            },
            "TooManyRequests": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string",
                        "example": "Too Many Attempts."
                    },
                    "resend_in": {
                        "type": "integer",
                        "description": "Seconds until a new login code may be requested (login-code cooldown only)."
                    }
                },
                "required": [
                    "message"
                ]
            }
        }
    },
    "tags": [
        {
            "name": "Auth & profile",
            "description": "Passwordless sign-in with an **email** (code by email) or an **Iranian mobile** (code by SMS, or a voice call as fallback; see docs/SMS.md). 6-digit code, 10 min, 5 attempts → Sanctum bearer token. Same flow for new and existing accounts ( «ایمیل تکراری»): the account is created on the first successful verify; a phone sign-up creates a phone-only account (`email: null`). The phone variants are also in the Postman folder «SMS»."
        },
        {
            "name": "Public",
            "description": "No authentication."
        },
        {
            "name": "Onboarding",
            "description": "Every step saves immediately and returns the full `OnboardingState`; the user can leave and resume. Steps advance `onboarding_step` and fire `onboarding_step_completed` / `suggestion_accepted` / `suggestion_modified` events."
        },
        {
            "name": "Questions",
            "description": "The active question set. Edits before the first approval are free; after approval each edit/replace counts as one change of the monthly allowance (free 2, paid 5). The allowance starts again on the first day of each Persian (Jalali) calendar month (`changes.resets_at`)."
        },
        {
            "name": "Scans & reports",
            "description": "Shared filters on every `/reports/*` endpoint: `run_id` (0/absent = latest finished run, or the running first run), `engine` = `all|chatgpt|gemini|claude`, `cell_id` (0/absent = all cells). Every report carries a `context: ReportContext` (selected run, previous run, selectable runs, engine availability/locks, cells, effective filters, `building`, `small_sample`, `engines_offline` = a run newer than the shown report is in progress and none of its engines can be reached, which drives the report banner «اتصال به سرویس‌های هوش مصنوعی قطع است…»). Free plan: a `run_id` other than the default run, or an engine outside the plan → 403 `plan_limit`. No brand yet → 404."
        },
        {
            "name": "Talk to an expert",
            "description": "The consultation button is on every report page. A request goes to the admin panel and triggers email to the user and a notification to the admins."
        },
        {
            "name": "Billing & payment gateway",
            "description": "Prices are integers in the gateway currency (Toman for IRT). Order of discounts: period discount → discount code (or the referral first-payment discount) → never below the monthly floor × months → VAT. Successful payment: plan `paid`, email, referral purchase recorded, user returns to the app to pick cells and build the extra questions."
        },
        {
            "name": "Settings",
            "description": "The app also manages the mobile number, the email of phone-only accounts and SMS notifications (`/settings/phone/*`, `/settings/email/*`, `/settings/notifications`; see docs/SMS.md). The app (questions) uses the `/questions` endpoints; the app uses `/referrals`. Changes that rebuild the question set answer **409 `ConfirmRequired`** first; resend the same body with `\"confirm\": true`."
        },
        {
            "name": "Referrals"
        },
        {
            "name": "Analytics events"
        },
        {
            "name": "Documentation"
        }
    ],
    "x-tagGroups": [
        {
            "name": "Public",
            "tags": [
                "Public",
                "Documentation"
            ]
        },
        {
            "name": "User",
            "tags": [
                "Auth & profile",
                "Onboarding",
                "Questions",
                "Scans & reports",
                "Talk to an expert",
                "Billing & payment gateway",
                "Settings",
                "Referrals",
                "Analytics events"
            ]
        }
    ],
    "x-postman-variables": {
        "baseUrl": "http://127.0.0.1:8010/api",
        "lang": "fa",
        "userEmail": "demo@rawi.local",
        "userPhone": "09120000077",
        "userToken": "",
        "devCode": "",
        "questionId": "345",
        "runId": "38",
        "productId": "39",
        "customerId": "41",
        "paymentId": "",
        "consultationId": "23",
        "gatewayId": "1",
        "reauthToken": ""
    },
    "x-generated": {
        "by": "php artisan docs:openapi",
        "base": "scramble",
        "operations": 73,
        "audience": "public"
    }
}
