{"openapi":"3.1.0","info":{"title":"ТапВей API","version":"1.0.0","description":"API проекта ТапВей: онлайн-запись, магазин, заявки, CRM, статистика. Доступно на тарифах «Про» и «Бизнес»."},"servers":[{"url":"https://api.tapway.me/v1"}],"tags":[{"name":"Основа"},{"name":"Онлайн-запись"},{"name":"Магазин"},{"name":"Заявки и квизы"},{"name":"CRM"},{"name":"Статистика"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Ключ проекта tw_live_… — создаётся в кабинете: Настройки → API"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Машинный код: unauthorized, forbidden, tariff, not_found, invalid, quota, rate_limited, slot_unavailable, booking_closed, content_rejected…"},"message":{"type":"string","description":"Текст для человека"},"fields":{"type":"array","items":{"type":"string"},"description":"Поля с ошибкой (при code=invalid)"}},"required":["code","message"]}},"required":["error"]},"Me":{"type":"object","properties":{"project":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"name":{"type":"string"},"address":{"type":"string","description":"Адрес страницы","example":"mob.bio/studio"}}},"tariff":{"type":"object","properties":{"code":{"type":"string","description":"pro или business"},"name":{"type":"string"}}},"key":{"type":"object","properties":{"name":{"type":"string"},"prefix":{"type":"string","description":"Начало ключа"},"scopes":{"type":"array","items":{"type":"string"}}}},"rate_limit":{"type":"object","properties":{"per_minute":{"type":"integer"},"per_day":{"type":"integer"},"remaining_minute":{"type":"integer"},"remaining_day":{"type":"integer"}}}}},"BookingResource":{"type":"object","properties":{"block_id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"masters":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"id мастера или ресурса внутри блока","example":"m1"},"name":{"type":"string"},"kind":{"type":"string","description":"time — запись по времени, daily — посуточно (номер, квартира)","enum":["time","daily"]},"work_start":{"type":"string","description":"Время HH:MM","pattern":"^\\d{2}:\\d{2}$","example":"14:30"},"work_end":{"type":"string","description":"Время HH:MM","pattern":"^\\d{2}:\\d{2}$","example":"14:30"},"services":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"id услуги внутри блока","example":"s_m1_0"},"name":{"type":"string"},"duration_min":{"type":"integer"},"price":{"type":["string","null"],"description":"Цена как её написал владелец","example":"1500 ₽"},"capacity":{"type":"integer","description":"Мест в сеансе или одинаковых ресурсов"},"max_per_booking":{"type":"integer","description":"Сколько мест можно взять одной записью"},"start_times":{"type":["array","null"],"items":{"type":"string","description":"Время HH:MM","pattern":"^\\d{2}:\\d{2}$","example":"14:30"},"description":"Фиксированные сеансы"},"min_nights":{"type":["integer","null"]},"max_nights":{"type":["integer","null"]},"prepay":{"type":["object","null"],"properties":{"amount":{"type":"number"}},"description":"Предоплата на странице. Через API запись создаётся без неё"}}}}}}}}},"Slots":{"type":"object","properties":{"kind":{"type":"string","enum":["time","daily"]},"date":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"},"duration_min":{"type":"integer","description":"Для kind=time"},"slots":{"type":"array","items":{"type":"object","properties":{"time":{"type":"string","description":"Время HH:MM","pattern":"^\\d{2}:\\d{2}$","example":"14:30"},"seats_left":{"type":"integer","description":"Свободных мест, если у услуги больше одного"}}},"description":"Для kind=time: свободное время"},"free_nights":{"type":"integer","description":"Для kind=daily: сколько ночей подряд свободно с даты заезда"},"min_nights":{"type":"integer"},"max_nights":{"type":"integer"}}},"Appointment":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"status":{"type":"string","enum":["scheduled","completed","cancelled","no_show"]},"block_id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"master":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"service":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"duration_min":{"type":["integer","null"]}}},"starts_at":{"type":"string","description":"Местное время записи","example":"2026-11-20 14:30"},"ends_at":{"type":["string","null"],"example":"2026-11-20 15:30"},"date":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"},"time":{"type":["string","null"],"description":"Время HH:MM","pattern":"^\\d{2}:\\d{2}$","example":"14:30"},"nights":{"type":["integer","null"]},"checkout_date":{"type":["string","null"],"description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"},"seats":{"type":"integer"},"client":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":["string","null"]}}},"comment":{"type":["string","null"]},"source":{"type":"string","description":"page — со страницы, api — через API"},"prepay":{"type":["object","null"],"properties":{"status":{"type":"string"},"amount":{"type":["number","null"]}}},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"updated_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"Category":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"parent_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":["string","null"]},"sort_order":{"type":"integer"},"is_active":{"type":"boolean"}}},"Variant":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"title":{"type":"string"},"sku":{"type":["string","null"]},"price":{"type":["number","null"]},"stock":{"type":["integer","null"],"description":"null — без учёта остатка"},"is_active":{"type":"boolean"}}},"Product":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"title":{"type":"string"},"slug":{"type":["string","null"]},"sku":{"type":["string","null"]},"description":{"type":["string","null"]},"price":{"type":"number"},"compare_at_price":{"type":["number","null"],"description":"Старая цена"},"currency":{"type":"string","example":"RUB"},"stock":{"type":["integer","null"],"description":"null — без учёта остатка"},"made_to_order":{"type":"boolean","description":"Под заказ"},"lead_days":{"type":["integer","null"],"description":"Срок изготовления, дней"},"weight_g":{"type":["integer","null"]},"dimensions":{"type":["object","null"],"properties":{"length":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}},"description":"См"},"is_active":{"type":"boolean"},"is_digital":{"type":"boolean"},"vat_code":{"type":["integer","null"]},"sort_order":{"type":"integer"},"images":{"type":"array","items":{"type":"string"},"description":"Первое — главное фото"},"category_ids":{"type":"array","items":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},"attributes":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}}}},"variants":{"type":"array","items":{"$ref":"#/components/schemas/Variant"}},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"updated_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"ProductInput":{"type":"object","properties":{"title":{"type":"string","description":"До 255 символов"},"sku":{"type":["string","null"],"description":"Артикул, до 64 символов. По нему пакетная загрузка находит товар"},"slug":{"type":"string","description":"Латиница, цифры, дефис"},"description":{"type":["string","null"],"description":"До 60 000 символов"},"price":{"type":"number"},"compare_at_price":{"type":["number","null"]},"stock":{"type":["integer","null"]},"made_to_order":{"type":"boolean"},"lead_days":{"type":["integer","null"]},"weight_g":{"type":["integer","null"]},"dimensions":{"type":["object","null"],"properties":{"length":{"type":"number"},"width":{"type":"number"},"height":{"type":"number"}}},"is_active":{"type":"boolean"},"is_digital":{"type":"boolean"},"vat_code":{"type":["integer","null"]},"sort_order":{"type":"integer"},"images":{"type":"array","items":{"type":"string"},"description":"Только адреса из POST /shop/images или уже стоящие в товарах проекта. До 20"},"category_ids":{"type":"array","items":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"description":"Пустой список снимает все категории"},"attributes":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"values":{"type":"array","items":{"type":"string"}}}}},"variants":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"sku":{"type":"string"},"price":{"type":"number"},"stock":{"type":["integer","null"]},"is_active":{"type":"boolean"}}},"description":"Только при создании. До 100"}}},"Order":{"type":"object","properties":{"id":{"type":"string","description":"Номер заказа","example":"TWMHX2K1A9F3C0D4E5B6A7C8D9"},"status":{"type":"string","enum":["new","pending","confirmed","paid","processing","shipped","completed","cancelled","refunded"]},"payment_status":{"type":"string"},"fulfillment_status":{"type":["string","null"]},"total":{"type":"number"},"items_total":{"type":"number"},"delivery_cost":{"type":"number"},"currency":{"type":"string"},"customer":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":["string","null"]}}},"delivery":{"type":"object","properties":{"type":{"type":["string","null"]},"address":{"type":["string","null"]},"pickup_point":{"type":["string","null"]},"tracking_url":{"type":["string","null"]}}},"notes":{"type":["string","null"],"description":"Комментарий покупателя"},"admin_notes":{"type":["string","null"],"description":"Заметка владельца"},"fields":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"value":{"type":"string"}}},"description":"Дополнительные поля формы заказа"},"items":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"variant_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"title":{"type":"string"},"qty":{"type":"integer"},"price":{"type":"number"}}}},"paid_at":{"type":["string","null"],"description":"Дата и время ISO 8601, UTC","format":"date-time"},"refunded_at":{"type":["string","null"],"description":"Дата и время ISO 8601, UTC","format":"date-time"},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"updated_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"Review":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"product_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"author_name":{"type":"string"},"rating":{"type":"integer","minimum":1,"maximum":5},"body":{"type":"string"},"status":{"type":"string","enum":["pending","published","hidden"]},"is_buyer":{"type":"boolean"},"reply":{"type":["string","null"]},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"published_at":{"type":["string","null"],"description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"FormLead":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"block_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"fields":{"type":"object","properties":{},"description":"Поля формы как их заполнил посетитель: имя поля → значение"},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"Survey":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"title":{"type":"string"},"mode":{"type":"string","enum":["survey","quiz","lead"]},"status":{"type":"string","enum":["draft","published","archived"]},"slug":{"type":"string"},"responses":{"type":"integer","description":"Завершённых ответов"},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"SurveyResponse":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"finished":{"type":"boolean"},"score":{"type":"integer"},"result":{"type":["string","null"],"description":"Итог квиза"},"answers":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"}}}},"contact":{"type":["object","null"],"properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}}},"started_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"finished_at":{"type":["string","null"],"description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"Contact":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"telegram":{"type":["string","null"]},"source":{"type":["string","null"]},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"updated_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"Deal":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"title":{"type":"string"},"stage":{"type":"string","description":"Стадия латиницей: new, in_progress, paid, shipped, done, won, lost…"},"amount":{"type":["number","null"]},"notes":{"type":["string","null"]},"contact":{"$ref":"#/components/schemas/Contact","type":[null,"null"]},"order_id":{"type":["string","null"],"description":"Номер заказа магазина"},"appointment_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"updated_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}},"Stats":{"type":"object","properties":{"period":{"type":"object","properties":{"kind":{"type":"string"},"from":{"type":["string","null"],"description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"},"to":{"type":["string","null"],"description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"},"days":{"type":["integer","null"]},"granularity":{"type":"string","enum":["hour","day"]},"surface":{"type":"string"}}},"totals":{"type":"object","properties":{"visits":{"type":"integer"},"unique_visitors":{"type":"integer"},"clicks":{"type":"integer"},"unique_clicks":{"type":"integer"}}},"series":{"type":"array","items":{"type":"object","properties":{}},"description":"Значения по часам или дням"},"top_links":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"clicks":{"type":"integer"}}}},"top_blocks":{"type":"array","items":{"type":"object","properties":{"block_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"label":{"type":"string"},"clicks":{"type":"integer"}}}},"top_referrers":{"type":"array","items":{"type":"object","properties":{}}},"top_geo":{"type":"array","items":{"type":"object","properties":{"country":{"type":"string"},"city":{"type":"string"},"cnt":{"type":"integer"}}}},"utm":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{}}},"mediums":{"type":"array","items":{"type":"object","properties":{}}},"campaigns":{"type":"array","items":{"type":"object","properties":{}}},"combos":{"type":"array","items":{"type":"object","properties":{}}}}}}},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string","description":"id события — один и тот же при повторах; по нему отсеивайте дубли"},"event":{"type":"string","example":"booking.created"},"created_at":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"},"multi_id":{"type":"integer"},"payload":{"type":"object","properties":{},"description":"Данные события"}}}}},"security":[{"bearer":[]}],"x-scopes":{"bookings:read":"Онлайн-запись: чтение","bookings:write":"Онлайн-запись: создание и изменение","leads:read":"Заявки и ответы квизов: чтение","shop:read":"Магазин: чтение","shop:write":"Магазин: товары и заказы","crm:read":"CRM: чтение контактов","crm:write":"CRM: контакты и сделки","stats:read":"Статистика: чтение"},"paths":{"/ping":{"get":{"tags":["Основа"],"summary":"Проверка ключа и связи","operationId":"ping","x-scope":"any","security":[{"bearer":[]}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"ok":{"type":"boolean"},"time":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}}}},"required":["data"]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/me":{"get":{"tags":["Основа"],"summary":"Проект, тариф, права и лимиты ключа","operationId":"me","x-scope":"any","security":[{"bearer":[]}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Me"}},"required":["data"]},"example":{"data":{"project":{"id":"fe6dee299ccf49369e79d9e18ca741c1","name":"Студия Анны","address":"mob.bio/studio-anna"},"tariff":{"code":"pro","name":"Про"},"key":{"name":"Сайт студии","prefix":"tw_live_aKpn","scopes":["bookings:read","bookings:write"]},"rate_limit":{"per_minute":60,"per_day":10000,"remaining_minute":59,"remaining_day":9874}}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/booking/resources":{"get":{"tags":["Онлайн-запись"],"summary":"Блоки записи: мастера, ресурсы и услуги","operationId":"bookingResources","x-scope":"bookings:read","security":[{"bearer":[]}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BookingResource"}}},"required":["data"]},"example":{"data":[{"block_id":"9db0cf42adc44b4e8c17bdede6b20a02","masters":[{"id":"m1","name":"Анна","kind":"time","work_start":"10:00","work_end":"20:00","services":[{"id":"s1","name":"Стрижка","duration_min":60,"price":"1500 ₽","capacity":1,"max_per_booking":1,"start_times":null,"min_nights":null,"max_nights":null,"prepay":null}]}]}]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/booking/slots":{"get":{"tags":["Онлайн-запись"],"summary":"Свободное время на дату","description":"Для записи по времени — свободные слоты дня. Для посуточных ресурсов — сколько ночей подряд свободно с даты заезда.","operationId":"bookingSlots","x-scope":"bookings:read","security":[{"bearer":[]}],"parameters":[{"name":"block_id","in":"query","required":true,"description":"id блока записи","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},{"name":"master_id","in":"query","required":true,"description":"id мастера или ресурса","schema":{"type":"string"}},{"name":"service_id","in":"query","required":true,"description":"id услуги","schema":{"type":"string"}},{"name":"date","in":"query","required":true,"description":"Дата","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"seats","in":"query","required":false,"description":"Сколько мест нужно (для групп)","schema":{"type":"integer"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Slots"}},"required":["data"]},"example":{"data":{"kind":"time","date":"2026-11-20","duration_min":60,"slots":[{"time":"10:00"},{"time":"11:00"}]}}}}},"400":{"description":"Неверные параметры","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Блок, мастер или услуга не найдены","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Запись закрыта (исчерпан лимит записей тарифа)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/booking/appointments":{"get":{"tags":["Онлайн-запись"],"summary":"Список записей","operationId":"bookingList","x-scope":"bookings:read","security":[{"bearer":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"С даты записи","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"to","in":"query","required":false,"description":"По дату записи","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"status","in":"query","required":false,"description":"scheduled, completed, cancelled или no_show","schema":{"type":"string"}},{"name":"block_id","in":"query","required":false,"description":"Только этот блок","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},{"name":"updated_since","in":"query","required":false,"description":"Только изменённые после этого момента (ISO 8601)","schema":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Appointment"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"9a395e452787c014acb54d98d7549a27","status":"scheduled","block_id":"9db0cf42adc44b4e8c17bdede6b20a02","master":{"id":"m1","name":"Анна"},"service":{"id":"s1","name":"Стрижка","duration_min":60},"starts_at":"2026-11-20 14:00","ends_at":"2026-11-20 15:00","date":"2026-11-20","time":"14:00","nights":null,"checkout_date":null,"seats":1,"client":{"name":"Мария","phone":"+79001234567","email":null},"comment":"Из CRM","source":"api","prepay":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Онлайн-запись"],"summary":"Создать запись","description":"Те же проверки, что у формы на странице: свободное время, места, лимит записей клиента в день, месячный лимит тарифа. Уведомления владельцу, мастеру и клиенту уходят как обычно. Предоплата через API не запрашивается.","operationId":"bookingCreate","x-scope":"bookings:write","security":[{"bearer":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Защита от дублей: повтор с тем же ключом (8–80 символов) в течение суток вернёт первый ответ, не создавая второй объект","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"block_id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"master_id":{"type":"string"},"service_id":{"type":"string"},"date":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"},"time":{"type":"string","description":"HH:MM — для записи по времени"},"nights":{"type":"integer","description":"Для посуточных"},"seats":{"type":"integer","description":"Мест (по умолчанию 1)"},"client":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string","description":"10–15 цифр"},"email":{"type":"string"},"telegram":{"type":"string"}},"required":["name","phone"]},"comment":{"type":"string","description":"До 1000 символов"}},"required":["block_id","master_id","service_id","date","client"]},"example":{"block_id":"9db0cf42adc44b4e8c17bdede6b20a02","master_id":"m1","service_id":"s1","date":"2026-11-20","time":"14:00","client":{"name":"Анна","phone":"+79001234567"},"comment":"Из CRM"}}}},"responses":{"201":{"description":"Запись создана","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Appointment"}},"required":["data"]},"example":{"data":{"id":"9a395e452787c014acb54d98d7549a27","status":"scheduled","block_id":"9db0cf42adc44b4e8c17bdede6b20a02","master":{"id":"m1","name":"Анна"},"service":{"id":"s1","name":"Стрижка","duration_min":60},"starts_at":"2026-11-20 14:00","ends_at":"2026-11-20 15:00","date":"2026-11-20","time":"14:00","nights":null,"checkout_date":null,"seats":1,"client":{"name":"Мария","phone":"+79001234567","email":null},"comment":"Из CRM","source":"api","prepay":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}}}}},"400":{"description":"Неверные поля","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Блок, мастер или услуга не найдены","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Время занято (slot_unavailable), лимит клиента (client_limit) или запись закрыта (booking_closed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Idempotency-Key уже использован с другим запросом","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/booking/appointments/{id}":{"get":{"tags":["Онлайн-запись"],"summary":"Одна запись","operationId":"bookingGet","x-scope":"bookings:read","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id записи","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Appointment"}},"required":["data"]},"example":{"data":{"id":"9a395e452787c014acb54d98d7549a27","status":"scheduled","block_id":"9db0cf42adc44b4e8c17bdede6b20a02","master":{"id":"m1","name":"Анна"},"service":{"id":"s1","name":"Стрижка","duration_min":60},"starts_at":"2026-11-20 14:00","ends_at":"2026-11-20 15:00","date":"2026-11-20","time":"14:00","nights":null,"checkout_date":null,"seats":1,"client":{"name":"Мария","phone":"+79001234567","email":null},"comment":"Из CRM","source":"api","prepay":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Онлайн-запись"],"summary":"Сменить статус записи","description":"completed — пришёл, no_show — не пришёл, cancelled — отмена (клиент получит сообщение, время освободится). Вернуть отменённую запись нельзя — создайте новую.","operationId":"bookingStatus","x-scope":"bookings:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id записи","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["scheduled","completed","cancelled","no_show"]}},"required":["status"]},"example":{"status":"cancelled"}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Appointment"}},"required":["data"]},"example":{"data":{"id":"9a395e452787c014acb54d98d7549a27","status":"cancelled","block_id":"9db0cf42adc44b4e8c17bdede6b20a02","master":{"id":"m1","name":"Анна"},"service":{"id":"s1","name":"Стрижка","duration_min":60},"starts_at":"2026-11-20 14:00","ends_at":"2026-11-20 15:00","date":"2026-11-20","time":"14:00","nights":null,"checkout_date":null,"seats":1,"client":{"name":"Мария","phone":"+79001234567","email":null},"comment":"Из CRM","source":"api","prepay":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}}}}},"400":{"description":"Неверный статус","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Нельзя вернуть отменённую","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/booking/appointments/{id}/reschedule":{"post":{"tags":["Онлайн-запись"],"summary":"Перенести запись","description":"Проверяется, свободно ли новое время (сама запись в занятость не считается). Клиент и мастер получат сообщение о переносе.","operationId":"bookingReschedule","x-scope":"bookings:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id записи","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"},"time":{"type":"string","description":"HH:MM"},"nights":{"type":"integer","description":"Для посуточных"}},"required":["date"]},"example":{"date":"2026-11-21","time":"15:00"}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Appointment"}},"required":["data"]},"example":{"data":{"id":"9a395e452787c014acb54d98d7549a27","status":"scheduled","block_id":"9db0cf42adc44b4e8c17bdede6b20a02","master":{"id":"m1","name":"Анна"},"service":{"id":"s1","name":"Стрижка","duration_min":60},"starts_at":"2026-11-21 15:00","ends_at":"2026-11-21 16:00","date":"2026-11-21","time":"15:00","nights":null,"checkout_date":null,"seats":1,"client":{"name":"Мария","phone":"+79001234567","email":null},"comment":"Из CRM","source":"api","prepay":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}}}}},"400":{"description":"Неверные поля","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Время занято или запись не активна","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/categories":{"get":{"tags":["Магазин"],"summary":"Категории","operationId":"shopCategories","x-scope":"shop:read","security":[{"bearer":[]}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}},"required":["data"]},"example":{"data":[{"id":"b6f79eaadf6c11f19760fa163eb739b5","parent_id":null,"title":"Свечи","slug":"svechi","description":"Ароматные свечи ручной работы","sort_order":0,"is_active":true}]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Магазин"],"summary":"Создать категорию","description":"Один уровень вложенности: подкатегория кладётся только в категорию верхнего уровня.","operationId":"shopCategoryCreate","x-scope":"shop:write","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"parent_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"sort_order":{"type":"integer"},"is_active":{"type":"boolean"}},"required":["title"]},"example":{"title":"Свечи","description":"Ароматные свечи ручной работы"}}}},"responses":{"201":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Category"}},"required":["data"]},"example":{"data":{"id":"b6f79eaadf6c11f19760fa163eb739b5","parent_id":null,"title":"Свечи","slug":"svechi","description":"Ароматные свечи ручной работы","sort_order":0,"is_active":true}}}}},"400":{"description":"Неверные поля","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Родитель не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/categories/{id}":{"patch":{"tags":["Магазин"],"summary":"Изменить категорию","operationId":"shopCategoryUpdate","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id категории","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string"},"parent_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"sort_order":{"type":"integer"},"is_active":{"type":"boolean"}}},"example":{"title":"Соевые свечи","is_active":false}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Category"}},"required":["data"]},"example":{"data":{"id":"b6f79eaadf6c11f19760fa163eb739b5","parent_id":null,"title":"Свечи","slug":"svechi","description":"Ароматные свечи ручной работы","sort_order":0,"is_active":true}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Магазин"],"summary":"Удалить категорию","operationId":"shopCategoryDelete","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id категории","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"deleted":{"type":"boolean"}}}},"required":["data"]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/attributes":{"get":{"tags":["Магазин"],"summary":"Характеристики товаров","operationId":"shopAttributes","x-scope":"shop:read","security":[{"bearer":[]}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string"},"is_filter":{"type":"boolean"}}}}},"required":["data"]},"example":{"data":[{"name":"Аромат","slug":"aromat","is_filter":true}]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/products":{"get":{"tags":["Магазин"],"summary":"Список товаров","operationId":"shopProducts","x-scope":"shop:read","security":[{"bearer":[]}],"parameters":[{"name":"active","in":"query","required":false,"description":"1 — только показанные, 0 — только скрытые","schema":{"type":"string"}},{"name":"sku","in":"query","required":false,"description":"По артикулу","schema":{"type":"string"}},{"name":"category_id","in":"query","required":false,"description":"Из категории","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},{"name":"updated_since","in":"query","required":false,"description":"Только изменённые после этого момента (ISO 8601)","schema":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"7cc0184d032b083e9a398a0c9076c4dc","title":"Свеча «Лаванда»","slug":"svecha-lavanda","sku":"LAV-1","description":"Соевый воск, 40 часов горения","price":990,"compare_at_price":1200,"currency":"RUB","stock":10,"made_to_order":false,"lead_days":null,"weight_g":300,"dimensions":null,"is_active":true,"is_digital":false,"vat_code":null,"sort_order":0,"images":["https://mob.bio/api/media/s3?key=iteration%2Fshop%2F…jpg"],"category_ids":["b6f79eaadf6c11f19760fa163eb739b5"],"attributes":[{"name":"Аромат","values":["лаванда"]}],"variants":[{"id":"88a3467d6b7aaf2ca805017f59430342","title":"200 мл","sku":"LAV-1-200","price":990,"stock":5,"is_active":true}],"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Магазин"],"summary":"Создать товар","description":"Название, описание и варианты проверяются на запрещённое содержание, ссылки в описании — по базе опасных адресов. Фото — только загруженные через POST /shop/images.","operationId":"shopProductCreate","x-scope":"shop:write","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"},"example":{"title":"Свеча «Лаванда»","sku":"LAV-1","price":990,"stock":10,"images":["https://mob.bio/api/media/s3?key=…"],"category_ids":["b6f79eaadf6c11f19760fa163eb739b5"],"variants":[{"title":"200 мл","price":990,"stock":5}]}}}},"responses":{"201":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"}},"required":["data"]},"example":{"data":{"id":"7cc0184d032b083e9a398a0c9076c4dc","title":"Свеча «Лаванда»","slug":"svecha-lavanda","sku":"LAV-1","description":"Соевый воск, 40 часов горения","price":990,"compare_at_price":1200,"currency":"RUB","stock":10,"made_to_order":false,"lead_days":null,"weight_g":300,"dimensions":null,"is_active":true,"is_digital":false,"vat_code":null,"sort_order":0,"images":["https://mob.bio/api/media/s3?key=iteration%2Fshop%2F…jpg"],"category_ids":["b6f79eaadf6c11f19760fa163eb739b5"],"attributes":[{"name":"Аромат","values":["лаванда"]}],"variants":[{"id":"88a3467d6b7aaf2ca805017f59430342","title":"200 мл","sku":"LAV-1-200","price":990,"stock":5,"is_active":true}],"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}}}}},"400":{"description":"Неверные поля или чужие фото","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Текст не прошёл проверку содержания","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/products/{id}":{"get":{"tags":["Магазин"],"summary":"Один товар","operationId":"shopProduct","x-scope":"shop:read","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id товара","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"}},"required":["data"]},"example":{"data":{"id":"7cc0184d032b083e9a398a0c9076c4dc","title":"Свеча «Лаванда»","slug":"svecha-lavanda","sku":"LAV-1","description":"Соевый воск, 40 часов горения","price":990,"compare_at_price":1200,"currency":"RUB","stock":10,"made_to_order":false,"lead_days":null,"weight_g":300,"dimensions":null,"is_active":true,"is_digital":false,"vat_code":null,"sort_order":0,"images":["https://mob.bio/api/media/s3?key=iteration%2Fshop%2F…jpg"],"category_ids":["b6f79eaadf6c11f19760fa163eb739b5"],"attributes":[{"name":"Аромат","values":["лаванда"]}],"variants":[{"id":"88a3467d6b7aaf2ca805017f59430342","title":"200 мл","sku":"LAV-1-200","price":990,"stock":5,"is_active":true}],"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Магазин"],"summary":"Изменить товар","description":"Передавайте только меняющиеся поля. Варианты меняются своими методами.","operationId":"shopProductUpdate","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id товара","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductInput"},"example":{"price":1090,"stock":8}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Product"}},"required":["data"]},"example":{"data":{"id":"7cc0184d032b083e9a398a0c9076c4dc","title":"Свеча «Лаванда»","slug":"svecha-lavanda","sku":"LAV-1","description":"Соевый воск, 40 часов горения","price":990,"compare_at_price":1200,"currency":"RUB","stock":10,"made_to_order":false,"lead_days":null,"weight_g":300,"dimensions":null,"is_active":true,"is_digital":false,"vat_code":null,"sort_order":0,"images":["https://mob.bio/api/media/s3?key=iteration%2Fshop%2F…jpg"],"category_ids":["b6f79eaadf6c11f19760fa163eb739b5"],"attributes":[{"name":"Аромат","values":["лаванда"]}],"variants":[{"id":"88a3467d6b7aaf2ca805017f59430342","title":"200 мл","sku":"LAV-1-200","price":990,"stock":5,"is_active":true}],"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:00:00.000Z"}}}}},"400":{"description":"Неверные поля","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Текст не прошёл проверку","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Магазин"],"summary":"Удалить товар","operationId":"shopProductDelete","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id товара","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"deleted":{"type":"boolean"}}}},"required":["data"]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/products/bulk":{"post":{"tags":["Магазин"],"summary":"Пакетная загрузка до 100 товаров","description":"Товар с артикулом (sku), который уже есть в магазине, обновляется (без вариантов), остальные создаются. Ошибка одной позиции не останавливает остальные. Не больше 60 пакетов в час на ключ.","operationId":"shopProductsBulk","x-scope":"shop:write","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"$ref":"#/components/schemas/ProductInput"}}},"required":["products"]},"example":{"products":[{"sku":"LAV-1","title":"Свеча «Лаванда»","price":1090,"stock":8},{"sku":"ROSE-1","title":"Свеча «Роза»","price":890}]}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"ok":{"type":"boolean"},"action":{"type":"string","enum":["created","updated"]},"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}},"required":["data"]},"example":{"data":[{"index":0,"ok":true,"action":"updated","id":"7cc0184d032b083e9a398a0c9076c4dc"},{"index":1,"ok":false,"error":{"code":"invalid","message":"Проверьте поля: title"}}]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/products/bulk-delete":{"post":{"tags":["Магазин"],"summary":"Удалить до 500 товаров","operationId":"shopProductsBulkDelete","x-scope":"shop:write","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}},"required":["ids"]},"example":{"ids":["7cc0184d032b083e9a398a0c9076c4dc"]}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"deleted":{"type":"integer"}}}},"required":["data"]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/products/{id}/variants":{"post":{"tags":["Магазин"],"summary":"Добавить вариант","operationId":"shopVariantCreate","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id товара","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"sku":{"type":"string"},"price":{"type":["number","null"]},"stock":{"type":["integer","null"]},"is_active":{"type":"boolean"}},"required":["title"]},"example":{"title":"400 мл","price":1590,"stock":3}}}},"responses":{"201":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Variant"}},"required":["data"]},"example":{"data":{"id":"88a3467d6b7aaf2ca805017f59430342","title":"200 мл","sku":"LAV-1-200","price":990,"stock":5,"is_active":true}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Товар не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/products/{id}/variants/{vid}":{"patch":{"tags":["Магазин"],"summary":"Изменить вариант","operationId":"shopVariantUpdate","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id товара","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},{"name":"vid","in":"path","required":true,"description":"id варианта","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"sku":{"type":"string"},"price":{"type":["number","null"]},"stock":{"type":["integer","null"]},"is_active":{"type":"boolean"}}},"example":{"stock":7}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Variant"}},"required":["data"]},"example":{"data":{"id":"88a3467d6b7aaf2ca805017f59430342","title":"200 мл","sku":"LAV-1-200","price":990,"stock":5,"is_active":true}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Магазин"],"summary":"Удалить вариант","operationId":"shopVariantDelete","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id товара","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},{"name":"vid","in":"path","required":true,"description":"id варианта","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"deleted":{"type":"boolean"}}}},"required":["data"]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/images":{"post":{"tags":["Магазин"],"summary":"Загрузить фото товара","description":"multipart/form-data, поле file: PNG, JPEG, WebP, GIF, AVIF, до 8 МБ. Фото проверяется на откровенное содержание до сохранения. Верните url в images товара. Не больше 300 фото в час на ключ.","operationId":"shopImageUpload","x-scope":"shop:write","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","description":"Файл изображения","format":"binary"}},"required":["file"]}}}},"responses":{"201":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"url":{"type":"string"}}}},"required":["data"]},"example":{"data":{"url":"https://mob.bio/api/media/s3?key=iteration%2Fshop%2F1794579344013-b1b2.jpg"}}}}},"400":{"description":"Не изображение","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Больше 8 МБ","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Фото не прошло проверку","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/orders":{"get":{"tags":["Магазин"],"summary":"Список заказов","operationId":"shopOrders","x-scope":"shop:read","security":[{"bearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"description":"Статус заказа","schema":{"type":"string"}},{"name":"payment_status","in":"query","required":false,"description":"Статус оплаты","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"Создан с даты","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"to","in":"query","required":false,"description":"Создан по дату","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"updated_since","in":"query","required":false,"description":"Только изменённые после этого момента (ISO 8601)","schema":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Order"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"TWMHX2K1A9F3C0D4E5B6A7C8D9","status":"paid","payment_status":"paid","fulfillment_status":"unfulfilled","total":2280,"items_total":1980,"delivery_cost":300,"currency":"RUB","customer":{"name":"Мария","phone":"+79001234567","email":"maria@example.com"},"delivery":{"type":"courier","address":"Москва, ул. Лесная, 5","pickup_point":null,"tracking_url":null},"notes":"Позвоните за час","admin_notes":null,"fields":[],"items":[{"product_id":"7cc0184d032b083e9a398a0c9076c4dc","variant_id":"88a3467d6b7aaf2ca805017f59430342","title":"Свеча «Лаванда» 200 мл","qty":2,"price":990}],"paid_at":"2026-11-13T12:05:00.000Z","refunded_at":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:05:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/orders/{id}":{"get":{"tags":["Магазин"],"summary":"Один заказ по номеру","operationId":"shopOrder","x-scope":"shop:read","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Номер заказа TW…","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Order"}},"required":["data"]},"example":{"data":{"id":"TWMHX2K1A9F3C0D4E5B6A7C8D9","status":"paid","payment_status":"paid","fulfillment_status":"unfulfilled","total":2280,"items_total":1980,"delivery_cost":300,"currency":"RUB","customer":{"name":"Мария","phone":"+79001234567","email":"maria@example.com"},"delivery":{"type":"courier","address":"Москва, ул. Лесная, 5","pickup_point":null,"tracking_url":null},"notes":"Позвоните за час","admin_notes":null,"fields":[],"items":[{"product_id":"7cc0184d032b083e9a398a0c9076c4dc","variant_id":"88a3467d6b7aaf2ca805017f59430342","title":"Свеча «Лаванда» 200 мл","qty":2,"price":990}],"paid_at":"2026-11-13T12:05:00.000Z","refunded_at":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:05:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["Магазин"],"summary":"Статус, отслеживание, заметка","description":"Отмена возвращает остатки на склад, покупатель получает письмо о смене статуса — как из кабинета. Отменённый или возвращённый заказ не меняется. Отправления СДЭК/Яндекс через API не создаются.","operationId":"shopOrderUpdate","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Номер заказа TW…","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["new","pending","confirmed","paid","processing","shipped","completed","cancelled","refunded"]},"tracking_url":{"type":"string","description":"https://…"},"admin_notes":{"type":"string"}}},"example":{"status":"shipped","tracking_url":"https://www.cdek.ru/ru/tracking?order_id=123"}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Order"}},"required":["data"]},"example":{"data":{"id":"TWMHX2K1A9F3C0D4E5B6A7C8D9","status":"shipped","payment_status":"paid","fulfillment_status":"unfulfilled","total":2280,"items_total":1980,"delivery_cost":300,"currency":"RUB","customer":{"name":"Мария","phone":"+79001234567","email":"maria@example.com"},"delivery":{"type":"courier","address":"Москва, ул. Лесная, 5","pickup_point":null,"tracking_url":"https://www.cdek.ru/ru/tracking?order_id=123"},"notes":"Позвоните за час","admin_notes":null,"fields":[],"items":[{"product_id":"7cc0184d032b083e9a398a0c9076c4dc","variant_id":"88a3467d6b7aaf2ca805017f59430342","title":"Свеча «Лаванда» 200 мл","qty":2,"price":990}],"paid_at":"2026-11-13T12:05:00.000Z","refunded_at":null,"created_at":"2026-11-13T12:00:00.000Z","updated_at":"2026-11-13T12:05:00.000Z"}}}}},"400":{"description":"Неверные поля","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Заказ уже отменён или возвращён","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/reviews":{"get":{"tags":["Магазин"],"summary":"Отзывы","operationId":"shopReviews","x-scope":"shop:read","security":[{"bearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"description":"pending, published или hidden","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Review"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"5d1e0c7a9b2f4e6d8c3a1b0f9e8d7c6b","product_id":"7cc0184d032b083e9a398a0c9076c4dc","author_name":"Ольга","rating":5,"body":"Пахнет чудесно, горит долго","status":"published","is_buyer":true,"reply":"Спасибо!","created_at":"2026-11-12T09:00:00.000Z","published_at":"2026-11-12T10:00:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shop/reviews/{id}":{"patch":{"tags":["Магазин"],"summary":"Опубликовать, скрыть, ответить","operationId":"shopReviewUpdate","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id отзыва","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","published","hidden"]},"reply":{"type":["string","null"]}}},"example":{"status":"published","reply":"Спасибо за отзыв!"}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Review"}},"required":["data"]},"example":{"data":{"id":"5d1e0c7a9b2f4e6d8c3a1b0f9e8d7c6b","product_id":"7cc0184d032b083e9a398a0c9076c4dc","author_name":"Ольга","rating":5,"body":"Пахнет чудесно, горит долго","status":"published","is_buyer":true,"reply":"Спасибо!","created_at":"2026-11-12T09:00:00.000Z","published_at":"2026-11-12T10:00:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"tags":["Магазин"],"summary":"Удалить отзыв","operationId":"shopReviewDelete","x-scope":"shop:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id отзыва","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"deleted":{"type":"boolean"}}}},"required":["data"]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/leads/forms":{"get":{"tags":["Заявки и квизы"],"summary":"Заявки с форм мультиссылки и сайта","operationId":"leadForms","x-scope":"leads:read","security":[{"bearer":[]}],"parameters":[{"name":"from","in":"query","required":false,"description":"С даты","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"to","in":"query","required":false,"description":"По дату","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FormLead"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"2b7f0c9e4d3a4f1e8a6c5d2b1e0f9a8c","block_id":"4f3e2d1c0b9a48b7a6c5d4e3f2a1b0c9","name":"Ольга","phone":"+79165551230","email":null,"fields":{"name":"Ольга","phone":"+79165551230","message":"Хочу на консультацию"},"created_at":"2026-11-13T09:14:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/leads/surveys":{"get":{"tags":["Заявки и квизы"],"summary":"Квизы и опросы","operationId":"leadSurveys","x-scope":"leads:read","security":[{"bearer":[]}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Survey"}}},"required":["data"]},"example":{"data":[{"id":"c1d2e3f4a5b6478899aabbccddeeff00","title":"Подбор ухода","mode":"quiz","status":"published","slug":"podbor-uhoda","responses":42,"created_at":"2026-10-01T08:00:00.000Z"}]}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/leads/surveys/{id}/responses":{"get":{"tags":["Заявки и квизы"],"summary":"Ответы квиза","description":"По умолчанию — только завершённые. finished=all — вместе с брошенными на полпути.","operationId":"leadSurveyResponses","x-scope":"leads:read","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id квиза","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},{"name":"finished","in":"query","required":false,"description":"all — все ответы","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Только изменённые после этого момента (ISO 8601)","schema":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SurveyResponse"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"0f1e2d3c4b5a49687766554433221100","finished":true,"score":3,"result":"Уход для сухой кожи","answers":[{"question":"Тип кожи","answer":"Сухая"},{"question":"Что важнее всего?","answer":"Увлажнение"}],"contact":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":null},"started_at":"2026-11-13T10:00:00.000Z","finished_at":"2026-11-13T10:02:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Квиз не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/crm/contacts":{"get":{"tags":["CRM"],"summary":"Контакты","operationId":"crmContacts","x-scope":"crm:read","security":[{"bearer":[]}],"parameters":[{"name":"q","in":"query","required":false,"description":"Поиск по имени, телефону, почте","schema":{"type":"string"}},{"name":"updated_since","in":"query","required":false,"description":"Только изменённые после этого момента (ISO 8601)","schema":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["CRM"],"summary":"Создать или обновить контакт","description":"Контакт с тем же телефоном (последние 10 цифр) или почтой обновляется — ответ 200 и created=false. Новый — 201. Новый контакт упирается в лимит контактов тарифа.","operationId":"crmContactUpsert","x-scope":"crm:write","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"telegram":{"type":"string"}}},"example":{"name":"Вика","phone":"+79001234567","email":"vika@example.com"}}}},"responses":{"201":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"},"created":{"type":"boolean"}}},"example":{"data":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"},"created":true}}}},"400":{"description":"Нужны name, phone или email","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/crm/contacts/{id}":{"get":{"tags":["CRM"],"summary":"Один контакт","operationId":"crmContact","x-scope":"crm:read","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id контакта","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"}},"required":["data"]},"example":{"data":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["CRM"],"summary":"Изменить контакт","operationId":"crmContactUpdate","x-scope":"crm:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id контакта","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"telegram":{"type":["string","null"]}}},"example":{"telegram":"@vika"}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Contact"}},"required":["data"]},"example":{"data":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/crm/deals":{"get":{"tags":["CRM"],"summary":"Сделки","operationId":"crmDeals","x-scope":"crm:read","security":[{"bearer":[]}],"parameters":[{"name":"stage","in":"query","required":false,"description":"Стадия","schema":{"type":"string"}},{"name":"contact_id","in":"query","required":false,"description":"Сделки контакта","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}},{"name":"updated_since","in":"query","required":false,"description":"Только изменённые после этого момента (ISO 8601)","schema":{"type":"string","description":"Дата и время ISO 8601, UTC","format":"date-time"}},{"name":"limit","in":"query","required":false,"description":"Сколько записей вернуть, 1–200 (по умолчанию 50)","schema":{"type":"integer"}},{"name":"cursor","in":"query","required":false,"description":"next_cursor из предыдущего ответа","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}},"next_cursor":{"type":["string","null"],"description":"Есть следующая страница — передайте в cursor"}},"required":["data","next_cursor"]},"example":{"data":[{"id":"9ea5407a0603f126bbe547928069239c","title":"Курс ухода","stage":"won","amount":4900,"notes":null,"contact":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"},"order_id":null,"appointment_id":null,"created_at":"2026-11-13T10:10:00.000Z","updated_at":"2026-11-13T11:00:00.000Z"}],"next_cursor":"YzoxMjM0"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["CRM"],"summary":"Создать сделку","description":"Контакт — по contact_id или полями contact (найдём по телефону/почте или создадим). При исчерпанном лимите контактов сделка создаётся без контакта.","operationId":"crmDealCreate","x-scope":"crm:write","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"stage":{"type":"string","description":"По умолчанию new"},"amount":{"type":["number","null"]},"notes":{"type":["string","null"]},"contact_id":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"},"contact":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}}}},"required":["title"]},"example":{"title":"Курс ухода","stage":"new","amount":4900,"contact":{"name":"Вика","phone":"+79001234567"}}}}},"responses":{"201":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deal"}},"required":["data"]},"example":{"data":{"id":"9ea5407a0603f126bbe547928069239c","title":"Курс ухода","stage":"new","amount":4900,"notes":null,"contact":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"},"order_id":null,"appointment_id":null,"created_at":"2026-11-13T10:10:00.000Z","updated_at":"2026-11-13T11:00:00.000Z"}}}}},"400":{"description":"Неверные поля","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Контакт не найден","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/crm/deals/{id}":{"get":{"tags":["CRM"],"summary":"Одна сделка","operationId":"crmDeal","x-scope":"crm:read","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id сделки","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deal"}},"required":["data"]},"example":{"data":{"id":"9ea5407a0603f126bbe547928069239c","title":"Курс ухода","stage":"won","amount":4900,"notes":null,"contact":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"},"order_id":null,"appointment_id":null,"created_at":"2026-11-13T10:10:00.000Z","updated_at":"2026-11-13T11:00:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"tags":["CRM"],"summary":"Изменить сделку","operationId":"crmDealUpdate","x-scope":"crm:write","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"id сделки","schema":{"type":"string","description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string"},"stage":{"type":"string"},"amount":{"type":["number","null"]},"notes":{"type":["string","null"]},"contact_id":{"type":["string","null"],"description":"Публичный id: 32 шестнадцатеричных символа","pattern":"^[0-9a-f]{32}$","example":"7cc0184d032b083e9a398a0c9076c4dc"}}},"example":{"stage":"won"}}}},"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deal"}},"required":["data"]},"example":{"data":{"id":"9ea5407a0603f126bbe547928069239c","title":"Курс ухода","stage":"won","amount":4900,"notes":null,"contact":{"id":"45e54a7f7c4b74942c83642581dc26c4","name":"Вика","phone":"+79001234567","email":"vika@example.com","telegram":"@vika","source":"api","created_at":"2026-11-13T10:00:00.000Z","updated_at":"2026-11-13T10:05:00.000Z"},"order_id":null,"appointment_id":null,"created_at":"2026-11-13T10:10:00.000Z","updated_at":"2026-11-13T11:00:00.000Z"}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдена","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stats":{"get":{"tags":["Статистика"],"summary":"Посещения и клики за период","description":"Сводные цифры без отдельных визитов. Без параметров — последние 7 дней. Боты не учитываются.","operationId":"stats","x-scope":"stats:read","security":[{"bearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"description":"today, yesterday, week, month или year","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"Начало периода (до 366 дней)","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"to","in":"query","required":false,"description":"Конец периода","schema":{"type":"string","description":"Дата YYYY-MM-DD","format":"date","example":"2026-11-20"}},{"name":"surface","in":"query","required":false,"description":"multi — мультиссылка (по умолчанию), website — сайт, all — всё","schema":{"type":"string"}}],"responses":{"200":{"description":"Успех","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Stats"}},"required":["data"]},"example":{"data":{"period":{"kind":"week","from":null,"to":null,"days":null,"granularity":"day","surface":"multi"},"totals":{"visits":1240,"unique_visitors":860,"clicks":312,"unique_clicks":240},"series":[{"t":"2026-11-12","hits":180,"unique_hits":131,"clicks":44}],"top_links":[{"url":"https://t.me/studio_anna","clicks":120}],"top_blocks":[{"block_id":"9db0cf42adc44b4e8c17bdede6b20a02","label":"Онлайн-запись","clicks":96}],"top_referrers":[{"referer":"instagram.com","cnt":410}],"top_geo":[{"country":"Россия","city":"Москва","cnt":520}],"utm":{"sources":[{"value":"vk","hits":210,"uniqueHits":160}],"mediums":[],"campaigns":[],"combos":[]}}}}}},"400":{"description":"Неверные параметры","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Тариф без API (ниже «Про») или исчерпан лимит тарифа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Превышен лимит запросов (заголовки X-RateLimit-*, Retry-After)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Статистика временно недоступна","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"form.submit":{"post":{"summary":"Заявка с формы","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"survey.submit":{"post":{"summary":"Ответ на квиз с контактами","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"survey.started":{"post":{"summary":"Начат квиз","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"survey.finished":{"post":{"summary":"Завершён квиз","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"payment.paid":{"post":{"summary":"Оплата по кнопке оплаты","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"booking.created":{"post":{"summary":"Новая запись","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"booking.rescheduled":{"post":{"summary":"Запись перенесена","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"booking.cancelled":{"post":{"summary":"Запись отменена","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"booking.completed":{"post":{"summary":"Клиент пришёл","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"booking.no_show":{"post":{"summary":"Клиент не пришёл","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"booking.scheduled":{"post":{"summary":"Запись снова активна (смена статуса в кабинете)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"booking.synced":{"post":{"summary":"Запись перенесена в CRM из кабинета","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"order.created":{"post":{"summary":"Новый заказ","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"order.paid":{"post":{"summary":"Заказ оплачен","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"order.shipped":{"post":{"summary":"Заказ отправлен","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"order.cancelled":{"post":{"summary":"Заказ отменён","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"contact.upsert":{"post":{"summary":"Контакт создан или изменён","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"deal.created":{"post":{"summary":"Сделка создана","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"deal.updated":{"post":{"summary":"Сделка изменена","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}},"test.ping":{"post":{"summary":"Проверка из кабинета","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Ответьте 2xx за 10 секунд"}}}}}}