{"openapi":"3.1.0","info":{"title":"Comvo API","version":"2.1.8","description":"С помощью Comvo API можно создавать персональные приглашения к опросам, автоматически отправлять опросы по событиям транзакций, получать ответы и метрики, синхронизировать структуру организации и принимать события через вебхуки.\n\n## Быстрый старт\n\n1. Создайте ключ в панели на экране **Ayarlar › API Anahtarları** (Настройки › API-ключи). Первые попытки выполняйте с ключом `sk_test_`: приглашения и ответы, созданные тестовым ключом, хранятся отдельно от рабочих данных и не попадают в отчеты.\n2. Проверьте ключ:\n\n```bash\ncurl https://my.comvo.com.tr/api/me \\\n  -H \"Authorization: Bearer sk_test_...\"\n```\n\n3. Получите персональную ссылку на опрос для транзакции (заказ, сервисная заявка):\n\n```bash\ncurl -X POST https://my.comvo.com.tr/api/invitations \\\n  -H \"Authorization: Bearer sk_test_...\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: siparis-98123\" \\\n  -d '{\n    \"survey\": \"srv_...\",\n    \"org_unit\": \"IST-034\",\n    \"transaction_ref\": \"98123\",\n    \"contact\": { \"external_id\": \"C-5521\", \"name\": \"Ayşe Yılmaz\", \"email\": \"ayse@example.com\" }\n  }'\n# 201 { \"id\": \"inv_...\", \"url\": \"https://my.comvo.com.tr/s/...\", ... }\n```\n\n`url` в ответе это одноразовая ссылка для отправки контакту; она возвращается только в этом ответе. Каждое поле контекста (подразделение, номер транзакции, номер клиента, контактные данные, пользовательские поля) должно быть указано в действующем уведомлении о конфиденциальности бренда; иначе запрос отклоняется с ошибкой `privacy_notice_not_covering`.\n\n## Аутентификация\n\nОтправляйте заголовок `Authorization: Bearer sk_live_...` в каждом запросе. Ключ может использовать только области доступа (scopes), выбранные при его создании; ключ, ограниченный подразделением, видит только это подразделение и нижестоящие. Тестовые ключи (`sk_test_`) не имеют доступа к рабочим данным.\n\n## Идемпотентность\n\nВ запросах на запись отправляйте заголовок `Idempotency-Key`. Тот же запрос с тем же ключом в течение 24 часов повторно не обрабатывается; возвращается первый ответ с заголовком `Idempotent-Replayed: true`. Если тот же ключ приходит с другим телом запроса, возвращается 422.\n\n## Пагинация\n\nСписки используют курсоры. Передайте значение `next_cursor` из ответа в параметре `?cursor=`; когда `has_more` равно `false`, список закончился. `limit` не более 100.\n\n## Ограничение частоты\n\nНа один ключ допускается 600 запросов в минуту, для массовых конечных точек 30 запросов. Следите за заголовками `RateLimit-Limit`, `RateLimit-Remaining` и `RateLimit-Reset`; получив ответ 429, подождите время, указанное в `Retry-After`.\n\n## Время, идентификаторы и персональные данные\n\nВремя указывается в формате ISO 8601 и в UTC. Идентификаторы имеют префиксы: `srv_` (опрос), `inv_` (приглашение), `rsp_` (ответ), `org_` (подразделение). Имя, адрес электронной почты и телефон возвращаются в ответах только с областью `responses:pii`; если контакт выбрал анонимность, они не возвращаются никогда.\n\n## Вебхуки\n\nЧтобы получать события, добавьте адрес в панели на экране **Ayarlar › Webhook'lar** (Настройки › Вебхуки) или через конечную точку `/webhook-endpoints`. Каждый запрос подписывается заголовком:\n\n```\nWebhook-Signature: t=<время>,v1=<HMAC-SHA256(секретный ключ, \"время.тело\")>\n```\n\nВ панели на вкладке **Teknik Rehber** (Техническое руководство) каждого вебхука есть код проверки на PHP, Node.js и Python и пример полезной нагрузки. Ответьте на запрос кодом 2xx в течение 10 секунд; иначе он будет отправлен повторно согласно политике ошибок вебхука.\n\n## Коды ошибок\n\nОшибки имеют формат [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) `application/problem+json`. Определяйте поведение по полю `code`; поле `detail` предназначено для людей.\n\n```json\n{ \"type\": \"https://my.comvo.com.tr/developers#errors-validation_failed\", \"title\": \"Doğrulama hatası\", \"status\": 422,\n  \"code\": \"validation_failed\", \"detail\": \"...\", \"errors\": { \"survey\": [\"Anket bulunamadı.\"] } }\n```\n\n| Код | Статус | Значение и что делать |\n| --- | --- | --- |\n| `unauthenticated` | 401 | Заголовок Authorization отсутствует или имеет неверный формат. |\n| `invalid_key` | 401 | Ключ не найден, отозван или срок его действия истек. Создайте новый ключ в панели. |\n| `insufficient_scope` | 403 | У ключа нет области доступа для этой операции (указана в поле required_scope). Создайте ключ с новой областью доступа. |\n| `outside_scope` | 403 | Ключ, ограниченный подразделением, не может получить доступ к этой записи или к операции на уровне всего клиента платформы. |\n| `forbidden` | 403 | Операция не разрешена. |\n| `not_found` | 404 | Запись не существует или находится вне зоны доступа ключа (подразделение, рабочий/тестовый режим). |\n| `method_not_allowed` | 405 | Этот адрес не поддерживает данный метод HTTP. |\n| `invitation_completed` | 409 | Приглашение, на которое уже ответили, нельзя отменить. |\n| `idempotency_in_progress` | 409 | Первый запрос с тем же Idempotency-Key еще обрабатывается; повторите попытку чуть позже. |\n| `invalid_idempotency_key` | 400 | Idempotency-Key пуст или длиннее 255 символов. |\n| `idempotency_mismatch` | 422 | Тот же Idempotency-Key использован с другим телом запроса. |\n| `validation_failed` | 422 | В отправленных данных есть ошибки; подробности по полям в errors. |\n| `survey_not_live` | 422 | Опрос не опубликован; приглашение создать нельзя. |\n| `unknown_context_field` | 422 | Поле контекста не определено в панели в разделе KVKK ve Veri > Alanlar (KVKK и данные > Поля; KVKK это закон Турции о защите персональных данных № 6698) (fields). |\n| `privacy_notice_not_covering` | 422 | Поля не указаны в действующем уведомлении о конфиденциальности бренда (fields). Добавьте их в уведомление и опубликуйте его. |\n| `invalid_assignee` | 422 | Назначаемый участник не существует или не имеет права управлять этим ответом. |\n| `invalid_level` | 422 | Название уровня не найдено, или под вышестоящим подразделением не задан уровень. |\n| `range_too_long` | 422 | Диапазон метрик не более 366 дней. |\n| `rate_limited` | 429 | Превышено ограничение частоты; подождите время, указанное в Retry-After. |\n| `server_error` | 500 | Непредвиденная ошибка. Можно безопасно повторить запрос с Idempotency-Key. |"},"servers":[{"url":"https://my.comvo.com.tr/api"}],"tags":[{"name":"Идентификация"},{"name":"Опросы"},{"name":"События"},{"name":"Приглашения"},{"name":"Контакты"},{"name":"Ответы"},{"name":"Организация"},{"name":"Метрики"},{"name":"Вебхуки"}],"paths":{"/me":{"get":{"tags":["Идентификация"],"summary":"Сведения о ключе","security":[{"bearer":[]}],"x-scope":"","description":"Для проверки интеграции: действителен ли ключ и какие у него области доступа.","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getMe"}},"/surveys":{"get":{"tags":["Опросы"],"summary":"Список опросов","security":[{"bearer":[]}],"x-scope":"surveys:read","description":"\n\nОбласть доступа: `surveys:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SurveyList"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"listSurveys","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}]}},"/surveys/{id}":{"get":{"tags":["Опросы"],"summary":"Опрос и его вопросы","security":[{"bearer":[]}],"x-scope":"surveys:read","description":"\n\nОбласть доступа: `surveys:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Survey"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getSurvey","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"srv_..."}]}},"/events":{"post":{"tags":["События"],"summary":"Отправить событие","security":[{"bearer":[]}],"x-scope":"events:write","description":"Отправляйте события транзакций (заказ доставлен, сервисная заявка закрыта, звонок завершен). Для каждого активного триггера, связанного в панели с этим типом, проверяется: опубликован ли опрос, отписался ли контакт, ограничение частоты и канал (по адресу электронной почты или телефону контакта); если условия выполнены, создается приглашение и планируется отложенное сообщение. Чтобы не отправить одно и то же событие дважды, используйте `Idempotency-Key`.\n\nОбласть доступа: `events:write`","responses":{"202":{"description":"Принято; возвращается, какой триггер, когда и по какому каналу отправит опрос или почему он был пропущен","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"400":{"$ref":"#/components/responses/E400"},"409":{"$ref":"#/components/responses/E409"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"createEvent","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventInput"}}}}}},"/events/batch":{"post":{"tags":["События"],"summary":"Пакет событий (не более 500)","security":[{"bearer":[]}],"x-scope":"events:write","description":"\n\nОбласть доступа: `events:write`","responses":{"202":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventBatchResult"}}}},"400":{"$ref":"#/components/responses/E400"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"createEventBatch","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["events"],"properties":{"events":{"type":"array","maxItems":500,"items":{"$ref":"#/components/schemas/EventInput"}}}}}}}}},"/events/{id}":{"get":{"tags":["События"],"summary":"Результат события","security":[{"bearer":[]}],"x-scope":"events:write","description":"\n\nОбласть доступа: `events:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getEvent","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"evt_..."}]}},"/contacts/{external_id}":{"get":{"tags":["Контакты"],"summary":"Контакт","security":[{"bearer":[]}],"x-scope":"contacts:write","description":"\n\nОбласть доступа: `contacts:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getContact","parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string"},"description":"Ваш номер клиента"}]},"put":{"tags":["Контакты"],"summary":"Создать или обновить контакт","security":[{"bearer":[]}],"x-scope":"contacts:write","description":"При `opted_out: true` контакт исключается из рассылки опросов (для синхронизации с вашей собственной системой управления согласиями).\n\nОбласть доступа: `contacts:write`","responses":{"200":{"description":"Обновлено","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"201":{"description":"Создано","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"putContact","parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string"},"description":"Ваш номер клиента"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactInput"}}}}},"delete":{"tags":["Контакты"],"summary":"KVKK: удалить контакт","security":[{"bearer":[]}],"x-scope":"contacts:write","description":"Запись контакта и контактные данные удаляются; его ответы отвязываются от контакта и обезличиваются (остаются в статистике), персональные поля контекста и ответы на сообщения удаляются, ожидающие сообщения отменяются. Действие необратимо.\n\nОбласть доступа: `contacts:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactErasure"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"eraseContact","parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string"},"description":"Ваш номер клиента"}]}},"/contacts/{external_id}/export":{"get":{"tags":["Контакты"],"summary":"KVKK: выгрузка данных контакта","security":[{"bearer":[]}],"x-scope":"contacts:write","description":"Для запроса на доступ к данным: контакт, приглашения, сообщения и ответы.\n\nОбласть доступа: `contacts:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactExport"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"exportContact","parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string"},"description":"Ваш номер клиента"}]}},"/invitations":{"post":{"tags":["Приглашения"],"summary":"Создать приглашение","security":[{"bearer":[]}],"x-scope":"invitations:write","description":"Персональная одноразовая ссылка. Каждое поле контекста должно быть указано в действующем уведомлении о конфиденциальности; иначе `privacy_notice_not_covering` (422).\n\nОбласть доступа: `invitations:write`","responses":{"201":{"description":"Создано; `url` это ссылка для отправки контакту","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"400":{"$ref":"#/components/responses/E400"},"409":{"$ref":"#/components/responses/E409"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"createInvitation","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationInput"}}}}}},"/invitations/batch":{"post":{"tags":["Приглашения"],"summary":"Пакет приглашений (не более 1000)","security":[{"bearer":[]}],"x-scope":"invitations:write","description":"Ошибочный элемент не останавливает остальные; результаты возвращаются в порядке элементов.\n\nОбласть доступа: `invitations:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchResult"}}}},"400":{"$ref":"#/components/responses/E400"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"createInvitationBatch","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["invitations"],"properties":{"invitations":{"type":"array","maxItems":1000,"items":{"$ref":"#/components/schemas/InvitationInput"}}}}}}}}},"/invitations/{id}":{"get":{"tags":["Приглашения"],"summary":"Статус приглашения","security":[{"bearer":[]}],"x-scope":"invitations:write","description":"\n\nОбласть доступа: `invitations:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getInvitation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"inv_..."}]}},"/invitations/{id}/cancel":{"post":{"tags":["Приглашения"],"summary":"Отменить приглашение","security":[{"bearer":[]}],"x-scope":"invitations:write","description":"\n\nОбласть доступа: `invitations:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Invitation"}}}},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"cancelInvitation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"inv_..."},{"$ref":"#/components/parameters/idempotency"}]}},"/responses":{"get":{"tags":["Ответы"],"summary":"Список ответов","security":[{"bearer":[]}],"x-scope":"responses:read","description":"Только завершенные ответы, с учетом режима ключа (рабочий/тестовый) и ограничения по подразделению. Персональные данные только с областью `responses:pii`.\n\nОбласть доступа: `responses:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseList"}}}},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"listResponses","parameters":[{"name":"survey","in":"query","required":false,"schema":{"type":"string"},"description":"Идентификатор опроса"},{"name":"org_unit","in":"query","required":false,"schema":{"type":"string"},"description":"Код или идентификатор подразделения (включая поддерево)"},{"name":"touchpoint","in":"query","required":false,"schema":{"type":"string"},"description":"Ключ точки контакта"},{"name":"transaction_ref","in":"query","required":false,"schema":{"type":"string"},"description":"Номер транзакции (заказ, чек)"},{"name":"case_status","in":"query","required":false,"schema":{"enum":["new","in_progress","resolved"]},"description":"Статус обращения"},{"name":"priority","in":"query","required":false,"schema":{"enum":["normal","high","critical"]},"description":"Приоритет"},{"name":"completed_since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Завершенные после этого времени"},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Измененные после этого времени (для синхронизации)"},{"name":"order","in":"query","required":false,"schema":{"enum":["asc","desc"]},"description":"Порядок (по умолчанию desc)"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}]}},"/responses/{id}":{"get":{"tags":["Ответы"],"summary":"Ответ","security":[{"bearer":[]}],"x-scope":"responses:read","description":"\n\nОбласть доступа: `responses:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getResponse","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"rsp_..."}]},"patch":{"tags":["Ответы"],"summary":"Изменить статус обращения, приоритет или ответственного","security":[{"bearer":[]}],"x-scope":"responses:write","description":"Изменение записывается в историю обращения как \"API: имя ключа\", а подписанным вебхукам отправляется событие case.*.\n\nОбласть доступа: `responses:write`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"404":{"$ref":"#/components/responses/E404"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"updateResponse","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"rsp_..."},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseUpdate"}}}}}},"/responses/{id}/notes":{"post":{"tags":["Ответы"],"summary":"Добавить заметку к обращению","security":[{"bearer":[]}],"x-scope":"responses:write","description":"\n\nОбласть доступа: `responses:write`","responses":{"201":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Note"}}}},"404":{"$ref":"#/components/responses/E404"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"createNote","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"rsp_..."},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["body"],"properties":{"body":{"type":"string","maxLength":5000}}}}}}}},"/org-units":{"get":{"tags":["Организация"],"summary":"Список подразделений","security":[{"bearer":[]}],"x-scope":"org:read","description":"\n\nОбласть доступа: `org:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgUnitList"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"listOrgUnits","parameters":[{"name":"updated_since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Измененные после этого времени"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}]}},"/org-units/{code}":{"get":{"tags":["Организация"],"summary":"Подразделение","security":[{"bearer":[]}],"x-scope":"org:read","description":"\n\nОбласть доступа: `org:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgUnit"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getOrgUnit","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"description":"Код или идентификатор подразделения"}]},"put":{"tags":["Организация"],"summary":"Создать или обновить подразделение по коду","security":[{"bearer":[]}],"x-scope":"org:write","description":"\n\nОбласть доступа: `org:write`","responses":{"200":{"description":"Обновлено","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgUnit"}}}},"201":{"description":"Создано","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgUnit"}}}},"404":{"$ref":"#/components/responses/E404"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"putOrgUnit","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"description":"Код подразделения во внешней системе (буквы, цифры, . _ -)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgUnitInput"}}}}}},"/people/{code}":{"put":{"tags":["Организация"],"summary":"Создать или обновить сотрудника по коду","security":[{"bearer":[]}],"x-scope":"org:write","description":"\n\nОбласть доступа: `org:write`","responses":{"200":{"description":"Обновлено","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Person"}}}},"201":{"description":"Создано","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Person"}}}},"404":{"$ref":"#/components/responses/E404"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"putPerson","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"description":"Код сотрудника"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"org_unit":{"type":"string"},"email":{"type":"string","format":"email"},"is_active":{"type":"boolean"}}}}}}}},"/touchpoints":{"get":{"tags":["Организация"],"summary":"Список точек контакта","security":[{"bearer":[]}],"x-scope":"org:read","description":"\n\nОбласть доступа: `org:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TouchpointList"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"listTouchpoints","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}]}},"/touchpoints/{key}":{"put":{"tags":["Организация"],"summary":"Создать или обновить точку контакта по ключу","security":[{"bearer":[]}],"x-scope":"org:write","description":"\n\nОбласть доступа: `org:write`","responses":{"200":{"description":"Обновлено","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Touchpoint"}}}},"201":{"description":"Создано","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Touchpoint"}}}},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"putTouchpoint","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Ключ (строчные буквы, цифры, _)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"is_active":{"type":"boolean"}}}}}}}},"/metrics":{"get":{"tags":["Метрики"],"summary":"CSAT, NPS, CES и разбивка","security":[{"bearer":[]}],"x-scope":"reports:read","description":"Тот же расчет, что и в отчетах панели: рабочие, завершенные, неподозрительные ответы; дни по часовому поясу клиента платформы.\n\nОбласть доступа: `reports:read`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Metrics"}}}},"404":{"$ref":"#/components/responses/E404"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getMetrics","parameters":[{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date"}},{"name":"group_by","in":"query","required":false,"schema":{"enum":["org_unit","touchpoint","person","channel","survey","day"]},"description":"Разбивка"},{"name":"level","in":"query","required":false,"schema":{"type":"string"},"description":"Название уровня для group_by=org_unit (например, Регион)"},{"name":"survey","in":"query","required":false,"schema":{"type":"string"},"description":"Идентификатор опроса"},{"name":"org_unit","in":"query","required":false,"schema":{"type":"string"},"description":"Код подразделения (поддерево)"},{"name":"touchpoint","in":"query","required":false,"schema":{"type":"string"},"description":"Идентификатор точки контакта"},{"name":"channel","in":"query","required":false,"schema":{"type":"string"},"description":"qr, email, sms, link"}]}},"/webhook-endpoints":{"get":{"tags":["Вебхуки"],"summary":"Список вебхуков","security":[{"bearer":[]}],"x-scope":"webhooks:manage","description":"\n\nОбласть доступа: `webhooks:manage`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointList"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"listWebhookEndpoints","parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}]},"post":{"tags":["Вебхуки"],"summary":"Создать вебхук","security":[{"bearer":[]}],"x-scope":"webhooks:manage","description":"\n\nОбласть доступа: `webhooks:manage`","responses":{"201":{"description":"Создано; `secret` только в этом ответе","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"createWebhookEndpoint","parameters":[{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointInput"}}}}}},"/webhook-endpoints/{id}":{"get":{"tags":["Вебхуки"],"summary":"Вебхук","security":[{"bearer":[]}],"x-scope":"webhooks:manage","description":"\n\nОбласть доступа: `webhooks:manage`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"getWebhookEndpoint","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"whk_..."}]},"patch":{"tags":["Вебхуки"],"summary":"Обновить вебхук","security":[{"bearer":[]}],"x-scope":"webhooks:manage","description":"\n\nОбласть доступа: `webhooks:manage`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"404":{"$ref":"#/components/responses/E404"},"422":{"$ref":"#/components/responses/E422"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"updateWebhookEndpoint","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"whk_..."},{"$ref":"#/components/parameters/idempotency"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointInput"}}}}},"delete":{"tags":["Вебхуки"],"summary":"Удалить вебхук","security":[{"bearer":[]}],"x-scope":"webhooks:manage","description":"\n\nОбласть доступа: `webhooks:manage`","responses":{"204":{"description":"Удалено"},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"deleteWebhookEndpoint","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"whk_..."}]}},"/webhook-deliveries":{"get":{"tags":["Вебхуки"],"summary":"Журнал доставки","security":[{"bearer":[]}],"x-scope":"webhooks:manage","description":"\n\nОбласть доступа: `webhooks:manage`","responses":{"200":{"description":"Успешно","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveryList"}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"listWebhookDeliveries","parameters":[{"name":"endpoint","in":"query","required":false,"schema":{"type":"string"},"description":"whk_..."},{"name":"status","in":"query","required":false,"schema":{"enum":["pending","sending","retrying","succeeded","failed"]},"description":"Статус"},{"name":"event","in":"query","required":false,"schema":{"type":"string"},"description":"Событие"},{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"}]}},"/webhook-deliveries/{id}/redeliver":{"post":{"tags":["Вебхуки"],"summary":"Отправить повторно","security":[{"bearer":[]}],"x-scope":"webhooks:manage","description":"\n\nОбласть доступа: `webhooks:manage`","responses":{"202":{"description":"Поставлено в очередь","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"404":{"$ref":"#/components/responses/E404"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"operationId":"redeliverWebhook","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"whd_..."},{"$ref":"#/components/parameters/idempotency"}]}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"sk_live_... / sk_test_..."}},"parameters":{"limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},"cursor":{"name":"cursor","in":"query","schema":{"type":"string"},"description":"Значение next_cursor предыдущей страницы"},"idempotency":{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Предотвращает повторную обработку того же запроса (24 часа)"}},"responses":{"E400":{"description":"Недопустимый запрос","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"E401":{"description":"Не удалось выполнить аутентификацию","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"E403":{"description":"Недостаточная область доступа или вне зоны доступа","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"E404":{"description":"Не найдено (или вне зоны доступа ключа)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"E409":{"description":"Конфликт","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"E422":{"description":"Ошибка проверки или бизнес-правила","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},"E429":{"description":"Превышено ограничение частоты","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}},"schemas":{"Problem":{"type":"object","required":["type","title","status","code"],"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"code":{"type":"string","description":"Машиночитаемый код ошибки"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"fields":{"type":"array","items":{"type":"string"}},"required_scope":{"type":"string"}}},"Me":{"type":"object","required":["object","id","name","tenant","scopes","org_unit","livemode","expires_at"],"additionalProperties":false,"properties":{"object":{"const":"api_key"},"id":{"type":"string","pattern":"^key_[0-9a-z]{26}$","examples":["key_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"},"tenant":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","pattern":"^ten_[0-9a-z]{26}$","examples":["ten_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"}}},"scopes":{"type":"array","items":{"enum":["surveys:read","invitations:write","events:write","contacts:write","responses:read","responses:pii","responses:write","org:read","org:write","reports:read","webhooks:manage"]}},"org_unit":{"type":["string","null"]},"livemode":{"type":"boolean"},"expires_at":{"type":["string","null"],"format":"date-time"}}},"Survey":{"type":"object","required":["object","id","name","status","live","version","locales","touchpoint","created_at","updated_at"],"additionalProperties":false,"properties":{"object":{"const":"survey"},"id":{"type":"string","pattern":"^srv_[0-9a-z]{26}$","examples":["srv_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"},"status":{"enum":["draft","active","paused","archived"]},"live":{"type":"boolean"},"version":{"type":["integer","null"]},"locales":{"type":"array","items":{"type":"string"}},"touchpoint":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"questions":{"type":"array","items":{"type":"object","required":["key","type","title","metric","required","options"],"properties":{"key":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"metric":{"type":["string","null"]},"required":{"type":"boolean"},"options":{"type":"array","items":{"type":"object","required":["key","label"],"properties":{"key":{"type":"string"},"label":{"type":"string"}}}}}}}}},"InvitationInput":{"type":"object","required":["survey"],"additionalProperties":false,"properties":{"survey":{"type":"string","description":"Идентификатор опроса (srv_...)"},"org_unit":{"type":"string","description":"Код подразделения (например, IST-034) или идентификатор"},"person":{"type":"string","description":"Код сотрудника"},"touchpoint":{"type":"string","description":"Ключ точки контакта; если не указан, используется ключ опроса"},"transaction_ref":{"type":"string","maxLength":128,"description":"Номер заказа, чека или сервисной заявки"},"contact":{"type":"object","additionalProperties":false,"properties":{"external_id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"locale":{"enum":["tr","en","ar","ru","de"]}}},"context":{"type":"object","description":"Поля контекста, заданные в панели; должны быть указаны в уведомлении о конфиденциальности","additionalProperties":{"type":["string","number","boolean"]}},"max_uses":{"type":"integer","minimum":1,"maximum":100,"default":1},"expires_at":{"type":"string","format":"date-time","description":"По умолчанию 30 дней"}}},"Invitation":{"type":"object","required":["object","id","survey","status","url","channel","org_unit","person","touchpoint","contact","transaction_ref","context","max_uses","uses","expires_at","livemode","created_at"],"additionalProperties":false,"properties":{"object":{"const":"invitation"},"id":{"type":"string","pattern":"^inv_[0-9a-z]{26}$","examples":["inv_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"survey":{"type":"string","pattern":"^srv_[0-9a-z]{26}$","examples":["srv_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"status":{"enum":["pending","sent","started","responded","cancelled","expired"]},"url":{"type":["string","null"],"format":"uri","description":"Персональная ссылка. Заполняется только в ответе на создание; система не хранит токен."},"channel":{"type":"string"},"org_unit":{"type":["string","null"]},"person":{"type":["string","null"]},"touchpoint":{"type":["string","null"]},"contact":{"type":["object","null"],"required":["id","external_id"],"properties":{"id":{"type":"string","pattern":"^con_[0-9a-z]{26}$","examples":["con_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"external_id":{"type":["string","null"]}}},"transaction_ref":{"type":["string","null"]},"context":{"type":"object"},"max_uses":{"type":"integer"},"uses":{"type":"integer"},"expires_at":{"type":["string","null"],"format":"date-time"},"livemode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}}},"BatchResult":{"type":"object","required":["object","created","failed","results"],"properties":{"object":{"const":"batch_result"},"created":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"type":"object","required":["index","ok"],"properties":{"index":{"type":"integer"},"ok":{"type":"boolean"},"invitation":{"$ref":"#/components/schemas/Invitation"},"error":{"type":"object","required":["code"],"properties":{"code":{"type":"string"}}}}}}}},"Response":{"type":"object","required":["object","id","survey","unit","touchpoint","person","channel","locale","completed_at","transaction_ref","scores","case","anonymous","contact","answers","panel_url"],"additionalProperties":false,"properties":{"object":{"const":"response"},"id":{"type":"string","pattern":"^rsp_[0-9a-z]{26}$","examples":["rsp_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"survey":{"type":"object","required":["id","name","version"],"properties":{"id":{"type":"string","pattern":"^srv_[0-9a-z]{26}$","examples":["srv_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"},"version":{"type":"integer"}}},"unit":{"type":["object","null"],"required":["id","name","code","level"],"additionalProperties":false,"properties":{"id":{"type":"string","pattern":"^org_[0-9a-z]{26}$","examples":["org_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"},"code":{"type":["string","null"]},"level":{"type":["string","null"]}}},"touchpoint":{"type":["object","null"],"required":["id","name"],"additionalProperties":false,"properties":{"id":{"type":"string","pattern":"^tch_[0-9a-z]{26}$","examples":["tch_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"}}},"person":{"type":["object","null"],"required":["id","name"],"additionalProperties":false,"properties":{"id":{"type":"string","pattern":"^per_[0-9a-z]{26}$","examples":["per_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"}}},"channel":{"type":"string"},"locale":{"type":"string"},"completed_at":{"type":["string","null"],"format":"date-time"},"transaction_ref":{"type":["string","null"]},"scores":{"type":"object","required":["csat","ces","nps"],"properties":{"csat":{"type":["number","null"]},"ces":{"type":["number","null"]},"nps":{"type":["integer","null"]}}},"case":{"type":"object","required":["status","priority","flagged","assignee","due_at"],"properties":{"status":{"enum":["new","in_progress","resolved"]},"priority":{"enum":["normal","high","critical"]},"flagged":{"type":"boolean"},"assignee":{"type":["object","null"],"required":["id","name"],"additionalProperties":false,"properties":{"id":{"type":"string","pattern":"^mem_[0-9a-z]{26}$","examples":["mem_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"}}},"due_at":{"type":["string","null"],"format":"date-time"},"resolution_code":{"type":["string","null"],"description":"Код закрытия, выбранный при решении (в панели: Vaka Ayarları (Настройки обращений))"},"follow_up_result":{"enum":["resolved","partly","not_resolved",null],"description":"Ответ клиента в опросе об удовлетворенности решением"}}},"anonymous":{"type":"boolean"},"contact":{"type":["object","null"],"description":"Только с областью `responses:pii` и если контакт не анонимен","properties":{"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"external_id":{"type":["string","null"]}}},"answers":{"type":"array","items":{"type":"object","required":["key","type","title","metric","value","label"],"additionalProperties":false,"properties":{"key":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"metric":{"type":["string","null"]},"value":{"description":"Число, ключ варианта, массив ключей или текст"},"label":{"description":"Подпись варианта (может быть массивом) или null"}}}},"panel_url":{"type":"string","format":"uri"}}},"ResponseUpdate":{"type":"object","additionalProperties":false,"properties":{"case_status":{"enum":["new","in_progress","resolved"]},"priority":{"enum":["normal","high","critical"]},"assignee":{"type":["string","null"],"description":"Идентификатор участника (mem_...); null = снять назначение"},"resolution_code":{"type":["string","null"],"description":"Ключ кода закрытия, вместе с case_status=resolved"}}},"Note":{"type":"object","required":["object","id","response","body","created_at"],"properties":{"object":{"const":"note"},"id":{"type":"string","pattern":"^act_[0-9a-z]{26}$","examples":["act_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"response":{"type":"string","pattern":"^rsp_[0-9a-z]{26}$","examples":["rsp_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"body":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}},"OrgUnit":{"type":"object","required":["object","id","code","name","level","depth","parent","city","address","is_active","updated_at"],"additionalProperties":false,"properties":{"object":{"const":"org_unit"},"id":{"type":"string","pattern":"^org_[0-9a-z]{26}$","examples":["org_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"code":{"type":["string","null"]},"name":{"type":"string"},"level":{"type":["string","null"]},"depth":{"type":["integer","null"]},"parent":{"type":["string","null"]},"city":{"type":["string","null"]},"address":{"type":["string","null"]},"is_active":{"type":"boolean"},"updated_at":{"type":"string","format":"date-time"}}},"OrgUnitInput":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string"},"parent":{"type":["string","null"],"description":"Код вышестоящего подразделения; если он меняется, подразделение перемещается"},"level":{"type":"string","description":"Название уровня; если не указано, уровень на один ниже вышестоящего"},"city":{"type":"string"},"address":{"type":"string"},"review_url":{"type":"string","format":"uri"},"is_active":{"type":"boolean"}}},"Person":{"type":"object","required":["object","id","code","name","org_unit","is_active"],"additionalProperties":false,"properties":{"object":{"const":"person"},"id":{"type":"string","pattern":"^per_[0-9a-z]{26}$","examples":["per_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"code":{"type":["string","null"]},"name":{"type":"string"},"org_unit":{"type":["string","null"]},"is_active":{"type":"boolean"}}},"Touchpoint":{"type":"object","required":["object","id","key","name","description","is_active"],"additionalProperties":false,"properties":{"object":{"const":"touchpoint"},"id":{"type":"string","pattern":"^tch_[0-9a-z]{26}$","examples":["tch_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"is_active":{"type":"boolean"}}},"MetricSet":{"type":"object","required":["count","csat","satisfied","ces","nps","promoters","detractors","nps_count","critical"],"properties":{"count":{"type":"integer"},"csat":{"type":["number","null"]},"satisfied":{"type":["number","null"],"description":"Доля CSAT >= 4 в процентах"},"ces":{"type":["number","null"]},"nps":{"type":["integer","null"]},"promoters":{"type":["number","null"]},"detractors":{"type":["number","null"]},"nps_count":{"type":"integer"},"critical":{"type":"integer"},"review_offered":{"type":"integer","description":"Показано приглашение оставить отзыв в Google"},"review_clicked":{"type":"integer","description":"Перешли по приглашению"}}},"Metrics":{"type":"object","required":["object","range","summary","previous"],"properties":{"object":{"const":"metrics"},"range":{"type":"object","required":["from","to"],"properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}}},"summary":{"$ref":"#/components/schemas/MetricSet"},"previous":{"$ref":"#/components/schemas/MetricSet","description":"Предыдущий период той же длины"},"groups":{"type":"array","items":{"type":"object","required":["key","name","count","csat"],"properties":{"key":{"type":"string"},"name":{"type":"string"},"count":{"type":"integer"},"csat":{"type":["number","null"]},"satisfied":{"type":["number","null"]},"nps":{"type":["integer","null"]},"critical":{"type":"integer"},"delta":{"type":["number","null"]}}}}}},"WebhookEndpoint":{"type":"object","required":["object","id","name","url","events","filters","include_pii","header_names","is_active","retry_every_minutes","give_up_after_minutes","notify_on_failure","notify_emails","disable_after_failures","disabled_reason","created_at"],"properties":{"object":{"const":"webhook_endpoint"},"id":{"type":"string","pattern":"^whk_[0-9a-z]{26}$","examples":["whk_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"name":{"type":"string"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"enum":["response.completed","response.flagged","case.assigned","case.status_changed","case.resolved","case.escalated"]}},"filters":{"type":"object","properties":{"surveys":{"type":"array","items":{"type":"string"}},"unit":{"type":"string"},"min_priority":{"enum":["high","critical"]}}},"include_pii":{"type":"boolean"},"header_names":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"retry_every_minutes":{"type":"integer"},"give_up_after_minutes":{"type":"integer","description":"0 = без повторов"},"notify_on_failure":{"type":"boolean"},"notify_emails":{"type":"array","items":{"type":"string"}},"disable_after_failures":{"type":["integer","null"]},"disabled_reason":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"Только в ответе на создание"}}},"WebhookEndpointInput":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string"},"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"enum":["response.completed","response.flagged","case.assigned","case.status_changed","case.resolved","case.escalated"]}},"filters":{"type":"object"},"include_pii":{"type":"boolean"},"headers":{"type":"array","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"value":{"type":["string","null"]}}}},"retry_every_minutes":{"type":"integer","minimum":1,"maximum":1440,"default":5},"give_up_after_minutes":{"type":"integer","minimum":0,"maximum":10080,"default":1440},"notify_on_failure":{"type":"boolean"},"notify_emails":{"type":"array","items":{"type":"string","format":"email"}},"disable_after_failures":{"type":["integer","null"]},"is_active":{"type":"boolean"}}},"WebhookDelivery":{"type":"object","required":["object","id","endpoint","event","event_id","status","attempts","last_status_code","last_error","next_attempt_at","created_at"],"additionalProperties":false,"properties":{"object":{"const":"webhook_delivery"},"id":{"type":"string","pattern":"^whd_[0-9a-z]{26}$","examples":["whd_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"endpoint":{"type":"string","pattern":"^whk_[0-9a-z]{26}$","examples":["whk_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"event":{"type":"string"},"event_id":{"type":"string"},"status":{"enum":["pending","sending","retrying","succeeded","failed"]},"attempts":{"type":"integer"},"last_status_code":{"type":["integer","null"]},"last_error":{"type":["string","null"]},"next_attempt_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}}},"EventInput":{"type":"object","required":["type"],"additionalProperties":false,"properties":{"type":{"type":"string","pattern":"^[a-z0-9][a-z0-9_.]{0,63}$","description":"Тип события; запускаются триггеры, связанные в панели с этим типом (например, order_delivered)"},"occurred_at":{"type":"string","format":"date-time","description":"Время события; к нему прибавляется задержка. Если не указано, текущее время."},"contact":{"type":"object","additionalProperties":false,"properties":{"external_id":{"type":"string","description":"Ваш номер клиента (рекомендуется)"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string","description":"+90 5xx... или 05xx..."},"locale":{"enum":["tr","en","ar","ru","de"]}}},"org_unit":{"type":"string"},"person":{"type":"string"},"touchpoint":{"type":"string"},"transaction_ref":{"type":"string","maxLength":128},"context":{"type":"object","additionalProperties":{"type":["string","number","boolean"]}}}},"Event":{"type":"object","required":["object","id","type","occurred_at","matched_triggers","scheduled","skipped","livemode","created_at"],"additionalProperties":false,"properties":{"object":{"const":"event"},"id":{"type":"string","pattern":"^evt_[0-9a-z]{26}$","examples":["evt_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"type":{"type":"string"},"occurred_at":{"type":"string","format":"date-time"},"matched_triggers":{"type":"integer"},"scheduled":{"type":"array","items":{"type":"object","required":["trigger","survey","invitation","message","channel","send_at"],"properties":{"trigger":{"type":"string","pattern":"^trg_[0-9a-z]{26}$","examples":["trg_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"survey":{"type":"string","pattern":"^srv_[0-9a-z]{26}$","examples":["srv_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"invitation":{"type":"string","pattern":"^inv_[0-9a-z]{26}$","examples":["inv_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"message":{"type":"string","pattern":"^msg_[0-9a-z]{26}$","examples":["msg_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"channel":{"enum":["email","sms"]},"send_at":{"type":"string","format":"date-time"}}}},"skipped":{"type":"array","items":{"type":"object","required":["trigger","reason","detail"],"properties":{"trigger":{"type":"string","pattern":"^trg_[0-9a-z]{26}$","examples":["trg_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"detail":{"type":"string"},"reason":{"type":"string","description":"survey_not_live, opted_out, frequency_trigger, frequency_global, no_recipient, privacy_notice_not_covering, unknown_context_field, validation_failed"}}}},"livemode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"}}},"EventBatchResult":{"type":"object","required":["object","created","failed","results"],"properties":{"object":{"const":"batch_result"},"created":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"type":"object","required":["index","ok"],"properties":{"index":{"type":"integer"},"ok":{"type":"boolean"},"event":{"$ref":"#/components/schemas/Event"},"error":{"type":"object"}}}}}},"Contact":{"type":"object","required":["object","id","external_id","name","email","phone","locale","opted_out","created_at"],"additionalProperties":false,"properties":{"object":{"const":"contact"},"id":{"type":"string","pattern":"^con_[0-9a-z]{26}$","examples":["con_01k7x9q2m5c8v3n4b6z1t0r2w8"]},"external_id":{"type":["string","null"]},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"locale":{"type":["string","null"]},"opted_out":{"type":"boolean","description":"Не хочет получать сообщения с опросами"},"created_at":{"type":"string","format":"date-time"}}},"ContactInput":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"locale":{"enum":["tr","en","ar","ru","de"]},"opted_out":{"type":"boolean","description":"true: этому контакту не отправляются сообщения с опросами"}}},"ContactExport":{"type":"object","required":["object","contact","invitations","messages","responses","exported_at"],"properties":{"object":{"const":"contact_export"},"contact":{"$ref":"#/components/schemas/Contact"},"invitations":{"type":"array"},"messages":{"type":"array"},"responses":{"type":"array","items":{"type":"object"}},"exported_at":{"type":"string","format":"date-time"}}},"ContactErasure":{"type":"object","required":["object","erased","responses_anonymized"],"properties":{"object":{"const":"contact_erasure"},"erased":{"const":true},"responses_anonymized":{"type":"integer"}}},"SurveyList":{"type":"object","required":["object","data","has_more","next_cursor"],"additionalProperties":false,"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Survey"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"InvitationList":{"type":"object","required":["object","data","has_more","next_cursor"],"additionalProperties":false,"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Invitation"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"ResponseList":{"type":"object","required":["object","data","has_more","next_cursor"],"additionalProperties":false,"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Response"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"OrgUnitList":{"type":"object","required":["object","data","has_more","next_cursor"],"additionalProperties":false,"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/OrgUnit"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"TouchpointList":{"type":"object","required":["object","data","has_more","next_cursor"],"additionalProperties":false,"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Touchpoint"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"WebhookEndpointList":{"type":"object","required":["object","data","has_more","next_cursor"],"additionalProperties":false,"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEndpoint"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}},"WebhookDeliveryList":{"type":"object","required":["object","data","has_more","next_cursor"],"additionalProperties":false,"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}}}}}}