{"openapi":"3.1.0","info":{"title":"Alta API","version":"v1","description":"Через API ваши программы — сайт, 1С, телефония, собственный скрипт — работают с данными Alta: сделками, контактами, компаниями, задачами, оплатами и их историей.\n\n## Как начать\n\n1. **Создайте ключ.** Владелец или администратор открывает в Alta «Настройки → Ключи API» → «Создать ключ», называет его (например, «Сайт») и выбирает доступ. Весь ключ показывается один раз — сразу скопируйте его.\n2. **Отправьте первый запрос** — например, список воронок. `your-company` — имя вашей организации в адресе Alta:\n\n   ```bash\n   curl -H \"Authorization: Bearer alta_…\" \\\n     https://your-company.altahub.ai/api/v1/pipelines\n   ```\n\n3. **Получите ответ** — JSON с воронками и их этапами:\n\n   ```json\n   {\n     \"items\": [\n       {\n         \"id\": \"0192f3a1-…\",\n         \"name\": \"Продажи\",\n         \"stages\": [ … ]\n       }\n     ]\n   }\n   ```\n\nДальше — любая операция из разделов выше: у каждой есть пример запроса и ответа.\n\n## Адрес\n\nВсе запросы идут на `https://{организация}.altahub.ai/api/v1`; адреса операций указаны от него: `GET /deals` — это `GET https://{организация}.altahub.ai/api/v1/deals`. Тело запроса и ответа — JSON.\n\n## Ключ и доступ\n\n- Ключ передаётся в каждом запросе, в заголовке `Authorization: Bearer alta_…`.\n- **«Только чтение»** — только чтение (запросы `GET`). **«Чтение и запись»** — ещё создание и изменения.\n- Ключ действует от имени того, кто его создал, и с его правами; в истории записей изменения, сделанные ключом, — от имени этого человека. Если он больше не владелец или администратор либо его доступ выключен, ключ перестаёт действовать.\n- «Отозвать» в списке ключей выключает ключ сразу.\n- До 420 запросов в минуту на ключ.\n- Храните ключ как пароль: только на своём сервере, не в коде сайта или приложения. Для каждой программы — свой ключ.\n\n## Списки страницами\n\nСписок приходит страницами: `{ \"items\": [ … ], \"nextCursor\": \"…\" }`. Следующая страница — тот же запрос с `cursor`, равным `nextCursor`; `nextCursor: null` — последняя страница. `limit` — сколько записей на странице.\n\n## Данные\n\n- Деньги — строкой: `\"12000.00\"`; валюта — код: `\"UAH\"`, `\"EUR\"`.\n- Дата и время — в UTC: `2026-10-26T09:30:00Z`; дата без времени — `2026-10-26`.\n- Неизвестное поле в запросе — ошибка, а не пропуск.\n\n## Изменения и повторы\n\n- **Изменение записи** (`PATCH`) передаёт только меняющиеся поля и применяется к записи такой, какая она сейчас: читать её перед изменением не нужно. `version` необязателен и защищает от чужих изменений: передайте полученный последним, когда изменение зависит от прочитанного (например, сумму вы посчитали из текущей) — если запись успели изменить, ответ будет `409 CONFLICT`: прочитайте запись заново и повторите.\n- **Повтор без дубля.** Создание и выполнение задачи, оплата и возврат принимают `idempotencyKey` — новый UUID на каждое действие. Повтор с тем же ключом ничего не создаст второй раз.\n- **Создание сделки, контакта и компании** повторять вслепую нельзя: если ответ не пришёл, сначала поищите запись (например, контакт — `GET /contacts?phone=…`).\n\n## Ошибки\n\nОшибка приходит с кодом HTTP и телом:\n\n```json\n{\n  \"error\": {\n    \"code\": \"NOT_FOUND\",\n    \"detail\": \"The deal does not exist.\",\n    \"requestId\": \"req_3f2a…\",\n    \"retryable\": false\n  }\n}\n```\n\nВетвитесь по `error.code`. `detail` — пояснение на английском для разработчика; `requestId` назовите поддержке; `retryable: true` — тот же запрос можно повторить через паузу. Самые частые:\n\n- `VALIDATION_FAILED` · 400 — запрос не подходит; какие поля — в `error.fields`\n- `API_KEY_INVALID` · 401 — ключ неверный, или его автор больше не владелец или администратор: проверьте ключ или создайте новый\n- `API_KEY_REVOKED` · 401 — ключ отозван: создайте новый\n- `API_KEY_READ_ONLY` · 403 — ключ «Только чтение», а запрос что-то меняет\n- `NOT_FOUND` · 404 — записи нет (запись другой организации тоже «нет»)\n- `CONFLICT` · 409 — с `version`: запись изменили после того, как вы её прочитали; прочитайте заново\n- `VALUE_TAKEN` · 409 — значение уникального поля уже у другой сделки: ничего не сохранено. Сделка уже есть, вот её id — пишите в неё:\n\n```json\n{\n  \"error\": {\n    \"code\": \"VALUE_TAKEN\",\n    \"detail\": \"unique_value_taken: another deal holds this value of a unique field; nothing was saved.\",\n    \"requestId\": \"req_7c1e…\",\n    \"retryable\": false,\n    \"fields\": [],\n    \"taken\": { \"fieldId\": \"019a…\", \"deal\": { \"id\": \"019b…\", \"number\": 49923 } }\n  }\n}\n```\n\n  `taken.deal` есть, когда автор ключа видит ту сделку; иначе ответ говорит только, что значение занято.\n- `RATE_LIMITED` · 429 — больше 420 запросов в минуту: повторите через `Retry-After` секунд\n\n\n<details><summary>Все коды ошибок</summary>\n\n- `AMBIGUOUS_CREDENTIALS` · 400 — в запросе вместе с ключом есть cookie входа в браузере: отправляйте только ключ\n- `MALFORMED_REQUEST` · 400 — тело запроса — не JSON или сломано\n- `VALIDATION_FAILED` · 400 — запрос не подходит: неизвестное, пропущенное или неверное поле (список — в `error.fields`)\n- `API_KEY_INVALID` · 401 — ключ неверный или не того вида; либо его автор больше не владелец или администратор или его доступ выключен\n- `API_KEY_REVOKED` · 401 — ключ отозван\n- `UNAUTHENTICATED` · 401 — в запросе нет ни ключа, ни входа\n- `API_KEY_READ_ONLY` · 403 — ключ «Только чтение», а запрос что-то меняет\n- `API_KEY_WRONG_ADDRESS` · 403 — запрос отправлен на адрес другой организации\n- `FORBIDDEN` · 403 — у того, кто создал ключ, нет на это прав\n- `OPERATION_NOT_PUBLIC` · 403 — операции нет в этой документации: ключ открывает только её операции\n- `ORGANIZATION_SUSPENDED` · 403 — доступ к организации приостановлен\n- `NOT_FOUND` · 404 — записи нет, она удалена навсегда или принадлежит другой организации\n- `CONFLICT` · 409 — запись изменили после того, как вы её прочитали (`version`); тот же `idempotencyKey` отправлен с другим запросом; или действие нельзя выполнить в нынешнем состоянии записи — причина в `detail`\n- `NAME_TAKEN` · 409 — такое название уже есть\n- `VALUE_TAKEN` · 409 — значение поля с отметкой «Уникальное значение» уже у другой сделки: ничего не сохранено; `error.taken` называет поле и, если вы её видите, ту сделку (`id`, `number`) — пишите в неё\n- `PAYLOAD_TOO_LARGE` · 413 — тело запроса больше 1 МБ\n- `UNSUPPORTED_MEDIA_TYPE` · 415 — тело отправлено не как `application/json`\n- `RATE_LIMITED` · 429 — больше 420 запросов в минуту на ключ: повторите через `Retry-After` секунд\n- `INTERNAL` · 500 — сбой на нашей стороне: назовите поддержке `requestId`\n- `SERVICE_UNAVAILABLE` · 503 — Alta временно недоступна: повторите запрос через паузу\n\n</details>\n"},"servers":[{"url":"https://{organization}.altahub.ai/api/v1","description":"Адрес вашей организации в Alta","variables":{"organization":{"default":"your-company","description":"Имя вашей организации в адресе Alta"}}}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Сделки","description":"Сделки в воронках: список, карточка, создание и изменение, переход по этапам, контакты сделки."},{"name":"Контакты","description":"Люди, с которыми работает организация: клиенты и их представители."},{"name":"Компании","description":"Организации клиентов; к компании привязываются контакты и сделки."},{"name":"Задачи","description":"Задачи менеджеров по сделкам и контактам и типы задач организации."},{"name":"Воронки","description":"Воронки продаж и их этапы в порядке доски."},{"name":"Товары","description":"Что продаёт организация: товары и услуги, их группы и цены. У товара может быть несколько цен, одну из них можно сделать основной."},{"name":"Оплаты","description":"Оплаты сделок, возвраты и способы оплаты организации."},{"name":"История","description":"Что и когда произошло с записью и кто это сделал: история сделки, история контакта и журнал событий всей организации. Изменения компаний и задач — в журнале."},{"name":"Маркетинг","description":"Откуда приходят люди и сколько это стоит: касания и расходы, которые передаёт ваш сайт или ваша система."},{"name":"Справочники","description":"То, на что ссылаются записи: собственные поля организации, теги, сотрудники и команды."}],"paths":{"/deals":{"get":{"operationId":"listDeals","security":[{"bearerAuth":[]}],"summary":"Список сделок","parameters":[{"in":"query","name":"amountMax","required":false,"schema":{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"}},{"in":"query","name":"amountMin","required":false,"schema":{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"}},{"in":"query","name":"cf","required":false,"schema":{"items":{"maxLength":2100,"minLength":1,"type":"string"},"maxItems":20,"type":"array"}},{"in":"query","name":"closedFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"closedTo","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"companyId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"contactId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"createdFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"createdTo","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"currency","required":false,"schema":{"pattern":"^[A-Z]{3}$","type":"string"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"customFieldIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"excludeStageIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"expectedCloseFrom","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"expectedCloseTo","required":false,"schema":{"format":"date","type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":500,"maximum":500,"minimum":1,"type":"integer"}},{"in":"query","name":"noExpectedClose","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"noOwner","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"ownerId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"ownerIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"payments","required":false,"schema":{"items":{"enum":["instalment_today","instalment_overdue","partly_paid","not_paid"],"type":"string"},"maxItems":4,"type":"array"}},{"in":"query","name":"pipelineId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"q","required":false,"schema":{"maxLength":200,"type":"string"}},{"in":"query","name":"sort","required":false,"schema":{"enum":["position","createdAt","-createdAt","amount","-amount","title","-title"],"type":"string"}},{"in":"query","name":"stageEnteredFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"stageEnteredTo","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"stageIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"status","required":false,"schema":{"enum":["open","won","lost","deleted"],"type":"string"}},{"in":"query","name":"tagIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"tagMode","required":false,"schema":{"default":"any","enum":["any","all","none"],"type":"string"}},{"in":"query","name":"taskDueFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"taskDueTo","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"tasks","required":false,"schema":{"items":{"enum":["none","open","overdue","due"],"type":"string"},"maxItems":4,"type":"array"}},{"in":"query","name":"updatedFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"updatedTo","required":false,"schema":{"format":"date-time","type":"string"}}],"description":"Сделки в порядке доски, страницами: лимит делится между этапами, чтобы был виден каждый; продолжение этапа — по курсору из `stageCursors`. Фильтры по воронке, этапам, ответственному, датам, сумме, тегам и собственным полям. `status=open`, `won` или `lost` — только такие сделки, `status=deleted` — сделки в корзине. Значения собственных полей — только для полей из `customFieldIds`; описание сделки — в «Получить сделку».","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"stageCursors":{"items":{"additionalProperties":false,"properties":{"nextCursor":{"type":"string"},"stageId":{"format":"uuid","type":"string"}},"required":["stageId","nextCursor"],"type":"object"},"type":"array"}},"required":["items","nextCursor","stageCursors"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":4}],"nextCursor":null,"stageCursors":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createDeal","security":[{"bearerAuth":[]}],"summary":"Создать сделку","parameters":[],"description":"Нужно только название. Без этапа сделка встаёт в первый этап воронки, без ответственного (`ownerId`) — на того, кто создаёт, для ключа — на его автора (у сделки всегда есть ответственный: `ownerId: null` — `400` `owner_required`), без валюты — в валюте организации. Обязательные поля этапа запрос с ключом не останавливают: сделка встаёт на этап и с пустым полем (отказ `stage_requires_field:<id поля>` получает только человек в Alta). Значение поля «Уникальное значение», которое уже у другой сделки, — `409 VALUE_TAKEN`: сделка не создаётся, а `error.taken.deal` даёт id и номер сделки, которая уже есть, — пишите в неё. Повтор запроса создаст вторую сделку: если ответ не пришёл, сначала поищите сделку по контакту.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]},"companyId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"contactId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]},"values":{"items":{"anyOf":[{"maxLength":2000,"type":"string"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},"maxItems":50,"type":"array"}},"required":["fieldId"],"type":"object"},"maxItems":100,"type":"array"},"description":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","pattern":"^20[0-9]{2}-","type":"string"},{"type":"null"}]},"ownerId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"maximum":1000000000000000,"minimum":-1000000000000000,"type":"number"},"stageId":{"format":"uuid","type":"string"},"tagIds":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},"title":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"}},"required":["title"],"type":"object"},"example":{"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","contactId":"0192f3a1-7c2e-7b4d-9a61-00000000000a","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-00000000001f"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-00000000001f","status":"open","position":1,"stageEnteredAt":"2026-10-20T08:15:00Z","closedAt":null,"expectedCloseDate":null,"description":null,"owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000001","name":"Андрей Шевченко"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[],"customFields":[],"nextTask":null,"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-20T08:15:00Z","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}":{"get":{"operationId":"getDeal","security":[{"bearerAuth":[]}],"summary":"Получить сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Одна сделка по id. Сделка в корзине тоже отвечает — с `inTrash: true`, `deletedAt` и `deletedBy`; удалённая навсегда — `404`. Сделка, которую объединили с другой, лежит в корзине со своим статусом, а `mergedInto` называет id и номер сделки, в которой она теперь.","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":4}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"patch":{"operationId":"updateDeal","security":[{"bearerAuth":[]}],"summary":"Изменить сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Меняет поля сделки или переносит её на другой этап: этап успеха или отказа закрывает сделку, открытый этап снова её открывает. Передайте только то, что меняется; `version` необязателен: с ним изменение пройдёт, только если запись не меняли после вашего чтения (иначе `409 CONFLICT`). Переход на этап с пустым обязательным полем запрос с ключом не останавливает (отказ `stage_requires_field:<id поля>` получает только человек в Alta). Значение уникального поля, которое уже у другой сделки, — `409 VALUE_TAKEN` (`error.taken`). Сделку в корзине сначала восстановите. `ownerId` передаёт сделку другому сотруднику; убрать ответственного нельзя: `ownerId: null` — `400` `owner_required` (без `ownerId` ответственный остаётся прежним). У сделки со своими товарами сумма — из них: другая `amount` — `409 amount_from_products`, пока сумма считается из товаров, и `409 amount_has_lines`, пока у сделки ещё сумма, введённая до этого правила (`PUT /deals/{dealId}/amount-source` `products` считает её по товарам); та же сумма проходит.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]},"companyId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"contactId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]},"values":{"items":{"anyOf":[{"maxLength":2000,"type":"string"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},"maxItems":50,"type":"array"}},"required":["fieldId"],"type":"object"},"maxItems":100,"type":"array"},"description":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","pattern":"^20[0-9]{2}-","type":"string"},{"type":"null"}]},"ownerId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"position":{"maximum":1000000000000000,"minimum":-1000000000000000,"type":"number"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tagIds":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},"title":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"stageId":"0192f3a1-7c2e-7b4d-9a61-000000000021"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000021","status":"open","position":1,"stageEnteredAt":"2026-10-24T16:45:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":5}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"deleteDeal","security":[{"bearerAuth":[]}],"summary":"Удалить сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"version","required":false,"schema":{"minimum":1,"type":"integer"}}],"description":"Переносит сделку в корзину вместе с задачами: она пропадает с доски, из списков и поиска, а через 30 дней удаляется навсегда. Повтор ничего не меняет.","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":"2026-10-24T16:45:00Z","inTrash":true,"deletedBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":5}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/amount-source":{"put":{"operationId":"setDealAmountSource","security":[{"bearerAuth":[]}],"summary":"Откуда берётся сумма сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"`manual` — сумму вводят вручную; `products` — сумма считается из строк самой сделки (у сделки без строк — `409 no_lines`; у сделки, сумму которой пишет импорт другой системы, — `409 amount_kept_by_sync`: её строки сумму не меняют, `amountKeptBySync` в списке товаров). У сделки со своими строками сумма — из них: `manual` — `409 amount_has_lines`, другая сумма получается своей ценой строки или скидкой. Сделка, у которой строки и сумма, введённая до этого правила, сохраняет её, пока не выбрано `products` — в одну сторону. Пока сумма из товаров, изменить `amount` через `PATCH /deals/{dealId}` нельзя: `409 amount_from_products`. Тот же источник ещё раз ничего не меняет.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"source":{"description":"Where the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)","enum":["manual","products"],"type":"string"}},"required":["source"],"type":"object"},"example":{"source":"manual"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"description":"Where the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)","enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"},"example":{"amount":"84000.00","currency":"UAH","amountSource":"manual","version":8}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/contacts":{"post":{"operationId":"addDealContact","security":[{"bearerAuth":[]}],"summary":"Добавить контакт в сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Первый контакт сделки становится основным, следующие — после него. Не больше 20 контактов у сделки (`409`); повтор ничего не меняет.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"contactId":{"format":"uuid","type":"string"}},"required":["contactId"],"type":"object"},"example":{"contactId":"0192f3a1-7c2e-7b4d-9a61-00000000000a"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":4}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/contacts/{contactId}":{"delete":{"operationId":"removeDealContact","security":[{"bearerAuth":[]}],"summary":"Убрать контакт из сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"contactId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Если контакт был основным, основным становится добавленный раньше остальных. Повтор ничего не меняет.","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":null,"contacts":[],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":5}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/contacts/{contactId}/primary":{"post":{"operationId":"makeDealContactPrimary","security":[{"bearerAuth":[]}],"summary":"Сделать контакт основным","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"contactId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Прежний основной контакт остаётся в сделке; контакт, которого в сделке нет, добавляется сразу основным.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":4}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/discounts/coupons/{couponId}":{"put":{"operationId":"applyDealCoupon","security":[{"bearerAuth":[]}],"summary":"Применить купон к сделке","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"couponId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Любой, кто может менять сделку; купон встаёт после остальных скидок сделки, тот же купон ещё раз ничего не меняет. База раскладывает его по строкам самой сделки в порядке Lago (сначала купоны на товары и группы, потом остальные, каждый — от того, что осталось после предыдущих) и пересчитывает при каждом изменении строк; сумма сделки — сумма строк после долей. Пока купон стоит на живой сделке, он занимает одно из использований. `409`: `coupon_archived`, `coupon_expired`, `coupon_needs_client` (купон «один раз на клиента», у сделки нет контакта), `coupon_other_currency`, `coupon_used_up`, `coupon_used_by_client`, `coupon_no_matching_products`, `coupon_below_minimum`, `imported_lines`, `amount_kept_by_sync`, `amount_not_from_products` (сумма сделки введена вручную). Купон другой организации — `404`.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"deal":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"capPercent":{"anyOf":[{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"couponId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"inactiveReason":{"anyOf":[{"enum":["amount_typed","used_up","used_by_client","other_currency","no_matching_products","below_minimum"],"type":"string"},{"type":"null"}]},"kind":{"enum":["coupon","manual"],"type":"string"},"lineIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"minimum":1,"type":"integer"},"targeted":{"type":"boolean"},"targets":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds"],"type":"object"},{"type":"null"}]}},"required":["id","kind","couponId","name","discount","currency","minimumAmount","targeted","position","amount","lineIds","inactiveReason","capPercent","targets"],"type":"object"},"type":"array"}},"required":["deal","discounts"],"type":"object"},"example":{"deal":{"amount":"88400.00","currency":"UAH","amountSource":"products","version":9},"discounts":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a03","kind":"coupon","couponId":"0192f3a1-7c2e-7b4d-9a61-000000000a01","name":"Black Friday","discount":{"type":"amount","value":"1000.00"},"currency":"UAH","minimumAmount":"20000.00","targeted":false,"position":1,"amount":"1000.00","lineIds":["0192f3a1-7c2e-7b4d-9a61-000000000901","0192f3a1-7c2e-7b4d-9a61-000000000902"],"inactiveReason":null,"capPercent":null,"targets":null}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"removeDealCoupon","security":[{"bearerAuth":[]}],"summary":"Убрать купон со сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"couponId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Использование купона возвращается, остальные скидки сделки раскладываются заново. Купона на сделке нет — ничего не меняется.","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"deal":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"capPercent":{"anyOf":[{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"couponId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"inactiveReason":{"anyOf":[{"enum":["amount_typed","used_up","used_by_client","other_currency","no_matching_products","below_minimum"],"type":"string"},{"type":"null"}]},"kind":{"enum":["coupon","manual"],"type":"string"},"lineIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"minimum":1,"type":"integer"},"targeted":{"type":"boolean"},"targets":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds"],"type":"object"},{"type":"null"}]}},"required":["id","kind","couponId","name","discount","currency","minimumAmount","targeted","position","amount","lineIds","inactiveReason","capPercent","targets"],"type":"object"},"type":"array"}},"required":["deal","discounts"],"type":"object"},"example":{"deal":{"amount":"89400.00","currency":"UAH","amountSource":"products","version":10},"discounts":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/discounts/manual":{"put":{"operationId":"putDealManualDiscount","security":[{"bearerAuth":[]}],"summary":"Скидка на всю сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Скидка сделки без купона (право «Менять цену в сделке», иначе `403`): `percent` — процент от того, что осталось от сделки к её очереди (больше 0, не больше 100), или `amount` — сумма в валюте сделки (не больше того, что осталось). Одна на сделку; изменённая остаётся на своём месте среди скидок и раскладывается по строкам, как купон. Не больше «Максимальной скидки» роли (`403 discount_above_role_cap`). Та же скидка ещё раз ничего не меняет. `409 imported_lines`, `amount_kept_by_sync`, `amount_not_from_products`. Предел роли того, кто дал скидку, остаётся с ней (`capPercent`): она никогда не берёт больше этой доли того, что осталось, как бы ни менялись строки потом.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},"example":{"type":"percent","value":"5"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"deal":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"capPercent":{"anyOf":[{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"couponId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"inactiveReason":{"anyOf":[{"enum":["amount_typed","used_up","used_by_client","other_currency","no_matching_products","below_minimum"],"type":"string"},{"type":"null"}]},"kind":{"enum":["coupon","manual"],"type":"string"},"lineIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"minimum":1,"type":"integer"},"targeted":{"type":"boolean"},"targets":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds"],"type":"object"},{"type":"null"}]}},"required":["id","kind","couponId","name","discount","currency","minimumAmount","targeted","position","amount","lineIds","inactiveReason","capPercent","targets"],"type":"object"},"type":"array"}},"required":["deal","discounts"],"type":"object"},"example":{"deal":{"amount":"84930.00","currency":"UAH","amountSource":"products","version":11},"discounts":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a04","kind":"manual","couponId":null,"name":null,"discount":{"type":"percent","value":"5.00"},"currency":null,"minimumAmount":null,"targeted":false,"position":1,"amount":"4470.00","lineIds":["0192f3a1-7c2e-7b4d-9a61-000000000901","0192f3a1-7c2e-7b4d-9a61-000000000902"],"inactiveReason":null,"capPercent":"10.00","targets":null}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"removeDealManualDiscount","security":[{"bearerAuth":[]}],"summary":"Убрать скидку на сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Право «Менять цену в сделке», иначе `403`; остальные скидки раскладываются заново. Скидки нет — ничего не меняется.","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"deal":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"capPercent":{"anyOf":[{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"couponId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"inactiveReason":{"anyOf":[{"enum":["amount_typed","used_up","used_by_client","other_currency","no_matching_products","below_minimum"],"type":"string"},{"type":"null"}]},"kind":{"enum":["coupon","manual"],"type":"string"},"lineIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"minimum":1,"type":"integer"},"targeted":{"type":"boolean"},"targets":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds"],"type":"object"},{"type":"null"}]}},"required":["id","kind","couponId","name","discount","currency","minimumAmount","targeted","position","amount","lineIds","inactiveReason","capPercent","targets"],"type":"object"},"type":"array"}},"required":["deal","discounts"],"type":"object"},"example":{"deal":{"amount":"89400.00","currency":"UAH","amountSource":"products","version":12},"discounts":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/products":{"get":{"operationId":"listDealProducts","security":[{"bearerAuth":[]}],"summary":"Товары сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Строки сделки по порядку: товар каталога и цена, по которой его взяли; название, артикул и единица — какими были в момент добавления; количество, цена за единицу, по которой строка продаётся (`price`), своя цена строки до скидки (`priceBeforeDiscount`) и скидка (`discount`, `null` — без скидки), цена каталога в тот момент (`listPrice`) и сумма строки: количество × `price`. Строки другой системы (`imported`) только для чтения. `amountSource`: сумма сделки введена вручную (`manual`) или считается из её товаров (`products`).","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountKeptBySync":{"description":"True while another system's import writes the deal's amount: its own lines are kept but never make the amount, and amount-source stays `manual`","type":"boolean"},"amountSource":{"description":"Where the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)","enum":["manual","products"],"type":"string"},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"capPercent":{"anyOf":[{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"couponId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"inactiveReason":{"anyOf":[{"enum":["amount_typed","used_up","used_by_client","other_currency","no_matching_products","below_minimum"],"type":"string"},{"type":"null"}]},"kind":{"enum":["coupon","manual"],"type":"string"},"lineIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"position":{"minimum":1,"type":"integer"},"targeted":{"type":"boolean"},"targets":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds"],"type":"object"},{"type":"null"}]}},"required":["id","kind","couponId","name","discount","currency","minimumAmount","targeted","position","amount","lineIds","inactiveReason","capPercent","targets"],"type":"object"},"type":"array"},"items":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"discount":{"anyOf":[{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},{"type":"null"}]},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"discountId":{"format":"uuid","type":"string"}},"required":["discountId","amount"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"imported":{"type":"boolean"},"listPrice":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"position":{"type":"integer"},"price":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceBeforeDiscount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"quantity":{"type":"string"},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"tax":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"base":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","base","amount"],"type":"object"},{"type":"null"}]},"total":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","priceId","rateId","name","sku","unit","quantity","price","priceBeforeDiscount","discount","listPrice","amount","discounts","total","currency","position","version","imported"],"type":"object"},"type":"array"},"taxes":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"base":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","base","amount"],"type":"object"},"type":"array"},"totals":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["currency","amount"],"type":"object"},"type":"array"}},"required":["items","totals","amountSource","discounts"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000901","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","priceId":"0192f3a1-7c2e-7b4d-9a61-000000000068","rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","name":"Кофемашина Jura E8","sku":"JE8-01","unit":"шт","quantity":"2","price":"42000.00","priceBeforeDiscount":"42000.00","discount":null,"listPrice":"45000.00","amount":"84000.00","discounts":[],"total":"84000.00","currency":"UAH","position":1,"version":2,"imported":false},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000902","productId":"0192f3a1-7c2e-7b4d-9a61-000000000067","priceId":"0192f3a1-7c2e-7b4d-9a61-00000000006a","rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006d","name":"Сервис кофемашины на год","sku":null,"unit":"год","quantity":"1","price":"5400.00","priceBeforeDiscount":"6000.00","discount":{"type":"percent","value":"10.00"},"listPrice":"6000.00","amount":"5400.00","discounts":[],"total":"5400.00","currency":"UAH","position":2,"version":1,"imported":false}],"totals":[{"currency":"UAH","amount":"89400.00"}],"amountSource":"products","amountKeptBySync":false,"discounts":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"addDealProduct","security":[{"bearerAuth":[]}],"summary":"Добавить товар в сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Товар каталога встаёт в конец, в валюте сделки: `priceId` — одна из его цен в этой валюте (без него — основная, иначе самая ранняя из них), или `price` — своя цена за единицу (нужно право «Менять цену в сделке», иначе `403`). Первый товар сделки с суммой «вручную» переключает её на сумму товаров (`amountSourceChanged`). Без цены в валюте сделки и без своей — `409 no_price_in_currency`; товар в архиве — `409 product_archived`; у сделки есть строки другой системы — `409 imported_lines`; больше 200 строк — `409 too_many_lines`. `discount` — скидка на единицу (право «Менять цену в сделке», иначе `403`): `percent` — процент от цены строки (больше 0, не больше 100) или `amount` — сумма в валюте сделки (больше 0); цена за единицу — цена строки минус скидка, округлённая до копейки (половина — вверх), не ниже 0. Сделка, сумму которой пишет импорт другой системы, скидку не принимает: `409 amount_kept_by_sync`. Повтор с тем же `idempotencyKey` после потерянного ответа вернёт ту же строку.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"price":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]},"priceId":{"format":"uuid","type":"string"},"productId":{"format":"uuid","type":"string"},"quantity":{"anyOf":[{"pattern":"^[0-9]{1,8}(\\.[0-9]{1,3})?$","type":"string"},{"exclusiveMinimum":0,"maximum":99999999.999,"type":"number"}]}},"required":["productId"],"type":"object"},"example":{"productId":"0192f3a1-7c2e-7b4d-9a61-000000000067","priceId":"0192f3a1-7c2e-7b4d-9a61-00000000006a","quantity":"1","discount":{"type":"percent","value":"10"}}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountSourceChanged":{"type":"boolean"},"deal":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"description":"Where the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)","enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"},"line":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"discount":{"anyOf":[{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},{"type":"null"}]},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"discountId":{"format":"uuid","type":"string"}},"required":["discountId","amount"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"imported":{"type":"boolean"},"listPrice":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"position":{"type":"integer"},"price":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceBeforeDiscount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"quantity":{"type":"string"},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"tax":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"base":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","base","amount"],"type":"object"},{"type":"null"}]},"total":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","priceId","rateId","name","sku","unit","quantity","price","priceBeforeDiscount","discount","listPrice","amount","discounts","total","currency","position","version","imported"],"type":"object"}},"required":["line","deal"],"type":"object"},"example":{"line":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000902","productId":"0192f3a1-7c2e-7b4d-9a61-000000000067","priceId":"0192f3a1-7c2e-7b4d-9a61-00000000006a","rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006d","name":"Сервис кофемашины на год","sku":null,"unit":"год","quantity":"1","price":"5400.00","priceBeforeDiscount":"6000.00","discount":{"type":"percent","value":"10.00"},"listPrice":"6000.00","amount":"5400.00","discounts":[],"total":"5400.00","currency":"UAH","position":2,"version":1,"imported":false},"deal":{"amount":"89400.00","currency":"UAH","amountSource":"products","version":5}}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/products/{lineId}":{"patch":{"operationId":"updateDealProduct","security":[{"bearerAuth":[]}],"summary":"Изменить товар сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"lineId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Количество, другая цена товара в валюте сделки (`priceId`: её сумма становится ценой строки) или своя цена (`price`, право «Менять цену в сделке»). Без `discount` `price` и `priceId` — цена, по которой строка продаётся, как до скидок: та же, что сейчас (прочитанная строка, отправленная обратно), ничего не меняет, скидка остаётся; другая — строка продаётся ровно по ней, скидка снимается. С `discount` (то же право, если скидка меняется) `price` и `priceId` — цена до скидки, а `discount` — скидка строки на единицу (`null` — без скидки); но `price`, равная цене продажи, вместе с той же скидкой (прочитанная строка, отправленная целиком) ничего не меняет — скидка не применяется дважды. Изменение одного количества скидку сохраняет. С `version` строки, которую вы прочитали: её успели изменить — `409`. Строка другой системы — `409 imported_line`. Пока сумма сделки из товаров, она пересчитывается.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"discount":{"anyOf":[{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},{"type":"null"}]},"price":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]},"priceId":{"format":"uuid","type":"string"},"quantity":{"anyOf":[{"pattern":"^[0-9]{1,8}(\\.[0-9]{1,3})?$","type":"string"},{"exclusiveMinimum":0,"maximum":99999999.999,"type":"number"}]},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"quantity":"2","price":"42000","version":1}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountSourceChanged":{"type":"boolean"},"deal":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"description":"Where the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)","enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"},"line":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"discount":{"anyOf":[{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},{"type":"null"}]},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"discountId":{"format":"uuid","type":"string"}},"required":["discountId","amount"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"imported":{"type":"boolean"},"listPrice":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"position":{"type":"integer"},"price":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceBeforeDiscount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"quantity":{"type":"string"},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"tax":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"base":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","base","amount"],"type":"object"},{"type":"null"}]},"total":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","priceId","rateId","name","sku","unit","quantity","price","priceBeforeDiscount","discount","listPrice","amount","discounts","total","currency","position","version","imported"],"type":"object"}},"required":["line","deal"],"type":"object"},"example":{"line":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000901","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","priceId":"0192f3a1-7c2e-7b4d-9a61-000000000068","rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","name":"Кофемашина Jura E8","sku":"JE8-01","unit":"шт","quantity":"2","price":"42000.00","priceBeforeDiscount":"42000.00","discount":null,"listPrice":"45000.00","amount":"84000.00","discounts":[],"total":"84000.00","currency":"UAH","position":1,"version":2,"imported":false},"deal":{"amount":"89400.00","currency":"UAH","amountSource":"products","version":6}}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"removeDealProduct","security":[{"bearerAuth":[]}],"summary":"Убрать товар из сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"lineId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Строку другой системы не убрать (`409 imported_line`). Пока сумма сделки из товаров, она пересчитывается; в ответе — новая сумма сделки. Когда убрана последняя своя строка, сумма снова вводится вручную (`amountSource` `manual`) и остаётся такой, какой была с этой строкой.","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"deal":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"amountSource":{"description":"Where the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)","enum":["manual","products"],"type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["amount","currency","amountSource","version"],"type":"object"}},"required":["deal"],"type":"object"},"example":{"deal":{"amount":"84000.00","currency":"UAH","amountSource":"products","version":7}}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/products/order":{"put":{"operationId":"reorderDealProducts","security":[{"bearerAuth":[]}],"summary":"Порядок товаров сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"`lineIds` — все строки самой сделки ровно по разу, в новом порядке (иначе `409 order_mismatch`); строки другой системы стоят на своих местах. В истории сделки не отмечается.","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"lineIds":{"items":{"format":"uuid","type":"string"},"maxItems":400,"type":"array","uniqueItems":true}},"required":["lineIds"],"type":"object"},"example":{"lineIds":["0192f3a1-7c2e-7b4d-9a61-000000000902","0192f3a1-7c2e-7b4d-9a61-000000000901"]}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"discount":{"anyOf":[{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},{"type":"null"}]},"discounts":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"discountId":{"format":"uuid","type":"string"}},"required":["discountId","amount"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"imported":{"type":"boolean"},"listPrice":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"position":{"type":"integer"},"price":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceBeforeDiscount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"priceId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"quantity":{"type":"string"},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"sku":{"anyOf":[{"type":"string"},{"type":"null"}]},"tax":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"base":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","base","amount"],"type":"object"},{"type":"null"}]},"total":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","priceId","rateId","name","sku","unit","quantity","price","priceBeforeDiscount","discount","listPrice","amount","discounts","total","currency","position","version","imported"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000902","productId":"0192f3a1-7c2e-7b4d-9a61-000000000067","priceId":"0192f3a1-7c2e-7b4d-9a61-00000000006a","rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006d","name":"Сервис кофемашины на год","sku":null,"unit":"год","quantity":"1","price":"5400.00","priceBeforeDiscount":"6000.00","discount":{"type":"percent","value":"10.00"},"listPrice":"6000.00","amount":"5400.00","discounts":[],"total":"5400.00","currency":"UAH","position":1,"version":1,"imported":false},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000901","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","priceId":"0192f3a1-7c2e-7b4d-9a61-000000000068","rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","name":"Кофемашина Jura E8","sku":"JE8-01","unit":"шт","quantity":"2","price":"42000.00","priceBeforeDiscount":"42000.00","discount":null,"listPrice":"45000.00","amount":"84000.00","discounts":[],"total":"84000.00","currency":"UAH","position":2,"version":2,"imported":false}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/restore":{"post":{"operationId":"restoreDeal","security":[{"bearerAuth":[]}],"summary":"Восстановить сделку","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Возвращает сделку из корзины такой, какой она была, вместе с задачами. Удалённая навсегда — `404`. Сделка в корзине не держит значений уникальных полей: если одно из них тем временем взяла другая сделка — `409 VALUE_TAKEN` (`error.taken`).","tags":["Сделки"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":6}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/by-number/{number}":{"get":{"operationId":"getDealByNumber","security":[{"bearerAuth":[]}],"summary":"Сделка по номеру","parameters":[{"in":"path","name":"number","required":true,"schema":{"pattern":"^[1-9][0-9]{0,8}$","type":"string"}}],"description":"Сделка по её номеру в организации, а импортированная — ещё и по id в прежней системе.","tags":["Сделки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"amountSource":{"enum":["manual","products"],"type":"string"},"amountTypeable":{"type":"boolean"},"closedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","fullName","phone"],"type":"object"},{"type":"null"}]},"contacts":{"items":{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"description":"The contact's own job title, as the contact record has it.","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"primary":{"type":"boolean"}},"required":["id","fullName","phone","email","jobTitle","primary"],"type":"object"},"type":"array"},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"deletedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"deletedBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedCloseDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inTrash":{"description":"True while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.","type":"boolean"},"mergedAway":{"description":"True while a merge keeps this deal in the trash: everything it had is the deal it went into, which `mergedInto` names when your role shows it; such a deal is never restored (409 `merged_deal`). False for every other deal.","type":"boolean"},"mergedInto":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","number"],"type":"object"},{"type":"null"}],"description":"The deal this one was merged into, followed through later merges to the one that holds it now (its id and number): set only while the merge keeps this deal in the trash, null for a live deal, for one a person deleted, for one restored since, and when your role does not show that deal."},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"overdue":{"type":"boolean"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","dueAt","overdue"],"type":"object"},{"type":"null"}]},"number":{"minimum":1,"type":"integer"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"pipelineId":{"format":"uuid","type":"string"},"position":{"type":"number"},"stageEnteredAt":{"format":"date-time","type":"string"},"stageId":{"format":"uuid","type":"string"},"status":{"enum":["open","won","lost"],"type":"string"},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"title":{"type":"string"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"viewerMay":{"additionalProperties":false,"properties":{"delete":{"type":"boolean"},"edit":{"type":"boolean"}},"required":["edit","delete"],"type":"object"}},"required":["deletedAt","inTrash","deletedBy","mergedInto","mergedAway","nextTask","id","number","title","description","amount","currency","pipelineId","stageId","stageEnteredAt","status","closedAt","position","contact","contacts","company","owner","expectedCloseDate","customFields","tags","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен","amount":"12000.00","currency":"UAH","pipelineId":"0192f3a1-7c2e-7b4d-9a61-00000000001e","stageId":"0192f3a1-7c2e-7b4d-9a61-000000000020","status":"open","position":1,"stageEnteredAt":"2026-10-21T12:40:00Z","closedAt":null,"expectedCloseDate":"2026-11-15","description":"Три кофемашины и сервис на год","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567"},"contacts":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","jobTitle":"Менеджер по закупкам","primary":true}],"company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[{"fieldId":"0192f3a1-7c2e-7b4d-9a61-000000000032","value":"Киев"}],"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","overdue":false,"type":null},"deletedAt":null,"inTrash":false,"deletedBy":null,"mergedInto":null,"mergedAway":false,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":4}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/contacts":{"get":{"operationId":"listContacts","security":[{"bearerAuth":[]}],"summary":"Список контактов","parameters":[{"in":"query","name":"archived","required":false,"schema":{"default":false,"type":"boolean"}},{"in":"query","name":"cf","required":false,"schema":{"items":{"maxLength":2100,"minLength":1,"type":"string"},"maxItems":20,"type":"array"}},{"in":"query","name":"companyId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"createdFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"createdTo","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"creatorIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"deals","required":false,"schema":{"items":{"enum":["open","none"],"type":"string"},"maxItems":2,"type":"array"}},{"in":"query","name":"email","required":false,"schema":{"maxLength":100,"type":"string"}},{"in":"query","name":"jobTitle","required":false,"schema":{"maxLength":100,"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"noOwner","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"ownerId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"ownerIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"phone","required":false,"schema":{"maxLength":100,"type":"string"}},{"in":"query","name":"q","required":false,"schema":{"maxLength":200,"type":"string"}},{"in":"query","name":"sort","required":false,"schema":{"enum":["name","-name","company","-company","owner","-owner","createdAt","-createdAt","updatedAt","-updatedAt"],"type":"string"}},{"in":"query","name":"stageIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"tagIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"tagMode","required":false,"schema":{"default":"any","enum":["any","all","none"],"type":"string"}},{"in":"query","name":"tasks","required":false,"schema":{"items":{"enum":["none","open","overdue"],"type":"string"},"maxItems":3,"type":"array"}},{"in":"query","name":"updatedFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"updatedTo","required":false,"schema":{"format":"date-time","type":"string"}}],"description":"Страницами, по фамилии и имени или в порядке `sort`. Поиск `q` по имени, почте и цифрам телефона; фильтры по ответственному, датам, сделкам, задачам, тегам и собственным полям.","tags":["Контакты"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"description":"The main e-mail address: the first of emails","type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"firstName":{"type":"string"},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"description":"\"\" when the contact has only a first name","type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"description":"The main phone number: the first of phones","type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","firstName","lastName","fullName","email","phone","phones","emails","jobTitle","company","owner","source","notes","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","firstName":"Елена","lastName":"Коваль","fullName":"Елена Коваль","jobTitle":"Менеджер по закупкам","phone":"+380501234567","email":"olena.koval@kavova.ua","phones":[{"value":"+380501234567","kind":"mobile"}],"emails":[{"value":"olena.koval@kavova.ua","kind":"work"}],"source":"Сайт","notes":"Удобнее писать в Telegram","company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":2}],"nextCursor":null}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createContact","security":[{"bearerAuth":[]}],"summary":"Создать контакт","parameters":[],"description":"Нужно только имя. Без ответственного (`ownerId`) контакт достаётся тому, кто создаёт, для ключа — его автору (у контакта всегда есть ответственный: `ownerId: null` — `400` `owner_required`). Повтор запроса создаст второй контакт: если ответ не пришёл, сначала поищите контакт по телефону или почте.","tags":["Контакты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"companyId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]},"values":{"items":{"anyOf":[{"maxLength":2000,"type":"string"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},"maxItems":50,"type":"array"}},"required":["fieldId"],"type":"object"},"maxItems":100,"type":"array"},"email":{"anyOf":[{"maxLength":254,"type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind (work, personal, other), the main one first; [] removes them all","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"maxLength":254,"type":"string"}},"required":["value","kind"],"type":"object"},"maxItems":100,"type":"array"},"firstName":{"maxLength":100,"minLength":1,"pattern":"\\S","type":"string"},"jobTitle":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"lastName":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"ownerId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"maxLength":50,"type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind (mobile, work, home, other), the main one first; [] removes them all","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"maxLength":50,"type":"string"}},"required":["value","kind"],"type":"object"},"maxItems":100,"type":"array"},"source":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"tagIds":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"}},"required":["firstName"],"type":"object"},"example":{"firstName":"Елена","lastName":"Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","source":"Сайт"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"description":"The main e-mail address: the first of emails","type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"firstName":{"type":"string"},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"description":"\"\" when the contact has only a first name","type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"description":"The main phone number: the first of phones","type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","firstName","lastName","fullName","email","phone","phones","emails","jobTitle","company","owner","source","notes","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","firstName":"Елена","lastName":"Коваль","fullName":"Елена Коваль","jobTitle":null,"phone":"+380501234567","email":"olena.koval@kavova.ua","phones":[{"value":"+380501234567","kind":"mobile"}],"emails":[{"value":"olena.koval@kavova.ua","kind":"work"}],"source":"Сайт","notes":null,"company":null,"owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000001","name":"Андрей Шевченко"},"tags":[],"customFields":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-20T08:15:00Z","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/contacts/{contactId}":{"get":{"operationId":"getContact","security":[{"bearerAuth":[]}],"summary":"Получить контакт","parameters":[{"in":"path","name":"contactId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Один контакт по id.","tags":["Контакты"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"description":"The main e-mail address: the first of emails","type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"firstName":{"type":"string"},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"description":"\"\" when the contact has only a first name","type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"description":"The main phone number: the first of phones","type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","firstName","lastName","fullName","email","phone","phones","emails","jobTitle","company","owner","source","notes","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","firstName":"Елена","lastName":"Коваль","fullName":"Елена Коваль","jobTitle":"Менеджер по закупкам","phone":"+380501234567","email":"olena.koval@kavova.ua","phones":[{"value":"+380501234567","kind":"mobile"}],"emails":[{"value":"olena.koval@kavova.ua","kind":"work"}],"source":"Сайт","notes":"Удобнее писать в Telegram","company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":2}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"patch":{"operationId":"updateContact","security":[{"bearerAuth":[]}],"summary":"Изменить контакт","parameters":[{"in":"path","name":"contactId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Передайте только то, что меняется; `version` необязателен: с ним изменение пройдёт, только если запись не меняли после вашего чтения (иначе `409 CONFLICT`). `ownerId` передаёт контакт другому сотруднику; убрать ответственного нельзя: `ownerId: null` — `400` `owner_required` (без `ownerId` ответственный остаётся прежним).","tags":["Контакты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"companyId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]},"values":{"items":{"anyOf":[{"maxLength":2000,"type":"string"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},"maxItems":50,"type":"array"}},"required":["fieldId"],"type":"object"},"maxItems":100,"type":"array"},"email":{"anyOf":[{"maxLength":254,"type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind (work, personal, other), the main one first; [] removes them all","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"maxLength":254,"type":"string"}},"required":["value","kind"],"type":"object"},"maxItems":100,"type":"array"},"firstName":{"maxLength":100,"minLength":1,"pattern":"\\S","type":"string"},"jobTitle":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"lastName":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"ownerId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"maxLength":50,"type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind (mobile, work, home, other), the main one first; [] removes them all","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"maxLength":50,"type":"string"}},"required":["value","kind"],"type":"object"},"maxItems":100,"type":"array"},"source":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"tagIds":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"jobTitle":"Менеджер по закупкам","companyId":"0192f3a1-7c2e-7b4d-9a61-00000000000b"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"description":"The main e-mail address: the first of emails","type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"firstName":{"type":"string"},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"description":"\"\" when the contact has only a first name","type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"description":"The main phone number: the first of phones","type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","firstName","lastName","fullName","email","phone","phones","emails","jobTitle","company","owner","source","notes","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","firstName":"Елена","lastName":"Коваль","fullName":"Елена Коваль","jobTitle":"Менеджер по закупкам","phone":"+380501234567","email":"olena.koval@kavova.ua","phones":[{"value":"+380501234567","kind":"mobile"}],"emails":[{"value":"olena.koval@kavova.ua","kind":"work"}],"source":"Сайт","notes":"Удобнее писать в Telegram","company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":3}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/contacts/{contactId}/archive":{"post":{"operationId":"archiveContact","security":[{"bearerAuth":[]}],"summary":"Убрать контакт в архив","parameters":[{"in":"path","name":"contactId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Контакт пропадает из списков (виден с `archived=true`). Повтор ничего не меняет.","tags":["Контакты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"description":"The main e-mail address: the first of emails","type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"firstName":{"type":"string"},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"description":"\"\" when the contact has only a first name","type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"description":"The main phone number: the first of phones","type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","firstName","lastName","fullName","email","phone","phones","emails","jobTitle","company","owner","source","notes","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","firstName":"Елена","lastName":"Коваль","fullName":"Елена Коваль","jobTitle":"Менеджер по закупкам","phone":"+380501234567","email":"olena.koval@kavova.ua","phones":[{"value":"+380501234567","kind":"mobile"}],"emails":[{"value":"olena.koval@kavova.ua","kind":"work"}],"source":"Сайт","notes":"Удобнее писать в Telegram","company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[],"archivedAt":"2026-10-24T16:45:00Z","createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":3}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/contacts/{contactId}/restore":{"post":{"operationId":"restoreContact","security":[{"bearerAuth":[]}],"summary":"Вернуть контакт из архива","parameters":[{"in":"path","name":"contactId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Контакт снова в списках. Повтор ничего не меняет.","tags":["Контакты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"company":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"description":"The main e-mail address: the first of emails","type":"string"},{"type":"null"}]},"emails":{"description":"Every e-mail address with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["work","personal","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"firstName":{"type":"string"},"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastName":{"description":"\"\" when the contact has only a first name","type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"description":"The main phone number: the first of phones","type":"string"},{"type":"null"}]},"phones":{"description":"Every phone number with its kind, the main one first","items":{"additionalProperties":false,"properties":{"kind":{"enum":["mobile","work","home","other"],"type":"string"},"value":{"type":"string"}},"required":["value","kind"],"type":"object"},"type":"array"},"source":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","firstName","lastName","fullName","email","phone","phones","emails","jobTitle","company","owner","source","notes","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","firstName":"Елена","lastName":"Коваль","fullName":"Елена Коваль","jobTitle":"Менеджер по закупкам","phone":"+380501234567","email":"olena.koval@kavova.ua","phones":[{"value":"+380501234567","kind":"mobile"}],"emails":[{"value":"olena.koval@kavova.ua","kind":"work"}],"source":"Сайт","notes":"Удобнее писать в Telegram","company":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»"},"owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple"}],"customFields":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":4}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/contacts/external/{source}/{externalId}":{"put":{"operationId":"importContact","security":[{"bearerAuth":[]}],"summary":"Создать или обновить контакт по внешнему id","parameters":[{"in":"path","name":"source","required":true,"schema":{"pattern":"^[a-z0-9_-]{1,40}$","type":"string"}},{"in":"path","name":"externalId","required":true,"schema":{"maxLength":200,"minLength":1,"pattern":"^\\S+$","type":"string"}}],"description":"Один контакт на один id в вашей системе: `source` — ваше слово для системы (строчные латинские буквы, цифры, `-` и `_`), `externalId` — id контакта там. Такого контакта ещё нет — он создаётся (`created`), есть — приводится к запросу (`updated`); тот же запрос ещё раз ничего не меняет (`unchanged`), поэтому повтор безопасен. Импорт из другой системы записывает её контакты так же: с его `source` и тем же id это тот же контакт, а не второй. Запрос описывает контакт целиком: поле, которого в нём нет, очищается (без `ownerId` у контакта нет ответственного); из собственных полей меняются только переданные в `customFields`, а `tagIds`, если передан, — полный набор тегов. `createdAt` и `updatedAt` — когда контакт создали и последний раз меняли в вашей системе. С `ifUnchangedHere: true` контакт, который в Alta изменили после последней записи по этому id, остаётся как есть, а в ответе — `changedHere: true`. Если контакт с этим id объединили с другим, ответ называет тот контакт (`merged: true`), второй не создаётся. Два запроса с одним новым id одновременно: второй получает `409 CONFLICT`, его можно повторить. Нужно право «Импорт данных» в роли автора ключа (у владельца и администратора оно есть), иначе — `403 FORBIDDEN`.","tags":["Контакты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"companyId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]},"values":{"items":{"anyOf":[{"maxLength":2000,"type":"string"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},"maxItems":50,"type":"array"}},"required":["fieldId"],"type":"object"},"maxItems":100,"type":"array"},"email":{"anyOf":[{"maxLength":254,"type":"string"},{"type":"null"}]},"firstName":{"maxLength":100,"minLength":1,"pattern":"\\S","type":"string"},"ifUnchangedHere":{"type":"boolean"},"jobTitle":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"lastName":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"ownerId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"maxLength":50,"type":"string"},{"type":"null"}]},"source":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"tagIds":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},"updatedAt":{"format":"date-time","type":"string"}},"required":["firstName","createdAt","updatedAt"],"type":"object"},"example":{"firstName":"Елена","lastName":"Коваль","phone":"+380501234567","email":"olena.koval@kavova.ua","source":"Сайт","createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-20T08:15:00Z"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"changedHere":{"const":true,"type":"boolean"},"declined":{"const":true,"type":"boolean"},"id":{"format":"uuid","type":"string"},"merged":{"const":true,"type":"boolean"},"outcome":{"enum":["created","updated","unchanged"],"type":"string"},"sameAsImported":{"const":true,"type":"boolean"}},"required":["id","outcome"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","outcome":"created"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/companies":{"get":{"operationId":"listCompanies","security":[{"bearerAuth":[]}],"summary":"Список компаний","parameters":[{"in":"query","name":"archived","required":false,"schema":{"default":false,"type":"boolean"}},{"in":"query","name":"cf","required":false,"schema":{"items":{"maxLength":2100,"minLength":1,"type":"string"},"maxItems":20,"type":"array"}},{"in":"query","name":"createdFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"createdTo","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"creatorIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"deals","required":false,"schema":{"items":{"enum":["open","none"],"type":"string"},"maxItems":2,"type":"array"}},{"in":"query","name":"email","required":false,"schema":{"maxLength":100,"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"noOwner","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"ownerId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"ownerIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"phone","required":false,"schema":{"maxLength":100,"type":"string"}},{"in":"query","name":"q","required":false,"schema":{"maxLength":200,"type":"string"}},{"in":"query","name":"stageIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"tagIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"}},{"in":"query","name":"tagMode","required":false,"schema":{"default":"any","enum":["any","all","none"],"type":"string"}},{"in":"query","name":"updatedFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"updatedTo","required":false,"schema":{"format":"date-time","type":"string"}}],"description":"Страницами, по названию. Поиск `q` по названию, почте, сайту и цифрам телефона; фильтры по ответственному, датам, сделкам, тегам и собственным полям.","tags":["Компании"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contactCount":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"openDealsAmount":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},{"type":"null"}]},"openDealsOtherCurrencies":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},"type":"array"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"website":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","website","phone","email","industry","owner","contactCount","openDealsAmount","openDealsOtherCurrencies","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»","industry":"Рестораны и кофейни","website":"kavova.ua","phone":"+380442223344","email":"info@kavova.ua","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000029","name":"Опт","color":"teal"}],"customFields":[],"contactCount":1,"openDealsAmount":{"amount":"12000.00","currency":"UAH"},"openDealsOtherCurrencies":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":1}],"nextCursor":null}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createCompany","security":[{"bearerAuth":[]}],"summary":"Создать компанию","parameters":[],"description":"Нужно только название. Без ответственного (`ownerId`) компания достаётся тому, кто создаёт, для ключа — его автору (у компании всегда есть ответственный: `ownerId: null` — `400` `owner_required`). Повтор запроса создаст вторую компанию: если ответ не пришёл, сначала поищите компанию.","tags":["Компании"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]},"values":{"items":{"anyOf":[{"maxLength":2000,"type":"string"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},"maxItems":50,"type":"array"}},"required":["fieldId"],"type":"object"},"maxItems":100,"type":"array"},"email":{"anyOf":[{"maxLength":254,"type":"string"},{"type":"null"}]},"industry":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"name":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"ownerId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"maxLength":50,"type":"string"},{"type":"null"}]},"tagIds":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},"website":{"anyOf":[{"maxLength":300,"type":"string"},{"type":"null"}]}},"required":["name"],"type":"object"},"example":{"name":"ООО «Кофейная гильдия»","phone":"+380442223344","email":"info@kavova.ua","website":"kavova.ua"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contactCount":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"openDealsAmount":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},{"type":"null"}]},"openDealsOtherCurrencies":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},"type":"array"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"website":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","website","phone","email","industry","owner","contactCount","openDealsAmount","openDealsOtherCurrencies","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»","industry":null,"website":"kavova.ua","phone":"+380442223344","email":"info@kavova.ua","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000001","name":"Андрей Шевченко"},"tags":[],"customFields":[],"contactCount":0,"openDealsAmount":null,"openDealsOtherCurrencies":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-20T08:15:00Z","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/companies/{companyId}":{"get":{"operationId":"getCompany","security":[{"bearerAuth":[]}],"summary":"Получить компанию","parameters":[{"in":"path","name":"companyId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Одна компания по id: с количеством контактов и суммой открытых сделок.","tags":["Компании"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contactCount":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"openDealsAmount":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},{"type":"null"}]},"openDealsOtherCurrencies":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},"type":"array"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"website":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","website","phone","email","industry","owner","contactCount","openDealsAmount","openDealsOtherCurrencies","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»","industry":"Рестораны и кофейни","website":"kavova.ua","phone":"+380442223344","email":"info@kavova.ua","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000029","name":"Опт","color":"teal"}],"customFields":[],"contactCount":1,"openDealsAmount":{"amount":"12000.00","currency":"UAH"},"openDealsOtherCurrencies":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"patch":{"operationId":"updateCompany","security":[{"bearerAuth":[]}],"summary":"Изменить компанию","parameters":[{"in":"path","name":"companyId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Передайте только то, что меняется; `version` необязателен: с ним изменение пройдёт, только если запись не меняли после вашего чтения (иначе `409 CONFLICT`). `ownerId` передаёт компанию другому сотруднику; убрать ответственного нельзя: `ownerId: null` — `400` `owner_required` (без `ownerId` ответственный остаётся прежним).","tags":["Компании"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]},"values":{"items":{"anyOf":[{"maxLength":2000,"type":"string"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},"maxItems":50,"type":"array"}},"required":["fieldId"],"type":"object"},"maxItems":100,"type":"array"},"email":{"anyOf":[{"maxLength":254,"type":"string"},{"type":"null"}]},"industry":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"name":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"ownerId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"maxLength":50,"type":"string"},{"type":"null"}]},"tagIds":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},"version":{"minimum":1,"type":"integer"},"website":{"anyOf":[{"maxLength":300,"type":"string"},{"type":"null"}]}},"type":"object"},"example":{"industry":"Рестораны и кофейни"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contactCount":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"openDealsAmount":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},{"type":"null"}]},"openDealsOtherCurrencies":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},"type":"array"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"website":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","website","phone","email","industry","owner","contactCount","openDealsAmount","openDealsOtherCurrencies","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»","industry":"Рестораны и кофейни","website":"kavova.ua","phone":"+380442223344","email":"info@kavova.ua","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000029","name":"Опт","color":"teal"}],"customFields":[],"contactCount":1,"openDealsAmount":{"amount":"12000.00","currency":"UAH"},"openDealsOtherCurrencies":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":2}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/companies/{companyId}/archive":{"post":{"operationId":"archiveCompany","security":[{"bearerAuth":[]}],"summary":"Убрать компанию в архив","parameters":[{"in":"path","name":"companyId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Компания пропадает из списков (видна с `archived=true`). Повтор ничего не меняет.","tags":["Компании"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contactCount":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"openDealsAmount":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},{"type":"null"}]},"openDealsOtherCurrencies":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},"type":"array"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"website":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","website","phone","email","industry","owner","contactCount","openDealsAmount","openDealsOtherCurrencies","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»","industry":"Рестораны и кофейни","website":"kavova.ua","phone":"+380442223344","email":"info@kavova.ua","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000029","name":"Опт","color":"teal"}],"customFields":[],"contactCount":1,"openDealsAmount":{"amount":"12000.00","currency":"UAH"},"openDealsOtherCurrencies":[],"archivedAt":"2026-10-24T16:45:00Z","createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":2}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/companies/{companyId}/restore":{"post":{"operationId":"restoreCompany","security":[{"bearerAuth":[]}],"summary":"Вернуть компанию из архива","parameters":[{"in":"path","name":"companyId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Компания снова в списках. Повтор ничего не меняет.","tags":["Компании"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contactCount":{"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"values":{"items":{"anyOf":[{"type":"string"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]},"type":"array"}},"required":["fieldId","value"],"type":"object"},"type":"array"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"openDealsAmount":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},{"type":"null"}]},"openDealsOtherCurrencies":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"}},"required":["amount","currency"],"type":"object"},"type":"array"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"tags":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","color"],"type":"object"},"type":"array"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"},"website":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","website","phone","email","industry","owner","contactCount","openDealsAmount","openDealsOtherCurrencies","customFields","tags","archivedAt","createdAt","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000b","name":"ООО «Кофейная гильдия»","industry":"Рестораны и кофейни","website":"kavova.ua","phone":"+380442223344","email":"info@kavova.ua","owner":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"tags":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000029","name":"Опт","color":"teal"}],"customFields":[],"contactCount":1,"openDealsAmount":{"amount":"12000.00","currency":"UAH"},"openDealsOtherCurrencies":[],"archivedAt":null,"createdAt":"2026-10-20T08:15:00Z","updatedAt":"2026-10-24T16:45:00Z","version":3}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/task-types":{"get":{"operationId":"listTaskTypes","security":[{"bearerAuth":[]}],"summary":"Типы задач","parameters":[{"in":"query","name":"status","required":false,"schema":{"default":"active","enum":["active","archived","all"],"type":"string"}},{"in":"query","name":"usage","required":false,"schema":{"type":"boolean"}}],"description":"Собственные типы задач организации в её порядке: активные, архивные или все; `usage=true` добавляет, у скольких задач стоит каждый.","tags":["Задачи"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"position":{"minimum":1,"type":"integer"},"usage":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","icon","position","archived","version","usage"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003e","name":"Встреча в офисе","icon":"users","position":1,"archived":false,"usage":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003f","name":"Демонстрация","icon":"presentation","position":2,"archived":false,"usage":null,"version":1}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tasks":{"get":{"operationId":"listTasks","security":[{"bearerAuth":[]}],"summary":"Список задач","parameters":[{"in":"query","name":"assigneeId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"assigneeIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array"}},{"in":"query","name":"contactId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"dealId","required":false,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"dueFrom","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"dueTo","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"kind","required":false,"schema":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":500,"maximum":500,"minimum":1,"type":"integer"}},{"in":"query","name":"noAssignee","required":false,"schema":{"type":"boolean"}},{"in":"query","name":"q","required":false,"schema":{"maxLength":200,"type":"string"}},{"in":"query","name":"scope","required":false,"schema":{"default":"all","enum":["mine","all"],"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"enum":["open","done","canceled"],"type":"string"}},{"in":"query","name":"typeId","required":false,"schema":{"format":"uuid","type":"string"}}],"description":"Свои (`scope=mine`) или любого исполнителя; фильтры по сроку, словам названия, виду и типу. Со `status` — страницами; без него — одна страница: открытые, выполненные, отменённые.","tags":["Задачи"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"status":"open","dueAt":"2026-10-28T10:00:00Z","allDay":false,"durationMinutes":30,"notes":"Уточнить количество кофемашин","assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":null,"result":null,"reschedules":null,"followsTaskId":null,"completedAt":null,"canceledAt":null,"createdAt":"2026-10-21T12:40:00Z","updatedAt":"2026-10-21T12:40:00Z","version":1}],"nextCursor":null}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createTask","security":[{"bearerAuth":[]}],"summary":"Создать задачу","parameters":[],"description":"Нужно только название. Без исполнителя (`assigneeId`) задача достаётся тому, кто создаёт, для ключа — его автору, и она в его `scope=mine` (`assigneeId: null` оставляет задачу без исполнителя). Срок (`dueAt`), длительность в минутах (`durationMinutes`, от 1 до 1440) или весь день (`allDay`), вид (`kind`) или собственный тип организации (`typeId`), сделка и контакт. `idempotencyKey` делает повтор безопасным.","tags":["Задачи"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assigneeId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"contactId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"dealId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"title":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"typeId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["title"],"type":"object"},"example":{"title":"Перезвонить по счёту","kind":"call","dueAt":"2026-10-28T10:00:00Z","assigneeId":"0192f3a1-7c2e-7b4d-9a61-000000000002","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","contactId":"0192f3a1-7c2e-7b4d-9a61-00000000000a","idempotencyKey":"6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"status":"open","dueAt":"2026-10-28T10:00:00Z","allDay":false,"durationMinutes":30,"notes":"Уточнить количество кофемашин","assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":null,"result":null,"reschedules":null,"followsTaskId":null,"completedAt":null,"canceledAt":null,"createdAt":"2026-10-21T12:40:00Z","updatedAt":"2026-10-21T12:40:00Z","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tasks/{taskId}":{"get":{"operationId":"getTask","security":[{"bearerAuth":[]}],"summary":"Получить задачу","parameters":[{"in":"path","name":"taskId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Одна задача по id.","tags":["Задачи"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"status":"open","dueAt":"2026-10-28T10:00:00Z","allDay":false,"durationMinutes":30,"notes":"Уточнить количество кофемашин","assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":null,"result":null,"reschedules":null,"followsTaskId":null,"completedAt":null,"canceledAt":null,"createdAt":"2026-10-21T12:40:00Z","updatedAt":"2026-10-21T12:40:00Z","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"patch":{"operationId":"updateTask","security":[{"bearerAuth":[]}],"summary":"Изменить задачу","parameters":[{"in":"path","name":"taskId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Название, вид, тип, заметка, срок, исполнитель, сделка и контакт — только то, что меняется. `version` необязателен: с ним изменение пройдёт, только если запись не меняли после вашего чтения (иначе `409 CONFLICT`). Срок открытой задачи, сдвинутый позже, — это перенос: причина в `rescheduleReason` (для `other` нужен ещё комментарий `rescheduleNote`).","tags":["Задачи"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assigneeId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"contactId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"dealId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"rescheduleNote":{"anyOf":[{"maxLength":500,"type":"string"},{"type":"null"}]},"rescheduleReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]},"title":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"typeId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"dueAt":"2026-10-30T10:00:00Z","rescheduleReason":"client_asked","rescheduleNote":"Клиентка попросила перенести на четверг"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"status":"open","dueAt":"2026-10-30T10:00:00Z","allDay":false,"durationMinutes":30,"notes":"Уточнить количество кофемашин","assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":null,"result":null,"reschedules":{"count":1,"lastReason":"client_asked","lastNote":"Клиентка попросила перенести на четверг"},"followsTaskId":null,"completedAt":null,"canceledAt":null,"createdAt":"2026-10-21T12:40:00Z","updatedAt":"2026-10-24T16:45:00Z","version":2}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"deleteTask","security":[{"bearerAuth":[]}],"summary":"Удалить задачу","parameters":[{"in":"path","name":"taskId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Задача пропадает из всех списков; её можно восстановить. Повтор отвечает `204`.","tags":["Задачи"],"responses":{"204":{"description":"Успешный ответ, без тела.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tasks/{taskId}/complete":{"post":{"operationId":"completeTask","security":[{"bearerAuth":[]}],"summary":"Выполнить задачу","parameters":[{"in":"path","name":"taskId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Как прошёл контакт (`outcome`: звонок, сообщение, встреча, не ответил, не удалось связаться), чем закончилось (`result`) и, если нужно, следующая задача (`next`; без `assigneeId` — тому, кто выполняет, для ключа — его автору) по той же сделке — всё вместе или ничего. С `idempotencyKey` повтор безопасен, а `outcome` обязателен; задачу, которую уже выполнил кто-то другой, — `409`.","tags":["Задачи"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"next":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assigneeId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"null"}]},"title":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"typeId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["title"],"type":"object"},"outcome":{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},"result":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]}},"type":"object"},"example":{"outcome":"call","result":"Согласовали три кофемашины, ждёт счёт","next":{"title":"Отправить счёт","kind":"email","dueAt":"2026-10-29T09:00:00Z","assigneeId":"0192f3a1-7c2e-7b4d-9a61-000000000002"},"idempotencyKey":"6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"nextTask":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules"],"type":"object"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules","nextTask"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"status":"done","dueAt":"2026-10-28T10:00:00Z","allDay":false,"durationMinutes":30,"notes":"Уточнить количество кофемашин","assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":"call","result":"Согласовали три кофемашины, ждёт счёт","reschedules":null,"followsTaskId":null,"completedAt":"2026-10-24T16:45:00Z","canceledAt":null,"createdAt":"2026-10-21T12:40:00Z","updatedAt":"2026-10-24T16:45:00Z","version":2,"nextTask":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003d","title":"Отправить счёт","kind":"email","type":null,"status":"open","dueAt":"2026-10-29T09:00:00Z","allDay":false,"durationMinutes":null,"notes":null,"assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":null,"result":null,"reschedules":null,"followsTaskId":"0192f3a1-7c2e-7b4d-9a61-00000000003c","completedAt":null,"canceledAt":null,"createdAt":"2026-10-24T16:45:00Z","updatedAt":"2026-10-24T16:45:00Z","version":1}}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tasks/{taskId}/reopen":{"post":{"operationId":"reopenTask","security":[{"bearerAuth":[]}],"summary":"Вернуть задачу в работу","parameters":[{"in":"path","name":"taskId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Снова открывает выполненную задачу. Повтор ничего не меняет.","tags":["Задачи"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"status":"open","dueAt":"2026-10-28T10:00:00Z","allDay":false,"durationMinutes":30,"notes":"Уточнить количество кофемашин","assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":null,"result":null,"reschedules":null,"followsTaskId":null,"completedAt":null,"canceledAt":null,"createdAt":"2026-10-21T12:40:00Z","updatedAt":"2026-10-24T16:45:00Z","version":3}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tasks/{taskId}/restore":{"post":{"operationId":"restoreTask","security":[{"bearerAuth":[]}],"summary":"Восстановить задачу","parameters":[{"in":"path","name":"taskId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Возвращает удалённую задачу. Повтор ничего не меняет.","tags":["Задачи"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"assignee":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"completedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"contact":{"anyOf":[{"additionalProperties":false,"properties":{"fullName":{"type":"string"},"id":{"format":"uuid","type":"string"}},"required":["id","fullName"],"type":"object"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"deal":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"number":{"minimum":1,"type":"integer"},"title":{"type":"string"},"viewerMay":{"additionalProperties":false,"properties":{"edit":{"type":"boolean"}},"required":["edit"],"type":"object"}},"required":["id","number","title"],"type":"object"},{"type":"null"}]},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"durationMinutes":{"anyOf":[{"maximum":1440,"minimum":1,"type":"integer"},{"type":"null"}]},"followsTaskId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedules":{"anyOf":[{"additionalProperties":false,"properties":{"count":{"minimum":1,"type":"integer"},"lastNote":{"anyOf":[{"type":"string"},{"type":"null"}]},"lastReason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["count","lastReason","lastNote"],"type":"object"},{"type":"null"}]},"result":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"enum":["open","done","canceled"],"type":"string"},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon","archived"],"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","title","kind","notes","dueAt","status","completedAt","canceledAt","assignee","contact","deal","createdAt","updatedAt","version","result","followsTaskId","type","outcome","reschedules"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"status":"open","dueAt":"2026-10-28T10:00:00Z","allDay":false,"durationMinutes":30,"notes":"Уточнить количество кофемашин","assignee":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"deal":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000014","number":1042,"title":"Кофемашины для сети кофеен"},"contact":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","fullName":"Елена Коваль"},"outcome":null,"result":null,"reschedules":null,"followsTaskId":null,"completedAt":null,"canceledAt":null,"createdAt":"2026-10-21T12:40:00Z","updatedAt":"2026-10-21T12:40:00Z","version":3}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/pipelines":{"get":{"operationId":"listPipelines","security":[{"bearerAuth":[]}],"summary":"Список воронок","parameters":[],"description":"Воронки продаж с этапами в порядке доски. Воронки настраивают в CRM; через API — только чтение.","tags":["Воронки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"dealPanel":{"additionalProperties":false,"description":"Which blocks the deal page shows for deals of this pipeline; each is on unless turned off.","properties":{"contacts":{"description":"The deal page shows its contacts block: the company and the people of the deal.","type":"boolean"},"payment":{"description":"The deal page shows its payment block: what was paid of the amount, and adding a payment.","type":"boolean"},"products":{"description":"The deal page shows its products block: the deal's product lines.","type":"boolean"}},"required":["payment","contacts","products"],"type":"object"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"stages":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"durationNormSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"description":"How long deals of the organization usually stand on this stage, in seconds (the 80th percentile of its own recent history, refreshed nightly); null while the stage has too little history."},"id":{"format":"uuid","type":"string"},"kind":{"enum":["open","won","lost"],"type":"string"},"name":{"type":"string"},"position":{"minimum":1,"type":"integer"}},"required":["id","name","position","kind","color","durationNormSeconds"],"type":"object"},"type":"array"}},"required":["id","name","dealPanel","stages"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000001e","name":"Продажи","dealPanel":{"payment":true,"contacts":true,"products":false},"stages":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000001f","name":"Новый запрос","position":1,"kind":"open","color":"blue","durationNormSeconds":172800},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000020","name":"Переговоры","position":2,"kind":"open","color":"yellow","durationNormSeconds":604800},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000021","name":"Счёт выставлен","position":3,"kind":"open","color":"orange","durationNormSeconds":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000022","name":"Успешно","position":4,"kind":"won","color":"green","durationNormSeconds":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000023","name":"Отказ","position":5,"kind":"lost","color":"red","durationNormSeconds":null}]}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/pipelines/{pipelineId}":{"get":{"operationId":"getPipeline","security":[{"bearerAuth":[]}],"summary":"Получить воронку","parameters":[{"in":"path","name":"pipelineId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Одна воронка с этапами в порядке доски.","tags":["Воронки"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"dealPanel":{"additionalProperties":false,"description":"Which blocks the deal page shows for deals of this pipeline; each is on unless turned off.","properties":{"contacts":{"description":"The deal page shows its contacts block: the company and the people of the deal.","type":"boolean"},"payment":{"description":"The deal page shows its payment block: what was paid of the amount, and adding a payment.","type":"boolean"},"products":{"description":"The deal page shows its products block: the deal's product lines.","type":"boolean"}},"required":["payment","contacts","products"],"type":"object"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"stages":{"items":{"additionalProperties":false,"properties":{"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"durationNormSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}],"description":"How long deals of the organization usually stand on this stage, in seconds (the 80th percentile of its own recent history, refreshed nightly); null while the stage has too little history."},"id":{"format":"uuid","type":"string"},"kind":{"enum":["open","won","lost"],"type":"string"},"name":{"type":"string"},"position":{"minimum":1,"type":"integer"}},"required":["id","name","position","kind","color","durationNormSeconds"],"type":"object"},"type":"array"}},"required":["id","name","dealPanel","stages"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000001e","name":"Продажи","dealPanel":{"payment":true,"contacts":true,"products":false},"stages":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000001f","name":"Новый запрос","position":1,"kind":"open","color":"blue","durationNormSeconds":172800},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000020","name":"Переговоры","position":2,"kind":"open","color":"yellow","durationNormSeconds":604800},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000021","name":"Счёт выставлен","position":3,"kind":"open","color":"orange","durationNormSeconds":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000022","name":"Успешно","position":4,"kind":"won","color":"green","durationNormSeconds":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000023","name":"Отказ","position":5,"kind":"lost","color":"red","durationNormSeconds":null}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/coupons":{"get":{"operationId":"listCoupons","security":[{"bearerAuth":[]}],"summary":"Купоны","parameters":[{"in":"query","name":"archived","required":false,"schema":{"default":false,"type":"boolean"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"q","required":false,"schema":{"maxLength":100,"type":"string"}}],"description":"Купоны организации страницами (`limit`, `cursor`) по названию, действующие или архивные (`archived`); `q` находит купоны, в названии которых есть эти буквы или код которых с них начинается, без учёта регистра. У каждого — скидка, ограничения, товары и группы (`appliesTo`, `null` — вся сделка), сколько живых сделок держат его сейчас (`uses`) и применяли ли его хоть раз (`used`). Читает роль с разделом «Сделки» или страницей «Товары».","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"items":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"kind":{"enum":["product","category"],"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"],"type":"object"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds","items"],"type":"object"},{"type":"null"}]},"archived":{"type":"boolean"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"maxUses":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"oncePerClient":{"type":"boolean"},"used":{"type":"boolean"},"uses":{"minimum":0,"type":"integer"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","discount","currency","validUntil","oncePerClient","maxUses","uses","used","minimumAmount","appliesTo","archived","version","createdAt"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a01","name":"Black Friday","code":"BF2026","discount":{"type":"amount","value":"1000.00"},"currency":"UAH","validUntil":"2026-11-30","oncePerClient":true,"maxUses":100,"uses":12,"used":true,"minimumAmount":"20000.00","appliesTo":null,"archived":false,"version":2,"createdAt":"2026-10-20T08:15:00Z"},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a02","name":"Service −10 %","code":null,"discount":{"type":"percent","value":"10.00"},"currency":null,"validUntil":null,"oncePerClient":false,"maxUses":null,"uses":0,"used":false,"minimumAmount":null,"appliesTo":{"productIds":["0192f3a1-7c2e-7b4d-9a61-000000000067"],"categoryIds":[],"items":[{"kind":"product","id":"0192f3a1-7c2e-7b4d-9a61-000000000067","name":"Сервис кофемашины на год"}]},"archived":false,"version":1,"createdAt":"2026-10-24T16:45:00Z"}],"nextCursor":null}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createCoupon","security":[{"bearerAuth":[]}],"summary":"Создать купон","parameters":[],"description":"Нужна страница «Товары» в роли. Название, необязательный код (латинские буквы, цифры, «-», «_»; занятый действующим купоном без учёта регистра — `409 NAME_TAKEN`), скидка: `percent` — процент от того, что осталось от сделки (больше 0, не больше 100), или `amount` — сумма в `currency`, которая раскладывается по строкам. Ограничения: `validUntil` — последний день, когда купон можно применить (по календарю организации), `oncePerClient` — одна живая сделка на клиента (контакт сделки), `maxUses` — не больше стольких живых сделок сразу, `minimumAmount` — сумма товаров сделки со скидками в строках от этой суммы (в `currency`), `appliesTo` — только эти товары и группы. `currency` нужна для суммы и минимума. Повтор с тем же `idempotencyKey` после потерянного ответа вернёт тот же купон.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array","uniqueItems":true},"productIds":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array","uniqueItems":true}},"type":"object"},{"type":"null"}]},"code":{"anyOf":[{"pattern":"^[A-Za-z0-9_-]{1,40}$","type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"maxUses":{"anyOf":[{"maximum":1000000,"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]},{"type":"null"}]},"name":{"maxLength":100,"minLength":1,"pattern":"\\S","type":"string"},"oncePerClient":{"type":"boolean"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]}},"required":["name","discount"],"type":"object"},"example":{"name":"Service −10 %","discount":{"type":"percent","value":"10"},"appliesTo":{"productIds":["0192f3a1-7c2e-7b4d-9a61-000000000067"]}}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"items":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"kind":{"enum":["product","category"],"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"],"type":"object"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds","items"],"type":"object"},{"type":"null"}]},"archived":{"type":"boolean"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"maxUses":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"oncePerClient":{"type":"boolean"},"used":{"type":"boolean"},"uses":{"minimum":0,"type":"integer"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","discount","currency","validUntil","oncePerClient","maxUses","uses","used","minimumAmount","appliesTo","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a02","name":"Service −10 %","code":null,"discount":{"type":"percent","value":"10.00"},"currency":null,"validUntil":null,"oncePerClient":false,"maxUses":null,"uses":0,"used":false,"minimumAmount":null,"appliesTo":{"productIds":["0192f3a1-7c2e-7b4d-9a61-000000000067"],"categoryIds":[],"items":[{"kind":"product","id":"0192f3a1-7c2e-7b4d-9a61-000000000067","name":"Сервис кофемашины на год"}]},"archived":false,"version":1,"createdAt":"2026-10-24T16:45:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/coupons/{couponId}":{"get":{"operationId":"getCoupon","security":[{"bearerAuth":[]}],"summary":"Получить купон","parameters":[{"in":"path","name":"couponId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Один купон, действующий или архивный; купон другой организации — `404`.","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"items":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"kind":{"enum":["product","category"],"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"],"type":"object"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds","items"],"type":"object"},{"type":"null"}]},"archived":{"type":"boolean"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"maxUses":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"oncePerClient":{"type":"boolean"},"used":{"type":"boolean"},"uses":{"minimum":0,"type":"integer"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","discount","currency","validUntil","oncePerClient","maxUses","uses","used","minimumAmount","appliesTo","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a01","name":"Black Friday","code":"BF2026","discount":{"type":"amount","value":"1000.00"},"currency":"UAH","validUntil":"2026-11-30","oncePerClient":true,"maxUses":100,"uses":12,"used":true,"minimumAmount":"20000.00","appliesTo":null,"archived":false,"version":2,"createdAt":"2026-10-20T08:15:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"patch":{"operationId":"updateCoupon","security":[{"bearerAuth":[]}],"summary":"Изменить купон","parameters":[{"in":"path","name":"couponId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Название и код (`null` — без кода) меняются всегда; скидка и ограничения — пока купон ни разу не применяли, иначе `409 coupon_used`: другая скидка — новый купон (те же условия, отправленные обратно, ничего не меняют). Поле, которое не прислали, остаётся. С `version`, которую вы прочитали: купон успели изменить — `409`.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array","uniqueItems":true},"productIds":{"items":{"format":"uuid","type":"string"},"maxItems":100,"type":"array","uniqueItems":true}},"type":"object"},{"type":"null"}]},"code":{"anyOf":[{"pattern":"^[A-Za-z0-9_-]{1,40}$","type":"string"},{"type":"null"}]},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},"maxUses":{"anyOf":[{"maximum":1000000,"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]},{"type":"null"}]},"name":{"maxLength":100,"minLength":1,"pattern":"\\S","type":"string"},"oncePerClient":{"type":"boolean"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"name":"Black Friday 2026"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"items":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"kind":{"enum":["product","category"],"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"],"type":"object"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds","items"],"type":"object"},{"type":"null"}]},"archived":{"type":"boolean"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"maxUses":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"oncePerClient":{"type":"boolean"},"used":{"type":"boolean"},"uses":{"minimum":0,"type":"integer"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","discount","currency","validUntil","oncePerClient","maxUses","uses","used","minimumAmount","appliesTo","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a01","name":"Black Friday 2026","code":"BF2026","discount":{"type":"amount","value":"1000.00"},"currency":"UAH","validUntil":"2026-11-30","oncePerClient":true,"maxUses":100,"uses":12,"used":true,"minimumAmount":"20000.00","appliesTo":null,"archived":false,"version":3,"createdAt":"2026-10-20T08:15:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"deleteCoupon","security":[{"bearerAuth":[]}],"summary":"Удалить купон","parameters":[{"in":"path","name":"couponId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Только купон, который ни разу не применяли; применённый — `409 coupon_used`: отправьте его в архив.","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"deleted":{"const":true,"type":"boolean"}},"required":["deleted"],"type":"object"},"example":{"deleted":true}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/coupons/{couponId}/archive":{"post":{"operationId":"archiveCoupon","security":[{"bearerAuth":[]}],"summary":"Купон в архив","parameters":[{"in":"path","name":"couponId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Купон больше не применяется к сделкам; сделки, где он стоит, его сохраняют; его код может взять другой купон. Архивный ещё раз ничего не меняет.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"items":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"kind":{"enum":["product","category"],"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"],"type":"object"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds","items"],"type":"object"},{"type":"null"}]},"archived":{"type":"boolean"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"maxUses":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"oncePerClient":{"type":"boolean"},"used":{"type":"boolean"},"uses":{"minimum":0,"type":"integer"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","discount","currency","validUntil","oncePerClient","maxUses","uses","used","minimumAmount","appliesTo","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a01","name":"Black Friday","code":"BF2026","discount":{"type":"amount","value":"1000.00"},"currency":"UAH","validUntil":"2026-11-30","oncePerClient":true,"maxUses":100,"uses":12,"used":true,"minimumAmount":"20000.00","appliesTo":null,"archived":true,"version":3,"createdAt":"2026-10-20T08:15:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/coupons/{couponId}/restore":{"post":{"operationId":"restoreCoupon","security":[{"bearerAuth":[]}],"summary":"Вернуть купон из архива","parameters":[{"in":"path","name":"couponId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Пока купон был в архиве, его код взял другой действующий купон — `409 NAME_TAKEN`. Действующий ещё раз ничего не меняет.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliesTo":{"anyOf":[{"additionalProperties":false,"properties":{"categoryIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"items":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"kind":{"enum":["product","category"],"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"],"type":"object"},"type":"array"},"productIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["productIds","categoryIds","items"],"type":"object"},{"type":"null"}]},"archived":{"type":"boolean"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"anyOf":[{"pattern":"^[A-Z]{3}$","type":"string"},{"type":"null"}]},"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of what is left of the deal (`percent`) or an amount of the coupon’s currency (`amount`)","enum":["percent","amount"],"type":"string"},"value":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"}},"required":["type","value"],"type":"object"},"id":{"format":"uuid","type":"string"},"maxUses":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"minimumAmount":{"anyOf":[{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},{"type":"null"}]},"name":{"type":"string"},"oncePerClient":{"type":"boolean"},"used":{"type":"boolean"},"uses":{"minimum":0,"type":"integer"},"validUntil":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","discount","currency","validUntil","oncePerClient","maxUses","uses","used","minimumAmount","appliesTo","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000a01","name":"Black Friday","code":"BF2026","discount":{"type":"amount","value":"1000.00"},"currency":"UAH","validUntil":"2026-11-30","oncePerClient":true,"maxUses":100,"uses":12,"used":true,"minimumAmount":"20000.00","appliesTo":null,"archived":false,"version":4,"createdAt":"2026-10-20T08:15:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/product-categories":{"get":{"operationId":"listProductCategories","security":[{"bearerAuth":[]}],"summary":"Группы товаров","parameters":[],"description":"Группы товаров организации по названию (не больше 200). Читает роль с разделом «Сделки» или страницей «Товары».","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","version"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000064","name":"Кофемашины","version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000065","name":"Сервис","version":1}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createProductCategory","security":[{"bearerAuth":[]}],"summary":"Создать группу товаров","parameters":[],"description":"Название уникально в организации без учёта регистра: занятое — `409 NAME_TAKEN`. Нужна страница «Товары» в роли. Повтор с тем же `idempotencyKey` после потерянного ответа вернёт уже созданную группу.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"name":{"maxLength":60,"minLength":1,"pattern":"\\S","type":"string"}},"required":["name"],"type":"object"},"example":{"name":"Кофемашины"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000064","name":"Кофемашины","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/product-categories/{categoryId}":{"patch":{"operationId":"updateProductCategory","security":[{"bearerAuth":[]}],"summary":"Переименовать группу товаров","parameters":[{"in":"path","name":"categoryId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"С `version`, которую вы прочитали: группу успели изменить — `409`. Без `version` новое название ложится на группу, какая она сейчас.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"name":{"maxLength":60,"minLength":1,"pattern":"\\S","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["name"],"type":"object"},"example":{"name":"Кофемашины","version":1}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000064","name":"Кофемашины","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"deleteProductCategory","security":[{"bearerAuth":[]}],"summary":"Удалить группу товаров","parameters":[{"in":"path","name":"categoryId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Только группу, в которой нет товаров, в том числе архивных: иначе `409 category_in_use` — сначала перенесите товары. Группа, на которую нацелен купон, — `409 category_in_coupon`: сначала уберите её из купона.","tags":["Товары"],"responses":{"204":{"description":"Успешный ответ, без тела.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/products":{"get":{"operationId":"listProducts","security":[{"bearerAuth":[]}],"summary":"Товары","parameters":[{"in":"query","name":"archived","required":false,"schema":{"default":false,"type":"boolean"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"q","required":false,"schema":{"maxLength":200,"type":"string"}}],"description":"Товары страницами (`limit`, `cursor`), действующие или архивные (`archived`). Без `q` — по группам (группы по названию, товары без группы в конце), в группе по названию. С `q` — по названию: товары, в названии или артикуле которых есть слова, начинающиеся с каждого слова `q` (до 5 слов от 2 символов или число); совпало больше 2 000 — страницы покажут 2 000 из них и `truncated: true`, уточните `q`. У каждого — действующие цены и значения своих полей. Суммы — в копейках (`*Cents`).","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"prices":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"type":"array"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","unit","description","categoryId","archivedAt","version","prices","customFields"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"truncated":{"type":"boolean"}},"required":["items","nextCursor","truncated"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Кофемашина Jura E8","code":"JE8-01","unit":"шт","description":"Автоматическая, для зёрен и молока","categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000064","archivedAt":null,"version":1,"prices":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000068","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Розница","currency":"UAH","isDefault":true,"amountCents":4500000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}],"customFields":[]},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000067","name":"Сервис кофемашины на год","code":null,"unit":"год","description":null,"categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000065","archivedAt":null,"version":1,"prices":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000006a","productId":"0192f3a1-7c2e-7b4d-9a61-000000000067","name":"Розница","currency":"UAH","isDefault":false,"amountCents":600000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006d","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}],"customFields":[]}],"nextCursor":null,"truncated":false}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createProduct","security":[{"bearerAuth":[]}],"summary":"Создать товар","parameters":[],"description":"Достаточно названия. Артикул (`code`) необязателен и уникален среди действующих товаров без учёта регистра: занятый — `409 NAME_TAKEN` в `/body/code`. Названия не уникальны. Сразу можно передать до 20 цен (`prices`), ни одна из них не становится основной (основную отмечают в изменении цены); без цен тоже можно, если вы считаете цену в каждой сделке. Повтор с тем же `idempotencyKey` после потерянного ответа вернёт уже созданный товар, тот же ключ с другими данными — `409 idempotency_key_reused`.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"maxLength":60,"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]}},"required":["fieldId","value"],"type":"object"},"maxItems":100,"type":"array"},"description":{"anyOf":[{"maxLength":1000,"type":"string"},{"type":"null"}]},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"name":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"prices":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"name":{"maxLength":60,"minLength":1,"pattern":"\\S","type":"string"}},"required":["name","currency","amountCents"],"type":"object"},"maxItems":20,"type":"array"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"maxLength":20,"type":"string"},{"type":"null"}]}},"required":["name"],"type":"object"},"example":{"name":"Кофемашина Jura E8","code":"JE8-01","unit":"шт","description":"Автоматическая, для зёрен и молока","categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000064","prices":[{"name":"Розница","currency":"UAH","amountCents":4500000},{"name":"Опт","currency":"UAH","amountCents":4200000}]}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"prices":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"type":"array"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","unit","description","categoryId","archivedAt","version","prices","customFields"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Кофемашина Jura E8","code":"JE8-01","unit":"шт","description":"Автоматическая, для зёрен и молока","categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000064","archivedAt":null,"version":1,"prices":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000068","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Розница","currency":"UAH","isDefault":false,"amountCents":4500000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}],"customFields":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/products/{productId}":{"get":{"operationId":"getProduct","security":[{"bearerAuth":[]}],"summary":"Получить товар","parameters":[{"in":"path","name":"productId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Один товар, действующий или архивный, с ценами и значениями своих полей.","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"prices":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"type":"array"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","unit","description","categoryId","archivedAt","version","prices","customFields"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Кофемашина Jura E8","code":"JE8-01","unit":"шт","description":"Автоматическая, для зёрен и молока","categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000064","archivedAt":null,"version":1,"prices":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000068","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Розница","currency":"UAH","isDefault":true,"amountCents":4500000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}],"customFields":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"patch":{"operationId":"updateProduct","security":[{"bearerAuth":[]}],"summary":"Изменить товар","parameters":[{"in":"path","name":"productId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Название, артикул (`null` убирает), единица, описание, группа (`null` — без группы) и значения своих полей. С `version`, которую вы прочитали, чужая правка за это время — `409`; без `version` изменение ложится на товар, какой он сейчас. Цены меняются своими запросами.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"maxLength":60,"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]}},"required":["fieldId","value"],"type":"object"},"maxItems":100,"type":"array"},"description":{"anyOf":[{"maxLength":1000,"type":"string"},{"type":"null"}]},"name":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"maxLength":20,"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"unit":"шт","version":1}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"prices":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"type":"array"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","unit","description","categoryId","archivedAt","version","prices","customFields"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Кофемашина Jura E8","code":"JE8-01","unit":"шт","description":"Автоматическая, для зёрен и молока","categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000064","archivedAt":null,"version":2,"prices":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000068","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Розница","currency":"UAH","isDefault":true,"amountCents":4500000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}],"customFields":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/products/{productId}/archive":{"post":{"operationId":"archiveProduct","security":[{"bearerAuth":[]}],"summary":"В архив","parameters":[{"in":"path","name":"productId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Товар уходит из предложения, его цены остаются как были, артикул освобождается. Товар не удаляется: на него ссылается то, что по нему продано.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"prices":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"type":"array"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","unit","description","categoryId","archivedAt","version","prices","customFields"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Кофемашина Jura E8","code":"JE8-01","unit":"шт","description":"Автоматическая, для зёрен и молока","categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000064","archivedAt":"2026-10-24T16:45:00Z","version":2,"prices":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000068","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Розница","currency":"UAH","isDefault":true,"amountCents":4500000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}],"customFields":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/products/{productId}/prices":{"post":{"operationId":"createProductPrice","security":[{"bearerAuth":[]}],"summary":"Добавить цену","parameters":[{"in":"path","name":"productId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Название (уникально среди действующих цен товара), валюта и сумма в копейках; 0 — тоже цена. Основной у товара может и не быть: `isDefault: true` делает основной новую цену (прежняя перестаёт ею быть), без него цена не основная, первая тоже. Повтор с тем же `idempotencyKey` вернёт уже добавленную цену.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"isDefault":{"type":"boolean"},"name":{"maxLength":60,"minLength":1,"pattern":"\\S","type":"string"}},"required":["name","currency","amountCents"],"type":"object"},"example":{"name":"Опт","currency":"UAH","amountCents":4200000}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/products/{productId}/prices/{priceId}":{"patch":{"operationId":"updateProductPrice","security":[{"bearerAuth":[]}],"summary":"Изменить цену","parameters":[{"in":"path","name":"productId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"priceId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Новое название, новая сумма или отметка «основная»: `isDefault: true` ставит её (прежняя основная перестаёт ею быть), `isDefault: false` снимает, и у товара не остаётся основной; `version` необязательна, как в изменении товара. Новая сумма действует с этой минуты (`rateId` меняется), прежняя остаётся для того, что по ней продано. Архивную цену не меняют — `409 price_archived`.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"isDefault":{"type":"boolean"},"name":{"maxLength":60,"minLength":1,"pattern":"\\S","type":"string"},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"amountCents":4700000,"version":1}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000068","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Розница","currency":"UAH","isDefault":true,"amountCents":4700000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006e","effectiveFrom":"2026-10-24T16:45:00Z","archivedAt":null,"version":2}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/products/{productId}/prices/{priceId}/archive":{"post":{"operationId":"archiveProductPrice","security":[{"bearerAuth":[]}],"summary":"Цену — в архив","parameters":[{"in":"path","name":"productId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"priceId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"`defaultPriceId` (необязательно) — действующая цена, которая станет основной. Основная цена без него уходит в архив одна, и у товара не остаётся основной. Последнюю цену можно архивировать — товар останется без цен.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"defaultPriceId":{"format":"uuid","type":"string"}},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":"2026-10-24T16:45:00Z","version":2}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/products/{productId}/unarchive":{"post":{"operationId":"unarchiveProduct","security":[{"bearerAuth":[]}],"summary":"Вернуть из архива","parameters":[{"in":"path","name":"productId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Если артикул за это время занял другой действующий товар — `409 NAME_TAKEN`: сначала смените один из артикулов.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"categoryId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"prices":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"archivedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"currency":{"type":"string"},"effectiveFrom":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"isDefault":{"type":"boolean"},"name":{"type":"string"},"productId":{"format":"uuid","type":"string"},"rateId":{"format":"uuid","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","productId","name","currency","isDefault","amountCents","rateId","effectiveFrom","archivedAt","version"],"type":"object"},"type":"array"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"unit":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","code","unit","description","categoryId","archivedAt","version","prices","customFields"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Кофемашина Jura E8","code":"JE8-01","unit":"шт","description":"Автоматическая, для зёрен и молока","categoryId":"0192f3a1-7c2e-7b4d-9a61-000000000064","archivedAt":null,"version":3,"prices":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000068","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Розница","currency":"UAH","isDefault":true,"amountCents":4500000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006b","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000069","productId":"0192f3a1-7c2e-7b4d-9a61-000000000066","name":"Опт","currency":"UAH","isDefault":false,"amountCents":4200000,"rateId":"0192f3a1-7c2e-7b4d-9a61-00000000006c","effectiveFrom":"2026-10-20T08:15:00Z","archivedAt":null,"version":1}],"customFields":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tax-rates":{"get":{"operationId":"listTaxRates","security":[{"bearerAuth":[]}],"summary":"Налоги","parameters":[{"in":"query","name":"archived","required":false,"schema":{"default":false,"type":"boolean"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}}],"description":"Ставки налога организации страницами (`limit`, `cursor`) по названию, действующие или архивные (`archived`): название, как его печатают в счёте, ставка в процентах с двумя знаками и брала ли её хоть одна строка сделки, ссылка на оплату или счёт (`used`). Читает роль с разделом «Сделки» или страницей «Товары».","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"used":{"type":"boolean"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","rate","used","archived","version","createdAt"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000c02","name":"Звільнено","rate":"0.00","used":false,"archived":false,"version":1,"createdAt":"2026-10-24T16:45:00Z"},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000c01","name":"ПДВ 20 %","rate":"20.00","used":true,"archived":false,"version":1,"createdAt":"2026-10-20T08:15:00Z"}],"nextCursor":null}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createTaxRate","security":[{"bearerAuth":[]}],"summary":"Создать налог","parameters":[],"description":"Нужна страница «Товары» в роли. Название (занятое действующей ставкой без учёта регистра — `409 NAME_TAKEN`) и ставка в процентах от 0 до 100, не больше двух знаков (0 — освобождение со своим названием). С первой ставкой у организации появляется продавец (`GET /billing-entities`), чтобы задать ему «Цены включают налог» и ставку по умолчанию. Повтор с тем же `idempotencyKey` после потерянного ответа вернёт ту же ставку.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"name":{"description":"As documents print it: «ПДВ 20 %», «Звільнено»","maxLength":100,"minLength":1,"pattern":"\\S","type":"string"},"rate":{"anyOf":[{"pattern":"^[0-9]{1,3}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":100,"minimum":0,"type":"number"}],"description":"A percent from 0 (a named exemption) to 100, with up to two decimals"}},"required":["name","rate"],"type":"object"},"example":{"name":"Звільнено","rate":"0"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"used":{"type":"boolean"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","rate","used","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000c02","name":"Звільнено","rate":"0.00","used":false,"archived":false,"version":1,"createdAt":"2026-10-24T16:45:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tax-rates/{taxRateId}":{"get":{"operationId":"getTaxRate","security":[{"bearerAuth":[]}],"summary":"Получить налог","parameters":[{"in":"path","name":"taxRateId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Одна ставка, действующая или архивная; ставка другой организации — `404`.","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"used":{"type":"boolean"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","rate","used","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000c01","name":"ПДВ 20 %","rate":"20.00","used":true,"archived":false,"version":1,"createdAt":"2026-10-20T08:15:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"patch":{"operationId":"updateTaxRate","security":[{"bearerAuth":[]}],"summary":"Изменить налог","parameters":[{"in":"path","name":"taxRateId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Название меняется всегда; ставка — пока её не взяла ни одна строка сделки, ссылка на оплату или счёт, иначе `409 tax_rate_used`: другая ставка — новый налог. Строка, уже стоящая в сделке, сохраняет ставку, которую взяла. Поле, которое не прислали, остаётся. С `version`, которую вы прочитали: ставку успели изменить — `409`.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"name":{"description":"As documents print it: «ПДВ 20 %», «Звільнено»","maxLength":100,"minLength":1,"pattern":"\\S","type":"string"},"rate":{"anyOf":[{"pattern":"^[0-9]{1,3}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":100,"minimum":0,"type":"number"}],"description":"A percent from 0 (a named exemption) to 100, with up to two decimals"},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"name":"ПДВ 20 % (основна)"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"used":{"type":"boolean"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","rate","used","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000c01","name":"ПДВ 20 % (основна)","rate":"20.00","used":true,"archived":false,"version":2,"createdAt":"2026-10-20T08:15:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"delete":{"operationId":"deleteTaxRate","security":[{"bearerAuth":[]}],"summary":"Удалить налог","parameters":[{"in":"path","name":"taxRateId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Только ставку, которую ничего не брало; взятая — `409 tax_rate_used` (отправьте её в архив), ставка продавца или товара — `409 tax_rate_assigned`.","tags":["Товары"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"deleted":{"const":true,"type":"boolean"}},"required":["deleted"],"type":"object"},"example":{"deleted":true}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tax-rates/{taxRateId}/archive":{"post":{"operationId":"archiveTaxRate","security":[{"bearerAuth":[]}],"summary":"Налог в архив","parameters":[{"in":"path","name":"taxRateId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Ставку больше не выбирают для продавца и товаров; строки, ссылки и счета, которые её взяли, её сохраняют. Ставка продавца или товара — `409 tax_rate_assigned`: сначала выберите им другую.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"used":{"type":"boolean"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","rate","used","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000c02","name":"Звільнено","rate":"0.00","used":false,"archived":true,"version":2,"createdAt":"2026-10-24T16:45:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tax-rates/{taxRateId}/restore":{"post":{"operationId":"restoreTaxRate","security":[{"bearerAuth":[]}],"summary":"Вернуть налог из архива","parameters":[{"in":"path","name":"taxRateId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Пока ставка была в архиве, её название взяла другая действующая ставка — `409 NAME_TAKEN`. Действующая ещё раз ничего не меняет.","tags":["Товары"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"createdAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"used":{"type":"boolean"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","rate","used","archived","version","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000c02","name":"Звільнено","rate":"0.00","used":false,"archived":false,"version":3,"createdAt":"2026-10-24T16:45:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/billing-entities":{"get":{"operationId":"listBillingEntities","security":[{"bearerAuth":[]}],"summary":"Плательщики счетов","parameters":[],"description":"Кто выставляет счета организации: префикс и нумерация номеров, срок оплаты, валюта и часовой пояс. Только чтение; `main` появляется с первым счётом.","tags":["Оплаты"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"code":{"type":"string"},"defaultCurrency":{"pattern":"^[A-Z]{3}$","type":"string"},"documentNumberPrefix":{"type":"string"},"documentNumbering":{"enum":["per_customer","per_billing_entity"],"type":"string"},"id":{"format":"uuid","type":"string"},"legalName":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"netPaymentTerm":{"minimum":0,"type":"integer"},"pricesIncludeTax":{"type":"boolean"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"timezone":{"type":"string"}},"required":["id","code","name","legalName","documentNumberPrefix","documentNumbering","netPaymentTerm","defaultCurrency","timezone","pricesIncludeTax","taxRateId"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b0","code":"main","name":"ООО «Кофейная гильдия»","legalName":null,"documentNumberPrefix":"KAV","documentNumbering":"per_billing_entity","netPaymentTerm":0,"defaultCurrency":"UAH","timezone":"Europe/Kyiv","pricesIncludeTax":true,"taxRateId":"0192f3a1-7c2e-7b4d-9a61-000000000c01"}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/billing-entities/{billingEntityId}":{"patch":{"operationId":"updateBillingEntity","security":[{"bearerAuth":[]}],"summary":"Налоги продавца","parameters":[{"in":"path","name":"billingEntityId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Нужна страница «Товары» в роли. `pricesIncludeTax` — «Цены включают налог»: налог выделяется из цены строки, иначе добавляется сверху и сумма сделки растёт на него; `taxRateId` — ставка по умолчанию, которую берёт строка товара без своей ставки (`null` — без неё). Касается строк, которые добавят после изменения: строка, уже стоящая в сделке, сохраняет свой налог. Поле, которое не прислали, остаётся. Ставки нет — `400`, ставка в архиве — `409 tax_rate_archived`. Пока счета всех сделок выставляет продавец `main`, другой продавец — `409 only_main_seller`.","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"pricesIncludeTax":{"type":"boolean"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"type":"object"},"example":{"pricesIncludeTax":true,"taxRateId":"0192f3a1-7c2e-7b4d-9a61-000000000c01"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"code":{"type":"string"},"defaultCurrency":{"pattern":"^[A-Z]{3}$","type":"string"},"documentNumberPrefix":{"type":"string"},"documentNumbering":{"enum":["per_customer","per_billing_entity"],"type":"string"},"id":{"format":"uuid","type":"string"},"legalName":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"netPaymentTerm":{"minimum":0,"type":"integer"},"pricesIncludeTax":{"type":"boolean"},"taxRateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"timezone":{"type":"string"}},"required":["id","code","name","legalName","documentNumberPrefix","documentNumbering","netPaymentTerm","defaultCurrency","timezone","pricesIncludeTax","taxRateId"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b0","code":"main","name":"ООО «Кофейная гильдия»","legalName":null,"documentNumberPrefix":"KAV","documentNumbering":"per_billing_entity","netPaymentTerm":0,"defaultCurrency":"UAH","timezone":"Europe/Kyiv","pricesIncludeTax":true,"taxRateId":"0192f3a1-7c2e-7b4d-9a61-000000000c01"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/invoices":{"get":{"operationId":"listDealInvoices","security":[{"bearerAuth":[]}],"summary":"Счета сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Счета сделки, новые сверху, со строками, оплатами (отменённая остаётся — `failed`) и возвратами; сколько осталось оплатить и просрочен ли. `totals` — итоги по валютам. Платёж частями — это счёт в статусе `pending` с датой `paymentDueDate`. Суммы — в копейках (`*Cents`).","tags":["Оплаты"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"type":"array"},"totals":{"items":{"additionalProperties":false,"properties":{"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"}},"required":["currency","totalAmountCents","totalPaidAmountCents","totalRefundedAmountCents","totalDueAmountCents"],"type":"object"},"type":"array"}},"required":["items","totals"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b2","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-002","invoiceType":"one_off","status":"finalized","paymentStatus":"pending","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-30","netPaymentTerm":7,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":0,"totalDueAmountCents":600000,"totalRefundedAmountCents":0,"voidedAt":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":null,"paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":1,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b5","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[],"createdAt":"2026-10-23T10:30:00Z"},{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b1","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-001","invoiceType":"one_off","status":"finalized","paymentStatus":"succeeded","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-23","netPaymentTerm":0,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":600000,"totalDueAmountCents":0,"totalRefundedAmountCents":0,"voidedAt":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":1,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b4","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","paymentType":"manual","paymentStatus":"succeeded","amountCents":600000,"currency":"UAH","paidAt":"2026-10-23T10:30:00Z","reference":"deal:1042","orderReference":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"canceledAt":null,"cancelReason":null,"refundableAmountCents":600000,"refunds":[],"source":"alta","version":1,"createdAt":"2026-10-23T10:30:00Z"}],"createdAt":"2026-10-23T10:30:00Z"}],"totals":[{"currency":"UAH","totalAmountCents":1200000,"totalPaidAmountCents":600000,"totalRefundedAmountCents":0,"totalDueAmountCents":600000}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}},"post":{"operationId":"createDealInvoice","security":[{"bearerAuth":[]}],"summary":"Выставить счёт","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Строки (`fees`) или одна сумма (`amountCents`, строка с названием сделки), валюта, дата оплаты (`paymentDueDate`; без неё — сразу). С `payment` счёт сразу оплачен целиком — это «Записать оплату» в один клик; `payment.paidAt` не в будущем (`400`). Сделка в корзине — `409`. `idempotencyKey` делает повтор безопасным. В `payment.orderReference` — ваш номер заказа: в организации один заказ — одна оплата, кто бы её ни записал (API, платёжный сервис, сверка, импорт). У заказа уже есть оплата на этой сделке — ответ `201` со счётом той оплаты, второй не будет; повтор безопасен, даже когда `idempotencyKey` равен `orderReference`. Вы важнее импорта и догадки по телефону: оплату от платёжного сервиса, которую по телефону или e-mail положило на другую сделку или которая ждёт в «Неразобранных оплатах», а также оплату, которую импорт записал на другую сделку, перенесём на эту сделку, и именно на неё лягут его возвраты. На другой сделке останется аннулированный счёт без денег и две строки истории: её итоги такие, будто оплаты там не было; следующие шаги импорта её не вернут. Оплату к другой сделке привязал человек — `409 order_linked_by_person`; её уже записали на другую сделку через API, положила туда ссылка на оплату или номер сделки в заказе, на сделку, которую вы не можете менять, или сделка в корзине — `409 order_on_another_deal`, так что устаревший запрос не вернёт оплату обратно; на ней уже есть возврат — `409 order_refunded_on_another_deal`. Сумма оплаты остаётся такой, как записана впервые. Другой запрос записал этот же заказ в ту же секунду — `409 order_taken`; оплату заказа в ту же секунду отменили — `409 order_payment_canceled`. Оба ответа можно повторить: тот же запрос ещё раз получит ответ по правилу. «Обязательно при оплате» останавливает только оплату, которую записывает человек в Alta: оплату через API не останавливает. Значения таких полей можно передать в `customFields` — они запишутся в сделку вместе с оплатой. Сумма (`amountCents`), равная итогу выбранных строк сделки до её купонов и скидки, пока они на этих строках есть, — `409 stale_client_reload`: окно открыто до скидок, обновите страницу. `manualDiscount` («Скидка на всё») — скидка сделки на всю сделку с этого момента, `percent` (больше 0, не больше 100) от того, что осталось от сделки, или `amount` в её валюте; `null` её снимает. Записывается в сделку при выставлении, после скидок строк и товаров окна и до того, как счёт берёт строки, как её пишет `PUT /deals/{dealId}/discounts/manual`: делится по строкам самой сделки (товар только этой оплаты доли не получает), в пределах «Максимальной скидки, %» роли (`403 discount_above_role_cap`), с правом «Менять цену в сделке» (`403`; скидка сделки, отправленная как есть, права не спрашивает); `409 imported_lines`, `amount_kept_by_sync`, `amount_not_from_products`. Повтор с тем же ключом второй раз её не пишет.","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":1,"type":"integer"},"comment":{"anyOf":[{"maxLength":1000,"type":"string"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]}},"required":["fieldId","value"],"type":"object"},"maxItems":100,"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"description":{"anyOf":[{"maxLength":1000,"type":"string"},{"type":"null"}]},"invoiceDisplayName":{"maxLength":200,"type":"string"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"units":{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,6})?$","type":"string"}},"required":["unitAmountCents"],"type":"object"},"maxItems":100,"minItems":1,"type":"array"},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"manualDiscount":{"anyOf":[{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"payment":{"anyOf":[{"additionalProperties":false,"properties":{"orderReference":{"maxLength":200,"minLength":1,"pattern":"^(?=.*\\S)[^\\u0000-\\u001f\\u007f-\\u009f]+$","type":"string"},"paidAt":{"format":"date-time","type":"string"}},"type":"object"},{"type":"null"}]},"paymentDueDate":{"anyOf":[{"format":"date","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]}},"required":["fieldId","value"],"type":"object"},"maxItems":100,"type":"array"},"productLineDiscounts":{"description":"A discount given in the payment window to the deal's lines it is for, each line once (another time is 400 `duplicate_product_line` at its place): `discount`, per unit, a `percent` (more than 0, at most 100) or an `amount` of the line's currency (more than 0), off the line's own price before its discount, is the line's discount from now on (`null`: none), as PATCH /deals/{dealId}/products/{lineId} takes it with `discount`. A line that is not among the lines the payment is for (`productLineIds`) is 400 `product_line_not_chosen` at its place; giving, changing or taking off a discount needs deals.price (403 otherwise), one left as it is asks nothing; a line another system recorded is 409 imported_line, a discount given on a deal whose amount another system's import writes 409 amount_kept_by_sync. The payment takes the line at its new price, and the line itself takes it (its history, the deal's amount following) in the same transaction, only when this call issues the payment: a repeat, and an order whose payment stands already, change no line","items":{"additionalProperties":false,"properties":{"discount":{"anyOf":[{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},{"type":"null"}]},"productLineId":{"format":"uuid","type":"string"}},"required":["productLineId","discount"],"type":"object"},"maxItems":500,"type":"array"},"productLineIds":{"description":"Which of the deal's product lines the invoice bills, by their ids (`GET /deals/{dealId}/products`): absent or `[]`, none. A line that is not this deal's is 400 `product_line_not_found` at its place. Each is copied as it is now: its name, quantity, unit price, product and the rate it sold at","items":{"format":"uuid","type":"string"},"maxItems":500,"type":"array","uniqueItems":true},"products":{"description":"Products of the catalog sold with it, besides the deal's lines (`productLineIds`), each in the deal's currency: `priceId` one of its prices there (absent: the one the catalog offers first there), `quantity` (default 1), or `price`, a unit price of one's own (permission deals.price, 403 otherwise); `discount` (optional, permission deals.price, else 403), per unit, a `percent` (more than 0, at most 100) or an `amount` of the deal's currency (more than 0) off that price, as POST /deals/{dealId}/products takes it: the product sells at that price less the discount, rounded half up to the cent and never below 0 (409 amount_kept_by_sync on a deal whose amount another system's import writes). A product that is not the organization's is 400 `product_not_found` at its place; an archived one 409 `product_archived`; no price in the deal's currency and none typed 409 `no_price_in_currency`. When the organization's «Товар при оплате» says a product chosen at payment is added to the deal's products, each becomes a line of the deal in the same transaction (its amount following, its history), with its discount, unless the deal holds another system's lines","items":{"additionalProperties":false,"properties":{"discount":{"additionalProperties":false,"properties":{"type":{"description":"A percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit","enum":["percent","amount"],"type":"string"},"value":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]}},"required":["type","value"],"type":"object"},"price":{"anyOf":[{"pattern":"^[0-9]{1,12}(\\.[0-9]{1,2})?$","type":"string"},{"maximum":999999999999.99,"minimum":0,"type":"number"}]},"priceId":{"format":"uuid","type":"string"},"productId":{"format":"uuid","type":"string"},"quantity":{"anyOf":[{"pattern":"^[0-9]{1,8}(\\.[0-9]{1,3})?$","type":"string"},{"exclusiveMinimum":0,"maximum":99999999.999,"type":"number"}]}},"required":["productId"],"type":"object"},"maxItems":100,"type":"array"},"taxAware":{"description":"The client knows the deal lines' taxes added on top (ADR-0032 stage 4): an amount equal to the named lines' total without them is a part it means, never taken for a window opened before taxes (409 stale_client_reload otherwise)","type":"boolean"}},"required":["currency","idempotencyKey"],"type":"object"},"example":{"currency":"UAH","amountCents":600000,"payment":{"paidAt":"2026-10-23T10:30:00Z","orderReference":"ORDER-20431"},"methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","idempotencyKey":"6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b1","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-001","invoiceType":"one_off","status":"finalized","paymentStatus":"succeeded","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-23","netPaymentTerm":0,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":600000,"totalDueAmountCents":0,"totalRefundedAmountCents":0,"voidedAt":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":1,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b4","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","paymentType":"manual","paymentStatus":"succeeded","amountCents":600000,"currency":"UAH","paidAt":"2026-10-23T10:30:00Z","reference":"deal:1042","orderReference":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"canceledAt":null,"cancelReason":null,"refundableAmountCents":600000,"refunds":[],"source":"alta","version":1,"createdAt":"2026-10-23T10:30:00Z"}],"createdAt":"2026-10-23T10:30:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/invoices/{invoiceId}":{"get":{"operationId":"getInvoice","security":[{"bearerAuth":[]}],"summary":"Получить счёт","parameters":[{"in":"path","name":"invoiceId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Один счёт сделки со строками, оплатами и возвратами.","tags":["Оплаты"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b1","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-001","invoiceType":"one_off","status":"finalized","paymentStatus":"succeeded","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-23","netPaymentTerm":0,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":600000,"totalDueAmountCents":0,"totalRefundedAmountCents":0,"voidedAt":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":1,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b4","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","paymentType":"manual","paymentStatus":"succeeded","amountCents":600000,"currency":"UAH","paidAt":"2026-10-23T10:30:00Z","reference":"deal:1042","orderReference":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"canceledAt":null,"cancelReason":null,"refundableAmountCents":600000,"refunds":[],"source":"alta","version":1,"createdAt":"2026-10-23T10:30:00Z"}],"createdAt":"2026-10-23T10:30:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/invoices/{invoiceId}/payments":{"post":{"operationId":"createInvoicePayment","security":[{"bearerAuth":[]}],"summary":"Оплатить счёт","parameters":[{"in":"path","name":"invoiceId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Ручная оплата счёта на всю сумму к оплате (`amountCents`): меньшая — `409 partial_payment_not_supported`, большая — `409 exceeds_amount_due`. `paidAt` — когда пришли деньги, не в будущем. `idempotencyKey` делает повтор безопасным. `orderReference` — ваш номер заказа: в организации один заказ — одна оплата, кто бы её ни записал (API, платёжный сервис, сверка, импорт). У заказа уже есть оплата на этой сделке — ответ `201` со счётом той оплаты, второй не будет; повтор безопасен, даже когда `idempotencyKey` равен `orderReference`. Вы важнее импорта и догадки по телефону: оплату от платёжного сервиса, которую по телефону или e-mail положило на другую сделку или которая ждёт в «Неразобранных оплатах», а также оплату, которую импорт записал на другую сделку, перенесём на эту сделку, и именно на неё лягут его возвраты. На другой сделке останется аннулированный счёт без денег и две строки истории: её итоги такие, будто оплаты там не было; следующие шаги импорта её не вернут. Оплату к другой сделке привязал человек — `409 order_linked_by_person`; её уже записали на другую сделку через API, положила туда ссылка на оплату или номер сделки в заказе, на сделку, которую вы не можете менять, или сделка в корзине — `409 order_on_another_deal`, так что устаревший запрос не вернёт оплату обратно; на ней уже есть возврат — `409 order_refunded_on_another_deal`. Сумма оплаты остаётся такой, как записана впервые. Счёт той же суммы, выставленный на этой сделке для этого заказа, аннулируется: он больше ничего не требует. Другой запрос записал этот же заказ в ту же секунду — `409 order_taken`; оплату заказа в ту же секунду отменили — `409 order_payment_canceled`. Оба ответа можно повторить: тот же запрос ещё раз получит ответ по правилу. «Обязательно при оплате» останавливает только оплату, которую записывает человек в Alta: оплату через API не останавливает. Значения таких полей можно передать в `customFields` — они запишутся в сделку вместе с оплатой.","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":1,"type":"integer"},"comment":{"anyOf":[{"maxLength":1000,"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]}},"required":["fieldId","value"],"type":"object"},"maxItems":100,"type":"array"},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"maxLength":200,"minLength":1,"pattern":"^(?=.*\\S)[^\\u0000-\\u001f\\u007f-\\u009f]+$","type":"string"},"paidAt":{"format":"date-time","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]}},"required":["fieldId","value"],"type":"object"},"maxItems":100,"type":"array"}},"required":["amountCents","paidAt","idempotencyKey"],"type":"object"},"example":{"amountCents":600000,"paidAt":"2026-10-24T16:45:00Z","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000049","orderReference":"ORDER-20431","idempotencyKey":"6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b2","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-002","invoiceType":"one_off","status":"finalized","paymentStatus":"succeeded","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-30","netPaymentTerm":7,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":600000,"totalDueAmountCents":0,"totalRefundedAmountCents":0,"voidedAt":null,"method":"Карта","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000049","comment":null,"paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":2,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b5","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","paymentType":"manual","paymentStatus":"succeeded","amountCents":600000,"currency":"UAH","paidAt":"2026-10-24T16:45:00Z","reference":"deal:1042","orderReference":"ORDER-20431","method":"Карта","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000049","comment":null,"paymentFields":[],"canceledAt":null,"cancelReason":null,"refundableAmountCents":600000,"refunds":[],"source":"alta","version":2,"createdAt":"2026-10-24T16:45:00Z"}],"createdAt":"2026-10-23T10:30:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/invoices/{invoiceId}/void":{"post":{"operationId":"voidInvoice","security":[{"bearerAuth":[]}],"summary":"Аннулировать счёт","parameters":[{"in":"path","name":"invoiceId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Только счёт, по которому ничего не оплачено: он остаётся с `voided` и больше ничего не требует. Оплаченный — `409 invoice_paid` (сначала отмените ошибочную оплату).","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b2","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-002","invoiceType":"one_off","status":"voided","paymentStatus":"pending","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-30","netPaymentTerm":7,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":0,"totalDueAmountCents":0,"totalRefundedAmountCents":0,"voidedAt":"2026-10-24T16:45:00Z","method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":null,"paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":2,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b5","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[],"createdAt":"2026-10-23T10:30:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/payment-methods":{"get":{"operationId":"listPaymentMethods","security":[{"bearerAuth":[]}],"summary":"Способы оплаты","parameters":[],"description":"Группы способов оплаты и сами способы: сначала активные, по названию.","tags":["Оплаты"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"groups":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","version"],"type":"object"},"type":"array"},"methods":{"items":{"additionalProperties":false,"properties":{"active":{"type":"boolean"},"bankFinanced":{"type":"boolean"},"groupId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"importedFrom":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","name","groupId","active","importedFrom","bankFinanced","version"],"type":"object"},"type":"array"}},"required":["groups","methods"],"type":"object"},"example":{"groups":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000046","name":"Безналичные","version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000047","name":"Наличные","version":1}],"methods":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000048","name":"Счёт в банке","groupId":"0192f3a1-7c2e-7b4d-9a61-000000000046","active":true,"bankFinanced":false,"importedFrom":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000049","name":"Карта","groupId":"0192f3a1-7c2e-7b4d-9a61-000000000046","active":true,"bankFinanced":false,"importedFrom":null,"version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-00000000004a","name":"Касса","groupId":"0192f3a1-7c2e-7b4d-9a61-000000000047","active":true,"bankFinanced":false,"importedFrom":null,"version":1}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/payments/{paymentId}":{"patch":{"operationId":"updatePayment","security":[{"bearerAuth":[]}],"summary":"Исправить оплату","parameters":[{"in":"path","name":"paymentId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Дата поступления, способ оплаты и комментарий оплаты, внесённой в Alta. С `version` изменение пройдёт, только если оплату не меняли после вашего чтения (иначе `409`). Импортированная — только для чтения.","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"comment":{"anyOf":[{"maxLength":1000,"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"paidAt":{"format":"date-time","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"anyOf":[{"maxLength":5000,"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array"},{"additionalProperties":false,"properties":{"amount":{"maxLength":40,"type":"string"},"currency":{"maxLength":3,"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"line":{"anyOf":[{"maxLength":600,"type":"string"},{"type":"null"}]},"postcode":{"anyOf":[{"maxLength":40,"type":"string"},{"type":"null"}]}},"type":"object"}]},{"type":"null"}]}},"required":["fieldId","value"],"type":"object"},"maxItems":100,"type":"array"},"version":{"minimum":1,"type":"integer"}},"type":"object"},"example":{"methodId":"0192f3a1-7c2e-7b4d-9a61-000000000049"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b1","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-001","invoiceType":"one_off","status":"finalized","paymentStatus":"succeeded","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-23","netPaymentTerm":0,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":600000,"totalDueAmountCents":0,"totalRefundedAmountCents":0,"voidedAt":null,"method":"Карта","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000049","comment":"Предоплата 50%","paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":2,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b4","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","paymentType":"manual","paymentStatus":"succeeded","amountCents":600000,"currency":"UAH","paidAt":"2026-10-23T10:30:00Z","reference":"deal:1042","orderReference":null,"method":"Карта","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000049","comment":"Предоплата 50%","paymentFields":[],"canceledAt":null,"cancelReason":null,"refundableAmountCents":600000,"refunds":[],"source":"alta","version":2,"createdAt":"2026-10-23T10:30:00Z"}],"createdAt":"2026-10-23T10:30:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/payments/{paymentId}/cancel":{"post":{"operationId":"cancelPayment","security":[{"bearerAuth":[]}],"summary":"Отменить ошибочную оплату","parameters":[{"in":"path","name":"paymentId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Ручную оплату, внесённую по ошибке, отменяют с причиной: она остаётся как `failed`, а счёт снова ждёт оплаты. Оплату с возвратами или импортированную не отменяют (`409`).","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"reason":{"maxLength":500,"minLength":1,"pattern":"\\S","type":"string"}},"required":["reason"],"type":"object"},"example":{"reason":"Возврат за одну позицию"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b1","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-001","invoiceType":"one_off","status":"finalized","paymentStatus":"pending","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-23","netPaymentTerm":0,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":0,"totalDueAmountCents":600000,"totalRefundedAmountCents":0,"voidedAt":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":2,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b4","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","paymentType":"manual","paymentStatus":"failed","amountCents":600000,"currency":"UAH","paidAt":"2026-10-23T10:30:00Z","reference":"deal:1042","orderReference":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"canceledAt":"2026-10-24T16:45:00Z","cancelReason":"Возврат за одну позицию","refundableAmountCents":0,"refunds":[],"source":"alta","version":2,"createdAt":"2026-10-23T10:30:00Z"}],"createdAt":"2026-10-23T10:30:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/payments/{paymentId}/credit":{"put":{"operationId":"setPaymentCredit","security":[{"bearerAuth":[]}],"summary":"Засчитать оплату","parameters":[{"in":"path","name":"paymentId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Кому засчитана оплата («Засчитано» под оплатой в сделке): по нему аналитика считает продажи сотрудников. Без этого оплата засчитана ответственному сделки на момент оплаты; если ответственного тогда не было — первому, кого назначат после, а до того никому (`pending`). Так внешняя система, которая записала оплату, засчитывает её тому, кто продал. `paymentId` — `id` оплаты в `payments` счёта (ответ «Выставить счёт», «Оплатить счёт» или «Счета сделки»), а не `paymentId` самого счёта. `member` — сотрудник: `memberId` — его `id` из «Сотрудников» (уволенный тоже: продажа остаётся его); `team` — группа без человека: `teamId` из «Групп сотрудников»; `automatic` — снова автоматически, и тогда в ответе `credit: null`, пока Alta не засчитает оплату заново. Засчитанное вручную остаётся, пока его не изменят или не вернут `automatic`. Пока засчитанное никто не менял, тот же запрос ещё раз ничего не меняет, поэтому повтор после потерянного ответа безопасен; но условия по версии нет, и поздний повтор перепишет то, что после вас исправил другой. Изменение — строка истории сделки от имени автора ключа. Нужен ключ с правом записи и право «Зачёт оплат» в роли автора ключа (по умолчанию оно есть у владельца и администратора), иначе — `403 FORBIDDEN`; оплата сделки, которую автор ключа не видит, — `404`, как несуществующая. Оплата не оплачена или отменена — `409 payment_not_paid`; сделка в корзине — `409`.","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"credit":{"anyOf":[{"additionalProperties":false,"properties":{"kind":{"const":"member","type":"string"},"memberId":{"format":"uuid","type":"string"}},"required":["kind","memberId"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"team","type":"string"},"teamId":{"format":"uuid","type":"string"}},"required":["kind","teamId"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"automatic","type":"string"}},"required":["kind"],"type":"object"}]}},"required":["credit"],"type":"object"},"example":{"credit":{"kind":"member","memberId":"0192f3a1-7c2e-7b4d-9a61-000000000002"}}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"credit":{"anyOf":[{"anyOf":[{"additionalProperties":false,"properties":{"kind":{"const":"member","type":"string"},"member":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"team":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"type":"object"},{"type":"null"}]}},"required":["kind","member","team"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"team","type":"string"},"team":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name"],"type":"object"}},"required":["kind","team"],"type":"object"},{"additionalProperties":false,"properties":{"kind":{"const":"pending","type":"string"}},"required":["kind"],"type":"object"}]},{"type":"null"}]},"invoiceId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"manual":{"type":"boolean"},"paymentId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["paymentId","invoiceId","credit","manual"],"type":"object"},"example":{"paymentId":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","invoiceId":"0192f3a1-7c2e-7b4d-9a61-0000000000b1","credit":{"kind":"member","member":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"team":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000005c","name":"Киев"}},"manual":true}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/payments/{paymentId}/refunds":{"post":{"operationId":"createPaymentRefund","security":[{"bearerAuth":[]}],"summary":"Оформить возврат","parameters":[{"in":"path","name":"paymentId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Сумма в копейках — не больше остатка к возврату (`refundableAmountCents`), дата — между днём оплаты и сегодня, причина. Нужно право на возвраты; `idempotencyKey` делает повтор безопасным. `orderReference` говорит: это возврат того самого заказа в платёжном сервисе (`409 order_reference_mismatch`, когда оплата не этого заказа). Кто быстрее, тот и записывает: если сервис уже сообщил об этой сумме, ответ `201` и ничего нового, а если ваш запрос опередил следующий частичный возврат, его запишет сам сервис, и итог всегда равен тому, что он сообщил. Пример: сервис сообщил о 300 грн, вы присылаете те же 300 грн — возвратов остаётся 300 грн. Без `orderReference` это обычный возврат, например наличными.","tags":["Оплаты"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":1,"type":"integer"},"idempotencyKey":{"pattern":"^[\\x21-\\x7e]{1,255}$","type":"string"},"orderReference":{"maxLength":200,"minLength":1,"pattern":"^(?=.*\\S)[^\\u0000-\\u001f\\u007f-\\u009f]+$","type":"string"},"reason":{"anyOf":[{"maxLength":1000,"type":"string"},{"type":"null"}]},"refundedAt":{"format":"date-time","type":"string"}},"required":["amountCents","idempotencyKey"],"type":"object"},"example":{"amountCents":100000,"refundedAt":"2026-10-24T14:00:00Z","reason":"Возврат за одну позицию","orderReference":"ORDER-20431","idempotencyKey":"6f1c2a9e-3b7d-4e58-9c0a-5d4b3e2f1a07"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"appliedTaxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"billingEntityCode":{"type":"string"},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"couponsAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"dealId":{"format":"uuid","type":"string"},"declined":{"additionalProperties":false,"properties":{"reason":{"enum":["payer_canceled","refused","expired","withdrawn","insufficient_funds","card_velocity_exceeded","expired_card","incorrect_card_details","authentication_failed","issuer_declined","fraudulent","instalment_refused","processing_error"],"type":"string"}},"required":["reason"],"type":"object"},"discounts":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"kind":{"enum":["coupon","manual"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","name","amountCents"],"type":"object"},"type":"array"},"fees":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"invoiceDisplayName":{"anyOf":[{"type":"string"},{"type":"null"}]},"productId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"rateId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"taxes":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"baseAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"inclusive":{"type":"boolean"},"name":{"type":"string"},"rate":{"pattern":"^[0-9]{1,3}\\.[0-9]{2}$","type":"string"},"taxRateId":{"format":"uuid","type":"string"}},"required":["taxRateId","name","rate","inclusive","baseAmountCents","amountCents"],"type":"object"},"type":"array"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"unitAmountExcludingTax":{"pattern":"^[0-9]+(\\.[0-9]{1,6})?$","type":"string"},"units":{"type":"string"}},"required":["id","invoiceDisplayName","description","units","unitAmountCents","amountCents","taxesAmountCents"],"type":"object"},"type":"array"},"feesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"id":{"format":"uuid","type":"string"},"invoiceType":{"enum":["one_off","credit"],"type":"string"},"issuingDate":{"format":"date","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"netPaymentTerm":{"minimum":0,"type":"integer"},"number":{"type":"string"},"paymentDueDate":{"format":"date","type":"string"},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentId":{"format":"uuid","type":"string"},"paymentOverdue":{"type":"boolean"},"paymentStatus":{"enum":["pending","succeeded","failed"],"type":"string"},"payments":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"cancelReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"canceledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"comment":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"format":"date-time","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"id":{"format":"uuid","type":"string"},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"methodId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"paidAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"paymentFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"paymentStatus":{"enum":["pending","processing","succeeded","failed"],"type":"string"},"paymentType":{"enum":["manual","provider"],"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundableAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"refunds":{"items":{"additionalProperties":false,"properties":{"amountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"createdAt":{"format":"date-time","type":"string"},"createdBy":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"refundedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"status":{"enum":["pending","succeeded","failed"],"type":"string"}},"required":["id","amountCents","status","refundedAt","reason","createdBy","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","paymentType","paymentStatus","amountCents","currency","paidAt","reference","orderReference","method","methodId","comment","paymentFields","canceledAt","cancelReason","refundableAmountCents","refunds","source","version","createdAt"],"type":"object"},"type":"array"},"source":{"type":"string"},"status":{"enum":["draft","finalized","voided","failed","pending"],"type":"string"},"taxesAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalDueAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalPaidAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"totalRefundedAmountCents":{"maximum":9007199254740991,"minimum":0,"type":"integer"},"version":{"minimum":1,"type":"integer"},"voidedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["id","dealId","billingEntityCode","number","invoiceType","status","paymentStatus","paymentOverdue","issuingDate","paymentDueDate","netPaymentTerm","currency","feesAmountCents","taxesAmountCents","totalAmountCents","totalPaidAmountCents","totalDueAmountCents","totalRefundedAmountCents","voidedAt","method","methodId","comment","paymentFields","source","createdBy","version","fees","couponsAmountCents","discounts","payments","createdAt"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b1","dealId":"0192f3a1-7c2e-7b4d-9a61-000000000014","billingEntityCode":"main","number":"KAV-202610-001","invoiceType":"one_off","status":"finalized","paymentStatus":"succeeded","paymentOverdue":false,"issuingDate":"2026-10-23","paymentDueDate":"2026-10-23","netPaymentTerm":0,"currency":"UAH","feesAmountCents":600000,"taxesAmountCents":0,"totalAmountCents":600000,"totalPaidAmountCents":600000,"totalDueAmountCents":0,"totalRefundedAmountCents":100000,"voidedAt":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"source":"alta","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"version":1,"fees":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b4","invoiceDisplayName":"Кофемашины для сети кофеен","description":null,"units":"1","unitAmountCents":600000,"amountCents":600000,"taxesAmountCents":0}],"couponsAmountCents":0,"discounts":[],"payments":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","paymentType":"manual","paymentStatus":"succeeded","amountCents":600000,"currency":"UAH","paidAt":"2026-10-23T10:30:00Z","reference":"deal:1042","orderReference":null,"method":"Счёт в банке","methodId":"0192f3a1-7c2e-7b4d-9a61-000000000048","comment":"Предоплата 50%","paymentFields":[],"canceledAt":null,"cancelReason":null,"refundableAmountCents":500000,"refunds":[{"id":"0192f3a1-7c2e-7b4d-9a61-0000000000b6","amountCents":100000,"status":"succeeded","refundedAt":"2026-10-24T14:00:00Z","reason":"Возврат за одну позицию","createdBy":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000001","name":"Андрей Шевченко"},"createdAt":"2026-10-24T14:00:00Z"}],"source":"alta","version":1,"createdAt":"2026-10-23T10:30:00Z"}],"createdAt":"2026-10-23T10:30:00Z"}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/activity-log":{"get":{"operationId":"listActivityLog","security":[{"bearerAuth":[]}],"summary":"Журнал событий","parameters":[{"in":"query","name":"actions","required":false,"schema":{"items":{"enum":["created","changed","stage","assigned","deleted","restored","completed","comment"],"type":"string"},"maxItems":8,"type":"array","uniqueItems":true}},{"in":"query","name":"actorGroups","required":false,"schema":{"items":{"enum":["import","automation","system"],"type":"string"},"maxItems":3,"type":"array","uniqueItems":true}},{"in":"query","name":"actorIds","required":false,"schema":{"items":{"format":"uuid","type":"string"},"maxItems":50,"type":"array","uniqueItems":true}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"field","required":false,"schema":{"pattern":"^(?:[A-Za-z]{1,40}|cf:[0-9a-fA-F-]{36})$","type":"string"}},{"in":"query","name":"from","required":false,"schema":{"format":"date-time","type":"string"}},{"in":"query","name":"kinds","required":false,"schema":{"items":{"enum":["deal","contact","company","task","settings","team","compensation"],"type":"string"},"maxItems":7,"type":"array","uniqueItems":true}},{"in":"query","name":"limit","required":false,"schema":{"default":50,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"to","required":false,"schema":{"format":"date-time","type":"string"}}],"description":"Все изменения в организации, новые сверху, страницами: сделки, контакты, компании и задачи, комментарии, настройки, команда, мотивация и выгрузки сделок — кто, когда, в какой записи и что изменил; импортированная история — с автором и временем из прежней системы. Фильтры: кто (`actorIds`, `actorGroups`), какие записи (`kinds`: `deal`, `contact`, `company`, `task`…), что произошло (`actions`), какое поле (`field`), период (`from`, `to`). История компаний и задач — здесь, с `kinds=company` или `kinds=task`.","tags":["История"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"actor":{"additionalProperties":false,"properties":{"former":{"type":"boolean"},"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"kind":{"enum":["member","automation","import","system"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["kind","id","name","former"],"type":"object"},"at":{"format":"date-time","type":"string"},"comment":{"anyOf":[{"additionalProperties":false,"properties":{"deleted":{"type":"boolean"},"preview":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["preview","deleted"],"type":"object"},{"type":"null"}]},"compensation":{"anyOf":[{"additionalProperties":false,"properties":{"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["plan_created","plan_changed","plan_archived","plan_restored","assignment_set","assignment_removed","start_date_set","settings_changed","adjustment_added","adjustment_canceled","payout_recorded","payout_canceled","period_closed","recalculated","role_created","role_changed","role_deleted"],"type":"string"},"member":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]}},"required":["event","member","attributes"],"type":"object"},{"type":"null"}]},"export":{"anyOf":[{"additionalProperties":false,"properties":{"deals":{"minimum":0,"type":"integer"},"format":{"enum":["xlsx","csv"],"type":"string"},"pipeline":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"scope":{"enum":["all","filter"],"type":"string"}},"required":["format","scope","deals","pipeline"],"type":"object"},{"type":"null"}]},"history":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},"to":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","moved","owner_changed","comment_edited","comment_deleted","deleted","restored","comment_pinned","comment_unpinned","payment_recorded","payment_changed","payment_canceled","payment_refunded","payment_requested","payment_request_paid","payment_request_expired","payment_request_canceled","payment_request_failed","payment_consent_given","payment_credit_changed","archived"],"type":"string"},"fields":{"items":{"enum":["title","description","contactId","companyId","expectedCloseDate"],"type":"string"},"type":"array"},"merge":{"additionalProperties":false,"properties":{"dropped":{"items":{"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"record":{"type":"string"},"value":{"type":"string"}},"required":["record","key","label","value"],"type":"object"},"maxItems":400,"type":"array"},"records":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","name"],"type":"object"},"maxItems":4,"type":"array"}},"required":["records","dropped"],"type":"object"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]}},"required":["from","to"],"type":"object"},{"type":"null"}]},"payment":{"additionalProperties":false,"properties":{"paymentId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"paymentRequestId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"refundId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["paymentId","refundId","paymentRequestId"],"type":"object"},"stage":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"status":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"enum":["open","won","lost"],"type":"string"},"to":{"enum":["open","won","lost"],"type":"string"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"via":{"anyOf":[{"enum":["manual","import","form"],"type":"string"},{"type":"null"}]}},"required":["event","via","stage","status","owner","amount","fields","summary","attributes"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"importedFrom":{"anyOf":[{"type":"string"},{"type":"null"}]},"kind":{"enum":["history","task","comment","settings","team","compensation","export"],"type":"string"},"record":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"state":{"enum":["live","archived","deleted"],"type":"string"},"title":{"type":"string"},"type":{"enum":["deal","contact","company","task","settings","team","compensation","export"],"type":"string"}},"required":["type","id","title","state"],"type":"object"},"settings":{"anyOf":[{"additionalProperties":false,"properties":{"area":{"enum":["organization","pipeline","field","currency_rate","access_role","currency_rate_auto_fill","marketing_spend","migration","payment_method","payment_method_group","tag","task_type","product","product_category","product_price","coupon","tax_rate","billing_entity"],"type":"string"},"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","deleted","archived","restored"],"type":"string"}},"required":["area","event","attributes"],"type":"object"},{"type":"null"}]},"task":{"anyOf":[{"additionalProperties":false,"properties":{"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","rescheduled","reassigned","completed","reopened","canceled","deleted","restored"],"type":"string"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"next":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"title":{"type":"string"}},"required":["id","title","dueAt"],"type":"object"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedule":{"anyOf":[{"additionalProperties":false,"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["reason","note"],"type":"object"},{"type":"null"}]},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","event","attributes","outcome","next","reschedule"],"type":"object"},{"type":"null"}]},"team":{"anyOf":[{"additionalProperties":false,"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"event":{"enum":["invitation_issued","invitation_revoked","invitation_accepted","membership_created","membership_disabled","membership_enabled","membership_role_changed","membership_dismissed","membership_restored","membership_renamed"],"type":"string"},"handedOverTo":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"member":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"role":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"type":"string"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"roleName":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromSystemKey":{"anyOf":[{"enum":["owner","admin","manager"],"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]},"toSystemKey":{"anyOf":[{"enum":["owner","admin","manager"],"type":"string"},{"type":"null"}]}},"required":["from","to","fromSystemKey","toSystemKey"],"type":"object"},{"type":"null"}]}},"required":["event","member","email","role","roleName","handedOverTo"],"type":"object"},{"type":"null"}]}},"required":["id","at","actor","importedFrom","record","kind","history","task","comment","settings","team","compensation","export"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"searchedTo":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]}},"required":["items","nextCursor","searchedTo"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000055","at":"2026-10-24T16:45:00Z","actor":{"kind":"member","id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник","former":false},"importedFrom":null,"record":{"type":"task","id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","state":"live"},"kind":"task","history":null,"task":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"event":"completed","attributes":[],"outcome":"call","next":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003d","title":"Отправить счёт","dueAt":"2026-10-29T09:00:00Z"},"reschedule":null},"comment":null,"settings":null,"team":null,"compensation":null,"export":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000056","at":"2026-10-22T09:05:00Z","actor":{"kind":"member","id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник","former":false},"importedFrom":null,"record":{"type":"deal","id":"0192f3a1-7c2e-7b4d-9a61-000000000014","title":"Кофемашины для сети кофеен","state":"live"},"kind":"comment","history":null,"task":null,"comment":{"preview":"Клиентка просит счёт до пятницы","deleted":false},"settings":null,"team":null,"compensation":null,"export":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000052","at":"2026-10-21T12:40:00Z","actor":{"kind":"member","id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник","former":false},"importedFrom":null,"record":{"type":"deal","id":"0192f3a1-7c2e-7b4d-9a61-000000000014","title":"Кофемашины для сети кофеен","state":"live"},"kind":"history","history":{"event":"moved","via":"manual","stage":{"from":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000001f","name":"Новый запрос"},"to":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000020","name":"Переговоры"}},"status":null,"owner":null,"amount":null,"fields":[],"summary":null,"attributes":[]},"task":null,"comment":null,"settings":null,"team":null,"compensation":null,"export":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000057","at":"2026-10-20T08:15:00Z","actor":{"kind":"member","id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник","former":false},"importedFrom":null,"record":{"type":"contact","id":"0192f3a1-7c2e-7b4d-9a61-00000000000a","title":"Елена Коваль","state":"live"},"kind":"history","history":{"event":"updated","via":"manual","stage":null,"status":null,"owner":null,"amount":null,"fields":[],"summary":null,"attributes":[{"key":"jobTitle","label":null,"from":null,"to":"Менеджер по закупкам","fieldType":null,"decimals":null}]},"task":null,"comment":null,"settings":null,"team":null,"compensation":null,"export":null}],"nextCursor":null,"searchedTo":null}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/contacts/{contactId}/activity":{"get":{"operationId":"listContactActivity","security":[{"bearerAuth":[]}],"summary":"История контакта","parameters":[{"in":"path","name":"contactId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":30,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"only","required":false,"schema":{"enum":["notes","history","tasks"],"type":"string"}}],"description":"Всё, что произошло с контактом, новые сверху, страницами: создание и каждое изменение полей и тегов (что было и что стало), комментарии, что произошло с его задачами. `only` оставляет одно: `notes`, `history` или `tasks`. Чаты и звонки через API недоступны.","tags":["История"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"actor":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"at":{"format":"date-time","type":"string"},"call":{"anyOf":[{"additionalProperties":false,"properties":{"clientNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"direction":{"enum":["incoming","outgoing"],"type":"string"},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inProgress":{"type":"boolean"},"recording":{"type":"boolean"},"result":{"anyOf":[{"enum":["answered","no_answer","busy","unreachable","failed"],"type":"string"},{"type":"null"}]},"talkSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["id","direction","result","inProgress","durationSeconds","talkSeconds","clientNumber","recording"],"type":"object"},{"type":"null"}]},"callAnalysis":{"additionalProperties":false,"properties":{"transcript":{"additionalProperties":false,"properties":{"state":{"enum":["queued","transcribing","held","done","failed"],"type":"string"}},"required":["state"],"type":"object"}},"required":["transcript"],"type":"object"},"history":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},"to":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","moved","owner_changed","comment_edited","comment_deleted","deleted","restored","comment_pinned","comment_unpinned","payment_recorded","payment_changed","payment_canceled","payment_refunded","payment_requested","payment_request_paid","payment_request_expired","payment_request_canceled","payment_request_failed","payment_consent_given","payment_credit_changed","archived"],"type":"string"},"fields":{"items":{"enum":["title","description","contactId","companyId","expectedCloseDate"],"type":"string"},"type":"array"},"merge":{"additionalProperties":false,"properties":{"dropped":{"items":{"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"record":{"type":"string"},"value":{"type":"string"}},"required":["record","key","label","value"],"type":"object"},"maxItems":400,"type":"array"},"records":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","name"],"type":"object"},"maxItems":4,"type":"array"}},"required":["records","dropped"],"type":"object"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]}},"required":["from","to"],"type":"object"},{"type":"null"}]},"payment":{"additionalProperties":false,"properties":{"paymentId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"paymentRequestId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"refundId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["paymentId","refundId","paymentRequestId"],"type":"object"},"stage":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"status":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"enum":["open","won","lost"],"type":"string"},"to":{"enum":["open","won","lost"],"type":"string"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"via":{"anyOf":[{"enum":["manual","import","form"],"type":"string"},{"type":"null"}]}},"required":["event","via","stage","status","owner","amount","fields","summary","attributes"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"message":{"anyOf":[{"additionalProperties":false,"properties":{"chat":{"additionalProperties":false,"properties":{"account":{"additionalProperties":false,"properties":{"displayName":{"type":"string"},"id":{"format":"uuid","type":"string"},"owner":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","displayName","username","owner"],"type":"object"},"id":{"format":"uuid","type":"string"},"provider":{"enum":["telegram"],"type":"string"}},"required":["id","provider","account"],"type":"object"},"entry":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"author":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"call":{"anyOf":[{"additionalProperties":false,"properties":{"answered":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"direction":{"enum":["in","out"],"type":"string"},"seconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["direction","answered","seconds"],"type":"object"},{"type":"null"}]},"dealId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"deleted":{"type":"boolean"},"direction":{"enum":["in","out"],"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"failure":{"anyOf":[{"type":"string"},{"type":"null"}]},"files":{"items":{"additionalProperties":false,"properties":{"contentType":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"gone":{"type":"boolean"},"hasPreview":{"type":"boolean"},"height":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["photo","voice","audio","video","video_note","document","sticker"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"waveform":{"anyOf":[{"items":{"maximum":31,"minimum":0,"type":"integer"},"maxItems":128,"type":"array"},{"type":"null"}]},"width":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]}},"required":["id","kind","contentType","sizeBytes","name","durationSeconds","width","height","waveform","hasPreview","gone"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["text","media","call","other"],"type":"string"},"origin":{"enum":["client","alta","device","history"],"type":"string"},"otherKind":{"anyOf":[{"enum":["sticker","location","contact","poll","game","unsupported"],"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"enum":["queued","sending","sent","read","failed","cancelled"],"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","at","direction","origin","author","kind","otherKind","text","status","failure","editedAt","deleted","dealId","call","files"],"type":"object"},{"type":"null"}]}},"required":["chat","entry"],"type":"object"},{"type":"null"}]},"note":{"anyOf":[{"additionalProperties":false,"properties":{"attachments":{"description":"The comment's files in their order (empty without files): id, name, size in bytes, type, and an audio's or a video's length. A signed-in member opens one through GET /note-files/{id}; an API key sees them here but does not open them.","items":{"additionalProperties":false,"properties":{"contentType":{"type":"string"},"durationSeconds":{"anyOf":[{"maximum":86400,"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"maxLength":255,"minLength":1,"type":"string"},"size":{"minimum":1,"type":"integer"}},"required":["id","name","size","contentType","durationSeconds"],"type":"object"},"type":"array"},"body":{"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"mentions":{"items":{"additionalProperties":false,"properties":{"memberId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"},"text":{"type":"string"}},"required":["memberId","text","name"],"type":"object"},"type":"array"},"pinned":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"by":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["at","by"],"type":"object"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["body","editedAt","version","mentions","pinned","attachments"],"type":"object"},{"type":"null"}]},"paymentReport":{"additionalProperties":false,"properties":{"card":{"anyOf":[{"additionalProperties":false,"properties":{"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"issuer":{"anyOf":[{"type":"string"},{"type":"null"}]},"maskedNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["maskedNumber","brand","issuer"],"type":"object"},{"type":"null"}]},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"occurredAt":{"format":"date-time","type":"string"},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"payer":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerPhone":{"anyOf":[{"type":"string"},{"type":"null"}]},"productCount":{"minimum":0,"type":"integer"},"products":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"name":{"type":"string"},"quantity":{"type":"string"}},"required":["name","quantity","amount","currency"],"type":"object"},"maxItems":20,"type":"array"}},"required":["method","orderReference","payer","payerEmail","payerPhone","card","products","productCount","occurredAt"],"type":"object"},"task":{"anyOf":[{"additionalProperties":false,"properties":{"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","rescheduled","reassigned","completed","reopened","canceled","deleted","restored"],"type":"string"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"next":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"title":{"type":"string"}},"required":["id","title","dueAt"],"type":"object"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedule":{"anyOf":[{"additionalProperties":false,"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["reason","note"],"type":"object"},{"type":"null"}]},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","event","attributes","outcome","next","reschedule"],"type":"object"},{"type":"null"}]},"type":{"enum":["note","history","task","call","message"],"type":"string"}},"required":["id","type","at","actor","note","history","task","call","message"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"pinned":{"items":{"additionalProperties":false,"properties":{"actor":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"at":{"format":"date-time","type":"string"},"call":{"anyOf":[{"additionalProperties":false,"properties":{"clientNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"direction":{"enum":["incoming","outgoing"],"type":"string"},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inProgress":{"type":"boolean"},"recording":{"type":"boolean"},"result":{"anyOf":[{"enum":["answered","no_answer","busy","unreachable","failed"],"type":"string"},{"type":"null"}]},"talkSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["id","direction","result","inProgress","durationSeconds","talkSeconds","clientNumber","recording"],"type":"object"},{"type":"null"}]},"callAnalysis":{"additionalProperties":false,"properties":{"transcript":{"additionalProperties":false,"properties":{"state":{"enum":["queued","transcribing","held","done","failed"],"type":"string"}},"required":["state"],"type":"object"}},"required":["transcript"],"type":"object"},"history":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},"to":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","moved","owner_changed","comment_edited","comment_deleted","deleted","restored","comment_pinned","comment_unpinned","payment_recorded","payment_changed","payment_canceled","payment_refunded","payment_requested","payment_request_paid","payment_request_expired","payment_request_canceled","payment_request_failed","payment_consent_given","payment_credit_changed","archived"],"type":"string"},"fields":{"items":{"enum":["title","description","contactId","companyId","expectedCloseDate"],"type":"string"},"type":"array"},"merge":{"additionalProperties":false,"properties":{"dropped":{"items":{"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"record":{"type":"string"},"value":{"type":"string"}},"required":["record","key","label","value"],"type":"object"},"maxItems":400,"type":"array"},"records":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","name"],"type":"object"},"maxItems":4,"type":"array"}},"required":["records","dropped"],"type":"object"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]}},"required":["from","to"],"type":"object"},{"type":"null"}]},"payment":{"additionalProperties":false,"properties":{"paymentId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"paymentRequestId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"refundId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["paymentId","refundId","paymentRequestId"],"type":"object"},"stage":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"status":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"enum":["open","won","lost"],"type":"string"},"to":{"enum":["open","won","lost"],"type":"string"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"via":{"anyOf":[{"enum":["manual","import","form"],"type":"string"},{"type":"null"}]}},"required":["event","via","stage","status","owner","amount","fields","summary","attributes"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"message":{"anyOf":[{"additionalProperties":false,"properties":{"chat":{"additionalProperties":false,"properties":{"account":{"additionalProperties":false,"properties":{"displayName":{"type":"string"},"id":{"format":"uuid","type":"string"},"owner":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","displayName","username","owner"],"type":"object"},"id":{"format":"uuid","type":"string"},"provider":{"enum":["telegram"],"type":"string"}},"required":["id","provider","account"],"type":"object"},"entry":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"author":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"call":{"anyOf":[{"additionalProperties":false,"properties":{"answered":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"direction":{"enum":["in","out"],"type":"string"},"seconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["direction","answered","seconds"],"type":"object"},{"type":"null"}]},"dealId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"deleted":{"type":"boolean"},"direction":{"enum":["in","out"],"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"failure":{"anyOf":[{"type":"string"},{"type":"null"}]},"files":{"items":{"additionalProperties":false,"properties":{"contentType":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"gone":{"type":"boolean"},"hasPreview":{"type":"boolean"},"height":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["photo","voice","audio","video","video_note","document","sticker"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"waveform":{"anyOf":[{"items":{"maximum":31,"minimum":0,"type":"integer"},"maxItems":128,"type":"array"},{"type":"null"}]},"width":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]}},"required":["id","kind","contentType","sizeBytes","name","durationSeconds","width","height","waveform","hasPreview","gone"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["text","media","call","other"],"type":"string"},"origin":{"enum":["client","alta","device","history"],"type":"string"},"otherKind":{"anyOf":[{"enum":["sticker","location","contact","poll","game","unsupported"],"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"enum":["queued","sending","sent","read","failed","cancelled"],"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","at","direction","origin","author","kind","otherKind","text","status","failure","editedAt","deleted","dealId","call","files"],"type":"object"},{"type":"null"}]}},"required":["chat","entry"],"type":"object"},{"type":"null"}]},"note":{"anyOf":[{"additionalProperties":false,"properties":{"attachments":{"description":"The comment's files in their order (empty without files): id, name, size in bytes, type, and an audio's or a video's length. A signed-in member opens one through GET /note-files/{id}; an API key sees them here but does not open them.","items":{"additionalProperties":false,"properties":{"contentType":{"type":"string"},"durationSeconds":{"anyOf":[{"maximum":86400,"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"maxLength":255,"minLength":1,"type":"string"},"size":{"minimum":1,"type":"integer"}},"required":["id","name","size","contentType","durationSeconds"],"type":"object"},"type":"array"},"body":{"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"mentions":{"items":{"additionalProperties":false,"properties":{"memberId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"},"text":{"type":"string"}},"required":["memberId","text","name"],"type":"object"},"type":"array"},"pinned":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"by":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["at","by"],"type":"object"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["body","editedAt","version","mentions","pinned","attachments"],"type":"object"},{"type":"null"}]},"paymentReport":{"additionalProperties":false,"properties":{"card":{"anyOf":[{"additionalProperties":false,"properties":{"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"issuer":{"anyOf":[{"type":"string"},{"type":"null"}]},"maskedNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["maskedNumber","brand","issuer"],"type":"object"},{"type":"null"}]},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"occurredAt":{"format":"date-time","type":"string"},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"payer":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerPhone":{"anyOf":[{"type":"string"},{"type":"null"}]},"productCount":{"minimum":0,"type":"integer"},"products":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"name":{"type":"string"},"quantity":{"type":"string"}},"required":["name","quantity","amount","currency"],"type":"object"},"maxItems":20,"type":"array"}},"required":["method","orderReference","payer","payerEmail","payerPhone","card","products","productCount","occurredAt"],"type":"object"},"task":{"anyOf":[{"additionalProperties":false,"properties":{"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","rescheduled","reassigned","completed","reopened","canceled","deleted","restored"],"type":"string"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"next":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"title":{"type":"string"}},"required":["id","title","dueAt"],"type":"object"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedule":{"anyOf":[{"additionalProperties":false,"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["reason","note"],"type":"object"},{"type":"null"}]},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","event","attributes","outcome","next","reschedule"],"type":"object"},{"type":"null"}]},"type":{"enum":["note","history","task","call","message"],"type":"string"}},"required":["id","type","at","actor","note","history","task","call","message"],"type":"object"},"maxItems":3,"type":"array"}},"required":["items","nextCursor","pinned"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000058","type":"note","at":"2026-10-24T16:45:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"note":{"body":"Удобнее писать в Telegram","editedAt":null,"version":1,"mentions":[],"pinned":null,"attachments":[]},"history":null,"task":null,"call":null,"message":null},{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","type":"task","at":"2026-10-21T12:40:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"note":null,"history":null,"task":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"event":"created","attributes":[],"outcome":null,"next":null,"reschedule":null},"call":null,"message":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000054","type":"history","at":"2026-10-20T08:15:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000001","name":"Андрей Шевченко"},"note":null,"history":{"event":"created","via":"manual","stage":null,"status":null,"owner":null,"amount":null,"fields":[],"summary":null,"attributes":[{"key":"phone","label":null,"from":null,"to":"+380501234567","fieldType":null,"decimals":null}]},"task":null,"call":null,"message":null}],"nextCursor":null,"pinned":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/deals/{dealId}/activity":{"get":{"operationId":"listDealActivity","security":[{"bearerAuth":[]}],"summary":"История сделки","parameters":[{"in":"path","name":"dealId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"query","name":"cursor","required":false,"schema":{"maxLength":512,"minLength":1,"type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":30,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"only","required":false,"schema":{"enum":["notes","history","tasks","main","payments","changes"],"type":"string"}}],"description":"Всё, что произошло со сделкой, новые сверху, страницами: создание, переходы по этапам, выигрыш, проигрыш и повторное открытие, смена ответственного, суммы, каждого поля и тегов (что было и что стало), комментарии, что произошло с её задачами, оплаты. У каждой записи — кто (`actor`), когда (`at`) и что (`history`, `note` или `task`). `only` оставляет одно: `notes` — комментарии, `history` — изменения, `tasks` — задачи, `payments` — оплаты, `changes` — правки названия, суммы, тегов и собственных полей (без создания сделки; в каждой записи только эти правки). Чаты и звонки через API недоступны.","tags":["История"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"actor":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"at":{"format":"date-time","type":"string"},"call":{"anyOf":[{"additionalProperties":false,"properties":{"clientNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"direction":{"enum":["incoming","outgoing"],"type":"string"},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inProgress":{"type":"boolean"},"recording":{"type":"boolean"},"result":{"anyOf":[{"enum":["answered","no_answer","busy","unreachable","failed"],"type":"string"},{"type":"null"}]},"talkSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["id","direction","result","inProgress","durationSeconds","talkSeconds","clientNumber","recording"],"type":"object"},{"type":"null"}]},"callAnalysis":{"additionalProperties":false,"properties":{"transcript":{"additionalProperties":false,"properties":{"state":{"enum":["queued","transcribing","held","done","failed"],"type":"string"}},"required":["state"],"type":"object"}},"required":["transcript"],"type":"object"},"history":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},"to":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","moved","owner_changed","comment_edited","comment_deleted","deleted","restored","comment_pinned","comment_unpinned","payment_recorded","payment_changed","payment_canceled","payment_refunded","payment_requested","payment_request_paid","payment_request_expired","payment_request_canceled","payment_request_failed","payment_consent_given","payment_credit_changed","archived"],"type":"string"},"fields":{"items":{"enum":["title","description","contactId","companyId","expectedCloseDate"],"type":"string"},"type":"array"},"merge":{"additionalProperties":false,"properties":{"dropped":{"items":{"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"record":{"type":"string"},"value":{"type":"string"}},"required":["record","key","label","value"],"type":"object"},"maxItems":400,"type":"array"},"records":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","name"],"type":"object"},"maxItems":4,"type":"array"}},"required":["records","dropped"],"type":"object"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]}},"required":["from","to"],"type":"object"},{"type":"null"}]},"payment":{"additionalProperties":false,"properties":{"paymentId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"paymentRequestId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"refundId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["paymentId","refundId","paymentRequestId"],"type":"object"},"stage":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"status":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"enum":["open","won","lost"],"type":"string"},"to":{"enum":["open","won","lost"],"type":"string"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"via":{"anyOf":[{"enum":["manual","import","form"],"type":"string"},{"type":"null"}]}},"required":["event","via","stage","status","owner","amount","fields","summary","attributes"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"message":{"anyOf":[{"additionalProperties":false,"properties":{"chat":{"additionalProperties":false,"properties":{"account":{"additionalProperties":false,"properties":{"displayName":{"type":"string"},"id":{"format":"uuid","type":"string"},"owner":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","displayName","username","owner"],"type":"object"},"id":{"format":"uuid","type":"string"},"provider":{"enum":["telegram"],"type":"string"}},"required":["id","provider","account"],"type":"object"},"entry":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"author":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"call":{"anyOf":[{"additionalProperties":false,"properties":{"answered":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"direction":{"enum":["in","out"],"type":"string"},"seconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["direction","answered","seconds"],"type":"object"},{"type":"null"}]},"dealId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"deleted":{"type":"boolean"},"direction":{"enum":["in","out"],"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"failure":{"anyOf":[{"type":"string"},{"type":"null"}]},"files":{"items":{"additionalProperties":false,"properties":{"contentType":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"gone":{"type":"boolean"},"hasPreview":{"type":"boolean"},"height":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["photo","voice","audio","video","video_note","document","sticker"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"waveform":{"anyOf":[{"items":{"maximum":31,"minimum":0,"type":"integer"},"maxItems":128,"type":"array"},{"type":"null"}]},"width":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]}},"required":["id","kind","contentType","sizeBytes","name","durationSeconds","width","height","waveform","hasPreview","gone"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["text","media","call","other"],"type":"string"},"origin":{"enum":["client","alta","device","history"],"type":"string"},"otherKind":{"anyOf":[{"enum":["sticker","location","contact","poll","game","unsupported"],"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"enum":["queued","sending","sent","read","failed","cancelled"],"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","at","direction","origin","author","kind","otherKind","text","status","failure","editedAt","deleted","dealId","call","files"],"type":"object"},{"type":"null"}]}},"required":["chat","entry"],"type":"object"},{"type":"null"}]},"note":{"anyOf":[{"additionalProperties":false,"properties":{"attachments":{"description":"The comment's files in their order (empty without files): id, name, size in bytes, type, and an audio's or a video's length. A signed-in member opens one through GET /note-files/{id}; an API key sees them here but does not open them.","items":{"additionalProperties":false,"properties":{"contentType":{"type":"string"},"durationSeconds":{"anyOf":[{"maximum":86400,"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"maxLength":255,"minLength":1,"type":"string"},"size":{"minimum":1,"type":"integer"}},"required":["id","name","size","contentType","durationSeconds"],"type":"object"},"type":"array"},"body":{"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"mentions":{"items":{"additionalProperties":false,"properties":{"memberId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"},"text":{"type":"string"}},"required":["memberId","text","name"],"type":"object"},"type":"array"},"pinned":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"by":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["at","by"],"type":"object"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["body","editedAt","version","mentions","pinned","attachments"],"type":"object"},{"type":"null"}]},"paymentReport":{"additionalProperties":false,"properties":{"card":{"anyOf":[{"additionalProperties":false,"properties":{"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"issuer":{"anyOf":[{"type":"string"},{"type":"null"}]},"maskedNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["maskedNumber","brand","issuer"],"type":"object"},{"type":"null"}]},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"occurredAt":{"format":"date-time","type":"string"},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"payer":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerPhone":{"anyOf":[{"type":"string"},{"type":"null"}]},"productCount":{"minimum":0,"type":"integer"},"products":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"name":{"type":"string"},"quantity":{"type":"string"}},"required":["name","quantity","amount","currency"],"type":"object"},"maxItems":20,"type":"array"}},"required":["method","orderReference","payer","payerEmail","payerPhone","card","products","productCount","occurredAt"],"type":"object"},"task":{"anyOf":[{"additionalProperties":false,"properties":{"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","rescheduled","reassigned","completed","reopened","canceled","deleted","restored"],"type":"string"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"next":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"title":{"type":"string"}},"required":["id","title","dueAt"],"type":"object"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedule":{"anyOf":[{"additionalProperties":false,"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["reason","note"],"type":"object"},{"type":"null"}]},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","event","attributes","outcome","next","reschedule"],"type":"object"},{"type":"null"}]},"type":{"enum":["note","history","task","call","message"],"type":"string"}},"required":["id","type","at","actor","note","history","task","call","message"],"type":"object"},"type":"array"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"pinned":{"items":{"additionalProperties":false,"properties":{"actor":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"at":{"format":"date-time","type":"string"},"call":{"anyOf":[{"additionalProperties":false,"properties":{"clientNumber":{"anyOf":[{"type":"string"},{"type":"null"}]},"direction":{"enum":["incoming","outgoing"],"type":"string"},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"inProgress":{"type":"boolean"},"recording":{"type":"boolean"},"result":{"anyOf":[{"enum":["answered","no_answer","busy","unreachable","failed"],"type":"string"},{"type":"null"}]},"talkSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["id","direction","result","inProgress","durationSeconds","talkSeconds","clientNumber","recording"],"type":"object"},{"type":"null"}]},"callAnalysis":{"additionalProperties":false,"properties":{"transcript":{"additionalProperties":false,"properties":{"state":{"enum":["queued","transcribing","held","done","failed"],"type":"string"}},"required":["state"],"type":"object"}},"required":["transcript"],"type":"object"},"history":{"anyOf":[{"additionalProperties":false,"properties":{"amount":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},"to":{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","moved","owner_changed","comment_edited","comment_deleted","deleted","restored","comment_pinned","comment_unpinned","payment_recorded","payment_changed","payment_canceled","payment_refunded","payment_requested","payment_request_paid","payment_request_expired","payment_request_canceled","payment_request_failed","payment_consent_given","payment_credit_changed","archived"],"type":"string"},"fields":{"items":{"enum":["title","description","contactId","companyId","expectedCloseDate"],"type":"string"},"type":"array"},"merge":{"additionalProperties":false,"properties":{"dropped":{"items":{"additionalProperties":false,"properties":{"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"record":{"type":"string"},"value":{"type":"string"}},"required":["record","key","label","value"],"type":"object"},"maxItems":400,"type":"array"},"records":{"items":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"number":{"minimum":1,"type":"integer"}},"required":["id","name"],"type":"object"},"maxItems":4,"type":"array"}},"required":["records","dropped"],"type":"object"},"owner":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]}},"required":["from","to"],"type":"object"},{"type":"null"}]},"payment":{"additionalProperties":false,"properties":{"paymentId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"paymentRequestId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"refundId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["paymentId","refundId","paymentRequestId"],"type":"object"},"stage":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"to":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"status":{"anyOf":[{"additionalProperties":false,"properties":{"from":{"enum":["open","won","lost"],"type":"string"},"to":{"enum":["open","won","lost"],"type":"string"}},"required":["from","to"],"type":"object"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"via":{"anyOf":[{"enum":["manual","import","form"],"type":"string"},{"type":"null"}]}},"required":["event","via","stage","status","owner","amount","fields","summary","attributes"],"type":"object"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"message":{"anyOf":[{"additionalProperties":false,"properties":{"chat":{"additionalProperties":false,"properties":{"account":{"additionalProperties":false,"properties":{"displayName":{"type":"string"},"id":{"format":"uuid","type":"string"},"owner":{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","displayName","username","owner"],"type":"object"},"id":{"format":"uuid","type":"string"},"provider":{"enum":["telegram"],"type":"string"}},"required":["id","provider","account"],"type":"object"},"entry":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"author":{"anyOf":[{"additionalProperties":false,"properties":{"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name"],"type":"object"},{"type":"null"}]},"call":{"anyOf":[{"additionalProperties":false,"properties":{"answered":{"anyOf":[{"type":"boolean"},{"type":"null"}]},"direction":{"enum":["in","out"],"type":"string"},"seconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]}},"required":["direction","answered","seconds"],"type":"object"},{"type":"null"}]},"dealId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"deleted":{"type":"boolean"},"direction":{"enum":["in","out"],"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"failure":{"anyOf":[{"type":"string"},{"type":"null"}]},"files":{"items":{"additionalProperties":false,"properties":{"contentType":{"anyOf":[{"type":"string"},{"type":"null"}]},"durationSeconds":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"gone":{"type":"boolean"},"hasPreview":{"type":"boolean"},"height":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"kind":{"enum":["photo","voice","audio","video","video_note","document","sticker"],"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"anyOf":[{"minimum":0,"type":"integer"},{"type":"null"}]},"waveform":{"anyOf":[{"items":{"maximum":31,"minimum":0,"type":"integer"},"maxItems":128,"type":"array"},{"type":"null"}]},"width":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]}},"required":["id","kind","contentType","sizeBytes","name","durationSeconds","width","height","waveform","hasPreview","gone"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["text","media","call","other"],"type":"string"},"origin":{"enum":["client","alta","device","history"],"type":"string"},"otherKind":{"anyOf":[{"enum":["sticker","location","contact","poll","game","unsupported"],"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"enum":["queued","sending","sent","read","failed","cancelled"],"type":"string"},{"type":"null"}]},"text":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","at","direction","origin","author","kind","otherKind","text","status","failure","editedAt","deleted","dealId","call","files"],"type":"object"},{"type":"null"}]}},"required":["chat","entry"],"type":"object"},{"type":"null"}]},"note":{"anyOf":[{"additionalProperties":false,"properties":{"attachments":{"description":"The comment's files in their order (empty without files): id, name, size in bytes, type, and an audio's or a video's length. A signed-in member opens one through GET /note-files/{id}; an API key sees them here but does not open them.","items":{"additionalProperties":false,"properties":{"contentType":{"type":"string"},"durationSeconds":{"anyOf":[{"maximum":86400,"minimum":0,"type":"integer"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"maxLength":255,"minLength":1,"type":"string"},"size":{"minimum":1,"type":"integer"}},"required":["id","name","size","contentType","durationSeconds"],"type":"object"},"type":"array"},"body":{"type":"string"},"editedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"mentions":{"items":{"additionalProperties":false,"properties":{"memberId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"},"text":{"type":"string"}},"required":["memberId","text","name"],"type":"object"},"type":"array"},"pinned":{"anyOf":[{"additionalProperties":false,"properties":{"at":{"format":"date-time","type":"string"},"by":{"additionalProperties":false,"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","name"],"type":"object"}},"required":["at","by"],"type":"object"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["body","editedAt","version","mentions","pinned","attachments"],"type":"object"},{"type":"null"}]},"paymentReport":{"additionalProperties":false,"properties":{"card":{"anyOf":[{"additionalProperties":false,"properties":{"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"issuer":{"anyOf":[{"type":"string"},{"type":"null"}]},"maskedNumber":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["maskedNumber","brand","issuer"],"type":"object"},{"type":"null"}]},"method":{"anyOf":[{"type":"string"},{"type":"null"}]},"occurredAt":{"format":"date-time","type":"string"},"orderReference":{"anyOf":[{"type":"string"},{"type":"null"}]},"payer":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"payerPhone":{"anyOf":[{"type":"string"},{"type":"null"}]},"productCount":{"minimum":0,"type":"integer"},"products":{"items":{"additionalProperties":false,"properties":{"amount":{"pattern":"^[0-9]+\\.[0-9]{2}$","type":"string"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"name":{"type":"string"},"quantity":{"type":"string"}},"required":["name","quantity","amount","currency"],"type":"object"},"maxItems":20,"type":"array"}},"required":["method","orderReference","payer","payerEmail","payerPhone","card","products","productCount","occurredAt"],"type":"object"},"task":{"anyOf":[{"additionalProperties":false,"properties":{"attributes":{"items":{"additionalProperties":false,"properties":{"decimals":{"anyOf":[{"maximum":4,"minimum":0,"type":"integer"},{"type":"null"}]},"fieldType":{"anyOf":[{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"key":{"type":"string"},"label":{"anyOf":[{"type":"string"},{"type":"null"}]},"to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["key","label","from","to","fieldType","decimals"],"type":"object"},"type":"array"},"event":{"enum":["created","updated","rescheduled","reassigned","completed","reopened","canceled","deleted","restored"],"type":"string"},"id":{"format":"uuid","type":"string"},"kind":{"enum":["task","call","meeting","email","reminder","chat"],"type":"string"},"next":{"anyOf":[{"additionalProperties":false,"properties":{"allDay":{"type":"boolean"},"dueAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"title":{"type":"string"}},"required":["id","title","dueAt"],"type":"object"},{"type":"null"}]},"outcome":{"anyOf":[{"enum":["call","message","meeting","no_answer","no_contact"],"type":"string"},{"type":"null"}]},"reschedule":{"anyOf":[{"additionalProperties":false,"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}]},"reason":{"anyOf":[{"enum":["client_asked","no_answer","no_time","other"],"type":"string"},{"type":"null"}]}},"required":["reason","note"],"type":"object"},{"type":"null"}]},"title":{"type":"string"},"type":{"anyOf":[{"additionalProperties":false,"properties":{"icon":{"type":"string"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"}},"required":["id","name","icon"],"type":"object"},{"type":"null"}]}},"required":["id","title","kind","type","event","attributes","outcome","next","reschedule"],"type":"object"},{"type":"null"}]},"type":{"enum":["note","history","task","call","message"],"type":"string"}},"required":["id","type","at","actor","note","history","task","call","message"],"type":"object"},"maxItems":3,"type":"array"}},"required":["items","nextCursor","pinned"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","type":"task","at":"2026-10-24T16:45:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"note":null,"history":null,"task":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003c","title":"Перезвонить по счёту","kind":"call","type":null,"event":"completed","attributes":[],"outcome":"call","next":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000003d","title":"Отправить счёт","dueAt":"2026-10-29T09:00:00Z"},"reschedule":null},"call":null,"message":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000059","type":"history","at":"2026-10-23T10:30:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"note":null,"history":{"event":"payment_recorded","via":null,"stage":null,"status":null,"owner":null,"amount":null,"fields":[],"summary":null,"attributes":[{"key":"payment","label":null,"from":null,"to":"12000.00 UAH","fieldType":"money","decimals":null},{"key":"paymentStatus","label":null,"from":null,"to":"paid","fieldType":null,"decimals":null},{"key":"paidAt","label":null,"from":null,"to":"2026-10-23","fieldType":null,"decimals":null},{"key":"paymentMethod","label":null,"from":null,"to":"Карта","fieldType":null,"decimals":null}],"payment":{"paymentId":"0192f3a1-7c2e-7b4d-9a61-0000000000b3","refundId":null,"paymentRequestId":null}},"task":null,"call":null,"message":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000050","type":"note","at":"2026-10-22T09:05:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"note":{"body":"Клиентка просит счёт до пятницы","editedAt":null,"version":1,"mentions":[],"pinned":null,"attachments":[]},"history":null,"task":null,"call":null,"message":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000053","type":"history","at":"2026-10-21T12:45:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"note":null,"history":{"event":"updated","via":"manual","stage":null,"status":null,"owner":null,"amount":{"from":{"amount":"10000.00","currency":"UAH"},"to":{"amount":"12000.00","currency":"UAH"}},"fields":[],"summary":null,"attributes":[{"key":"cf:0192f3a1-7c2e-7b4d-9a61-000000000032","label":"Город доставки","from":null,"to":"Киев","fieldType":"text","decimals":null}]},"task":null,"call":null,"message":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000052","type":"history","at":"2026-10-21T12:40:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник"},"note":null,"history":{"event":"moved","via":"manual","stage":{"from":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000001f","name":"Новый запрос"},"to":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000020","name":"Переговоры"}},"status":null,"owner":null,"amount":null,"fields":[],"summary":null,"attributes":[]},"task":null,"call":null,"message":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000051","type":"history","at":"2026-10-20T08:15:00Z","actor":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000001","name":"Андрей Шевченко"},"note":null,"history":{"event":"created","via":"manual","stage":{"from":null,"to":{"id":"0192f3a1-7c2e-7b4d-9a61-00000000001f","name":"Новый запрос"}},"status":null,"owner":null,"amount":null,"fields":[],"summary":null,"attributes":[]},"task":null,"call":null,"message":null}],"nextCursor":null,"pinned":[]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/notes/{noteId}/copies/{source}/{externalId}":{"put":{"operationId":"linkNoteCopy","security":[{"bearerAuth":[]}],"summary":"Связать комментарий с его копией в другой системе","parameters":[{"in":"path","name":"noteId","required":true,"schema":{"format":"uuid","type":"string"}},{"in":"path","name":"source","required":true,"schema":{"pattern":"^[a-z0-9_-]{1,40}$","type":"string"}},{"in":"path","name":"externalId","required":true,"schema":{"maxLength":200,"minLength":1,"pattern":"^\\S+$","type":"string"}}],"description":"Для сервиса, который копирует комментарии из Alta в другую систему: после того как копия создана там, он сообщает её id. `source` — ваше слово для системы (строчные латинские буквы, цифры, `-` и `_`), `externalId` — id копии там. Импорт из этой системы узнаёт копию по этому id и отвечает этим комментарием, а не приносит его второй раз; поэтому в тексте копии не нужна строка со ссылкой на комментарий. Если импорт успел принести копию раньше, чем пришла связь, и она в точности повторяет комментарий, она скрывается как дубль (`duplicateHidden: true`). Первая связь — `created`, тот же запрос ещё раз ничего не меняет (`unchanged`), поэтому повтор безопасен. Связать можно только комментарий, написанный в Alta: для пришедшего импортом — `409 CONFLICT` (`note_imported`); копия, уже связанная с другим комментарием, — `409 CONFLICT` (`copy_of_another_comment`). Нужен ключ с правом записи и право «Импорт данных» в роли автора ключа (у владельца и администратора оно есть), иначе — `403 FORBIDDEN`.","tags":["История"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"type":"object"},"example":{}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"duplicateHidden":{"type":"boolean"},"noteId":{"format":"uuid","type":"string"},"outcome":{"enum":["created","unchanged"],"type":"string"}},"required":["noteId","outcome","duplicateHidden"],"type":"object"},"example":{"noteId":"0192f3a1-7c2e-7b4d-9a61-000000000050","outcome":"created","duplicateHidden":false}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/marketing/spend":{"post":{"operationId":"addMarketingSpend","security":[{"bearerAuth":[]}],"summary":"Передать расходы","parameters":[],"description":"Одна строка или до 100: сколько реклама стоила за день, для площадки, у которой нет готового подключения. Строка хранится такой, какой пришла, а источник и деньги в валюте организации система считает после этого. `externalId` — ваш собственный идентификатор внутри `account`: та же строка с теми же числами ничего не меняет, с другими числами заменяет прежние. `account` — ваше слово для кабинета и часть идентичности строки: два кабинета могут использовать один `externalId`, а строки, присланные под другим словом, — это новые строки, поэтому держите одно слово на кабинет; слово `default` — то же, что не передать `account`. `sourceCode` — ваше слово для источника: его псевдоним или код; без него строка попадает в «Без источника» и остаётся в итогах. `campaign`, `adSet`, `ad` и `creative` необязательны и дают ту же иерархию, что у подключённых кабинетов, под этим же `account`. День — не позже завтрашнего. Сумма — только рекламный бюджет. В ответе — сколько строк новых (`added`), заменено (`replaced`) и повторов (`repeated`). Нужен раздел «Маркетинг» в роли автора ключа.","tags":["Маркетинг"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"account":{"anyOf":[{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},{"type":"null"}]},"rows":{"items":{"additionalProperties":false,"properties":{"ad":{"additionalProperties":false,"properties":{"id":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"name":{"anyOf":[{"maxLength":500,"type":"string"},{"type":"null"}]}},"required":["id"],"type":"object"},"adSet":{"additionalProperties":false,"properties":{"id":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"name":{"anyOf":[{"maxLength":500,"type":"string"},{"type":"null"}]}},"required":["id"],"type":"object"},"amount":{"pattern":"^[0-9]{1,12}\\.[0-9]{2}$","type":"string"},"campaign":{"additionalProperties":false,"properties":{"id":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"name":{"anyOf":[{"maxLength":500,"type":"string"},{"type":"null"}]}},"required":["id"],"type":"object"},"creative":{"additionalProperties":false,"properties":{"format":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"id":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"link":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]},"thumbnailUrl":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]}},"required":["id"],"type":"object"},"currency":{"pattern":"^[A-Z]{3}$","type":"string"},"day":{"format":"date","type":"string"},"externalId":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"impressions":{"anyOf":[{"maximum":1000000000000,"minimum":0,"type":"integer"},{"type":"null"}]},"landingPageViews":{"anyOf":[{"maximum":1000000000000,"minimum":0,"type":"integer"},{"type":"null"}]},"leads":{"anyOf":[{"maximum":1000000000000,"minimum":0,"type":"integer"},{"type":"null"}]},"linkClicks":{"anyOf":[{"maximum":1000000000000,"minimum":0,"type":"integer"},{"type":"null"}]},"outboundClicks":{"anyOf":[{"maximum":1000000000000,"minimum":0,"type":"integer"},{"type":"null"}]},"placementUrl":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]},"sourceCode":{"anyOf":[{"maxLength":500,"type":"string"},{"type":"null"}]}},"required":["externalId","day","currency","amount"],"type":"object"},"maxItems":100,"minItems":1,"type":"array"}},"required":["rows"],"type":"object"},"example":{"account":"kavova-ads","rows":[{"externalId":"ads-2026-10-03-481","day":"2026-10-03","currency":"USD","amount":"125.40","impressions":18250,"linkClicks":412,"outboundClicks":390,"landingPageViews":305,"leads":21,"sourceCode":"newsletter_autumn","campaign":{"id":"c-77","name":"Осінній розпродаж"},"adSet":{"id":"s-12","name":"Київ, 25-45"},"ad":{"id":"a-481","name":"Банер 1"},"creative":{"id":"k-9","link":"https://kavova.ua/creative/autumn-banner","thumbnailUrl":"https://kavova.ua/creative/autumn-banner.jpg","format":"зображення"}}]}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"added":{"minimum":0,"type":"integer"},"repeated":{"minimum":0,"type":"integer"},"replaced":{"minimum":0,"type":"integer"}},"required":["added","replaced","repeated"],"type":"object"},"example":{"added":1,"replaced":0,"repeated":0}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/marketing/touches":{"post":{"operationId":"addMarketingTouches","security":[{"bearerAuth":[]}],"summary":"Передать касания","parameters":[],"description":"Одно касание или до 100: действие человека, о котором говорит метка. Касание хранится таким, каким пришло, а правила организации читают его после этого. `externalId` — ваш собственный идентификатор: то же касание, отправленное ещё раз, ничего не меняет, даже если в нём другие значения. В ответе — сколько касаний новых (`added`) и сколько повторов (`repeated`). Нужен раздел «Маркетинг» в роли автора ключа.","tags":["Маркетинг"],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"touches":{"items":{"additionalProperties":false,"properties":{"adId":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]},"dealRef":{"anyOf":[{"maxLength":200,"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"maxLength":320,"type":"string"},{"type":"null"}]},"externalId":{"maxLength":200,"minLength":1,"pattern":"\\S","type":"string"},"kind":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"landingUrl":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]},"occurredAt":{"format":"date-time","type":"string"},"phone":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"telegramId":{"anyOf":[{"maxLength":100,"type":"string"},{"type":"null"}]},"utmCampaign":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]},"utmContent":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]},"utmMedium":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]},"utmSource":{"anyOf":[{"maxLength":500,"type":"string"},{"type":"null"}]},"utmTerm":{"anyOf":[{"maxLength":2000,"type":"string"},{"type":"null"}]}},"required":["externalId","occurredAt"],"type":"object"},"maxItems":100,"minItems":1,"type":"array"}},"required":["touches"],"type":"object"},"example":{"touches":[{"externalId":"site-form-20481","occurredAt":"2026-10-20T08:15:00Z","utmSource":"newsletter_autumn","utmMedium":"email","utmCampaign":"autumn_sale","landingUrl":"https://kavova.ua/autumn","phone":"+380501234567"}]}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"added":{"minimum":0,"type":"integer"},"repeated":{"minimum":0,"type":"integer"}},"required":["added","repeated"],"type":"object"},"example":{"added":1,"repeated":0}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/custom-fields":{"get":{"operationId":"listCustomFields","security":[{"bearerAuth":[]}],"summary":"Собственные поля","parameters":[{"in":"query","name":"entity","required":false,"schema":{"enum":["contact","company","deal","team","payment","product"],"type":"string"}},{"in":"query","name":"status","required":false,"schema":{"default":"active","enum":["active","archived","all"],"type":"string"}}],"description":"Поля организации с вариантами выбора — для контактов, компаний, сделок или команд (`entity`): активные, архивные или все. `requiredStageIds` — этапы, на которые человек в Alta не переведёт сделку без этого поля (запрос через API это не останавливает); `requiredAtPayment` — человек в Alta не запишет оплату сделки без него (с `methodIds` — только оплату этими способами); оплату через API это не останавливает.","tags":["Справочники"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"apiOnly":{"type":"boolean"},"archived":{"type":"boolean"},"decimals":{"anyOf":[{"type":"integer"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"entity":{"enum":["contact","company","deal","team","payment","product"],"type":"string"},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalSource":{"anyOf":[{"type":"string"},{"type":"null"}]},"groupId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"multipleValues":{"type":"boolean"},"name":{"type":"string"},"options":{"items":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"label":{"type":"string"}},"required":["id","label","color","archived","externalId"],"type":"object"},"type":"array"},"pipelineIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"position":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"requiredAtPayment":{"anyOf":[{"additionalProperties":false,"properties":{"methodIds":{"items":{"format":"uuid","type":"string"},"maxItems":200,"type":"array"}},"required":["methodIds"],"type":"object"},{"type":"null"}]},"requiredStageIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"requirements":{"items":{"additionalProperties":false,"properties":{"moment":{"type":"string"},"scopeIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["moment","scopeIds"],"type":"object"},"type":"array"},"showInDeal":{"type":"boolean"},"showOnCard":{"type":"boolean"},"type":{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},"uniqueCheck":{"anyOf":[{"additionalProperties":false,"properties":{"doubles":{"minimum":0,"type":"integer"},"finishedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"moreDoubles":{"type":"boolean"},"startedAt":{"format":"date-time","type":"string"},"state":{"enum":["checking","doubles"],"type":"string"}},"required":["state","doubles","moreDoubles","startedAt","finishedAt"],"type":"object"},{"type":"null"}]},"uniqueValues":{"type":"boolean"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","entity","type","name","description","decimals","options","pipelineIds","requiredStageIds","requiredAtPayment","requirements","showOnCard","showInDeal","apiOnly","uniqueValues","uniqueCheck","multipleValues","groupId","position","archived","externalSource","externalId","updatedAt","version"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000032","name":"Город доставки","entity":"deal","type":"text","description":null,"options":[],"decimals":null,"groupId":null,"position":1,"pipelineIds":[],"requiredStageIds":[],"requiredAtPayment":null,"requirements":[],"showOnCard":true,"showInDeal":false,"apiOnly":false,"uniqueValues":false,"uniqueCheck":null,"multipleValues":false,"archived":false,"externalId":null,"externalSource":null,"updatedAt":"2026-10-20T08:15:00Z","version":1},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000033","name":"Источник запроса","entity":"deal","type":"choice","description":null,"options":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000034","label":"Сайт","color":"blue","archived":false,"externalId":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000035","label":"Instagram","color":"purple","archived":false,"externalId":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000036","label":"Рекомендация","color":"green","archived":false,"externalId":null}],"decimals":null,"groupId":null,"position":2,"pipelineIds":[],"requiredStageIds":["0192f3a1-7c2e-7b4d-9a61-000000000021"],"requiredAtPayment":null,"requirements":[{"moment":"deal.stage_enter","scopeIds":["0192f3a1-7c2e-7b4d-9a61-000000000021"]}],"showOnCard":true,"showInDeal":false,"apiOnly":false,"uniqueValues":false,"uniqueCheck":null,"multipleValues":false,"archived":false,"externalId":null,"externalSource":null,"updatedAt":"2026-10-20T08:15:00Z","version":1}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/custom-fields/{fieldId}":{"get":{"operationId":"getCustomField","security":[{"bearerAuth":[]}],"summary":"Получить поле","parameters":[{"in":"path","name":"fieldId","required":true,"schema":{"format":"uuid","type":"string"}}],"description":"Одно собственное поле по id.","tags":["Справочники"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"apiOnly":{"type":"boolean"},"archived":{"type":"boolean"},"decimals":{"anyOf":[{"type":"integer"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"entity":{"enum":["contact","company","deal","team","payment","product"],"type":"string"},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalSource":{"anyOf":[{"type":"string"},{"type":"null"}]},"groupId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"multipleValues":{"type":"boolean"},"name":{"type":"string"},"options":{"items":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"label":{"type":"string"}},"required":["id","label","color","archived","externalId"],"type":"object"},"type":"array"},"pipelineIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"position":{"anyOf":[{"minimum":1,"type":"integer"},{"type":"null"}]},"requiredAtPayment":{"anyOf":[{"additionalProperties":false,"properties":{"methodIds":{"items":{"format":"uuid","type":"string"},"maxItems":200,"type":"array"}},"required":["methodIds"],"type":"object"},{"type":"null"}]},"requiredStageIds":{"items":{"format":"uuid","type":"string"},"type":"array"},"requirements":{"items":{"additionalProperties":false,"properties":{"moment":{"type":"string"},"scopeIds":{"items":{"format":"uuid","type":"string"},"type":"array"}},"required":["moment","scopeIds"],"type":"object"},"type":"array"},"showInDeal":{"type":"boolean"},"showOnCard":{"type":"boolean"},"type":{"enum":["text","long_text","number","date","datetime","boolean","choice","multi_choice","url","money","birthday","address"],"type":"string"},"uniqueCheck":{"anyOf":[{"additionalProperties":false,"properties":{"doubles":{"minimum":0,"type":"integer"},"finishedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"moreDoubles":{"type":"boolean"},"startedAt":{"format":"date-time","type":"string"},"state":{"enum":["checking","doubles"],"type":"string"}},"required":["state","doubles","moreDoubles","startedAt","finishedAt"],"type":"object"},{"type":"null"}]},"uniqueValues":{"type":"boolean"},"updatedAt":{"format":"date-time","type":"string"},"version":{"minimum":1,"type":"integer"}},"required":["id","entity","type","name","description","decimals","options","pipelineIds","requiredStageIds","requiredAtPayment","requirements","showOnCard","showInDeal","apiOnly","uniqueValues","uniqueCheck","multipleValues","groupId","position","archived","externalSource","externalId","updatedAt","version"],"type":"object"},"example":{"id":"0192f3a1-7c2e-7b4d-9a61-000000000033","name":"Источник запроса","entity":"deal","type":"choice","description":null,"options":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000034","label":"Сайт","color":"blue","archived":false,"externalId":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000035","label":"Instagram","color":"purple","archived":false,"externalId":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000036","label":"Рекомендация","color":"green","archived":false,"externalId":null}],"decimals":null,"groupId":null,"position":2,"pipelineIds":[],"requiredStageIds":["0192f3a1-7c2e-7b4d-9a61-000000000021"],"requiredAtPayment":null,"requirements":[{"moment":"deal.stage_enter","scopeIds":["0192f3a1-7c2e-7b4d-9a61-000000000021"]}],"showOnCard":true,"showInDeal":false,"apiOnly":false,"uniqueValues":false,"uniqueCheck":null,"multipleValues":false,"archived":false,"externalId":null,"externalSource":null,"updatedAt":"2026-10-20T08:15:00Z","version":1}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/members":{"get":{"operationId":"listMembers","security":[{"bearerAuth":[]}],"summary":"Сотрудники","parameters":[],"description":"Сотрудники организации — ответственные и исполнители записей: сначала работающие, уволенные в конце (`dismissedAt`).","tags":["Справочники"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"active":{"type":"boolean"},"dismissedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"dismissedById":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"email":{"type":"string"},"handOverToId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"role":{"enum":["owner","admin","manager"],"type":"string"},"roleId":{"format":"uuid","type":"string"},"roleName":{"anyOf":[{"type":"string"},{"type":"null"}]},"roleSystemKey":{"anyOf":[{"enum":["owner","admin","manager"],"type":"string"},{"type":"null"}]},"standIn":{"type":"boolean"},"teamId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]}},"required":["id","name","email","role","roleId","roleName","roleSystemKey","active","standIn","dismissedAt","dismissedById","handOverToId","teamId"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000001","name":"Андрей Шевченко","email":"andrii@kavova.ua","role":"owner","roleId":"0192f3a1-7c2e-7b4d-9a61-00000000005a","roleName":null,"roleSystemKey":"owner","active":true,"teamId":null,"standIn":false,"dismissedAt":null,"dismissedById":null,"handOverToId":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000002","name":"Ирина Мельник","email":"iryna@kavova.ua","role":"manager","roleId":"0192f3a1-7c2e-7b4d-9a61-00000000005b","roleName":null,"roleSystemKey":"manager","active":true,"teamId":"0192f3a1-7c2e-7b4d-9a61-00000000005c","standIn":false,"dismissedAt":null,"dismissedById":null,"handOverToId":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000003","name":"Олег Бондарь","email":"oleh@kavova.ua","role":"manager","roleId":"0192f3a1-7c2e-7b4d-9a61-00000000005b","roleName":null,"roleSystemKey":"manager","active":false,"teamId":null,"standIn":false,"dismissedAt":"2026-10-21T12:40:00Z","dismissedById":"0192f3a1-7c2e-7b4d-9a61-000000000001","handOverToId":"0192f3a1-7c2e-7b4d-9a61-000000000002"}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/tags":{"get":{"operationId":"listTags","security":[{"bearerAuth":[]}],"summary":"Теги","parameters":[{"in":"query","name":"status","required":false,"schema":{"default":"active","enum":["active","archived"],"type":"string"}},{"in":"query","name":"usage","required":false,"schema":{"default":false,"type":"boolean"}}],"description":"Теги организации по названию: активные или архивные; `usage=true` добавляет, у скольких записей стоит каждый.","tags":["Справочники"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"archived":{"type":"boolean"},"color":{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalSource":{"anyOf":[{"type":"string"},{"type":"null"}]},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"usage":{"anyOf":[{"additionalProperties":false,"properties":{"companies":{"minimum":0,"type":"integer"},"contacts":{"minimum":0,"type":"integer"},"deals":{"minimum":0,"type":"integer"}},"required":["contacts","companies","deals"],"type":"object"},{"type":"null"}]}},"required":["id","name","color","archived","externalSource","externalId","usage"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-000000000029","name":"Опт","color":"teal","archived":false,"externalId":null,"externalSource":null,"usage":null},{"id":"0192f3a1-7c2e-7b4d-9a61-000000000028","name":"VIP","color":"purple","archived":false,"externalId":null,"externalSource":null,"usage":null}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}},"/teams":{"get":{"operationId":"listTeams","security":[{"bearerAuth":[]}],"summary":"Группы сотрудников","parameters":[],"description":"Группы сотрудников организации по названию, не больше 100. Группа сотрудника — его `teamId` в «Сотрудниках», а её название — здесь: так отчёт называет группу каждого сотрудника. `color` — цвет группы в Alta (`null` — без цвета), `customFields` — значения собственных полей групп («Собственные поля» с `entity=team`), `telegramChatId` — внутренний id Telegram-чата группы в Alta (`null` — не выбран); сами чаты через API не читаются. Группы настраивают в Alta, через API их только читают.","tags":["Справочники"],"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"items":{"items":{"additionalProperties":false,"properties":{"color":{"anyOf":[{"enum":["gray","blue","teal","green","yellow","orange","red","purple"],"type":"string"},{"type":"null"}]},"customFields":{"items":{"additionalProperties":false,"properties":{"fieldId":{"format":"uuid","type":"string"},"value":{"anyOf":[{"type":"string"},{"type":"boolean"},{"items":{"format":"uuid","type":"string"},"type":"array"},{"additionalProperties":false,"properties":{"amount":{"type":"string"},"currency":{"type":"string"}},"required":["amount","currency"],"type":"object"},{"additionalProperties":false,"properties":{"city":{"type":"string"},"country":{"type":"string"},"line":{"type":"string"},"postcode":{"type":"string"}},"type":"object"}]}},"required":["fieldId","value"],"type":"object"},"type":"array"},"id":{"format":"uuid","type":"string"},"name":{"type":"string"},"telegramChatId":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}]},"version":{"minimum":1,"type":"integer"}},"required":["id","name","version","color","customFields","telegramChatId"],"type":"object"},"type":"array"}},"required":["items"],"type":"object"},"example":{"items":[{"id":"0192f3a1-7c2e-7b4d-9a61-00000000005c","name":"Киев","version":2,"color":"blue","customFields":[],"telegramChatId":null},{"id":"0192f3a1-7c2e-7b4d-9a61-00000000005d","name":"Львов","version":1,"color":"teal","customFields":[],"telegramChatId":null}]}}},"description":"Успешный ответ.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}}}}}},"components":{"headers":{"RequestId":{"description":"Server-generated request id; equals error.requestId of an error body and the requestId of the server log lines.","schema":{"pattern":"^req_[0-9a-f]{32}$","type":"string"}}},"schemas":{"ErrorEnvelope":{"additionalProperties":false,"description":"Canonical error envelope (API-001).","properties":{"error":{"additionalProperties":false,"properties":{"code":{"description":"Stable machine-readable error code; clients branch and localize on it.","enum":["MALFORMED_REQUEST","VALIDATION_FAILED","LINK_INVALID","AMBIGUOUS_CREDENTIALS","UNAUTHENTICATED","INVALID_CREDENTIALS","API_KEY_INVALID","API_KEY_REVOKED","FORBIDDEN","ORGANIZATION_SUSPENDED","NO_ACTIVE_MEMBERSHIP","API_KEY_READ_ONLY","API_KEY_WRONG_ADDRESS","OPERATION_NOT_PUBLIC","NOT_FOUND","METHOD_NOT_ALLOWED","REQUEST_TIMEOUT","CONFLICT","NAME_TAKEN","VALUE_TAKEN","PAYLOAD_TOO_LARGE","UNSUPPORTED_MEDIA_TYPE","UPGRADE_REQUIRED","RATE_LIMITED","REQUEST_HEADERS_TOO_LARGE","INTERNAL","SERVICE_UNAVAILABLE"],"type":"string"},"detail":{"description":"Developer-facing English detail. Never contains internals.","type":"string"},"fields":{"description":"Invalid request fields; empty unless the request input was invalid.","items":{"additionalProperties":false,"properties":{"code":{"enum":["REQUIRED","UNKNOWN_PROPERTY","INVALID_TYPE","INVALID_FORMAT","INVALID_VALUE","TOO_SHORT","TOO_LONG","TOO_SMALL","TOO_LARGE","TOO_FEW_ITEMS","TOO_MANY_ITEMS","DUPLICATE_ITEMS","TOO_COMMON","SAME_AS_EMAIL","INVALID"],"type":"string"},"detail":{"description":"Developer-facing English detail; clients localize by code.","type":"string"},"path":{"description":"JSON Pointer of the invalid input, prefixed with the request part: /body/email, /query/limit, /params/contactId.","type":"string"}},"required":["path","code","detail"],"type":"object"},"type":"array"},"held":{"additionalProperties":false,"description":"CONFLICT several_values_held only: the records that hold more than one value of the field.","properties":{"count":{"description":"How many records hold more than one value of it (at least that many when `more`).","minimum":1,"type":"integer"},"fieldId":{"description":"The field «Несколько значений» was to be turned off on.","type":"string"},"more":{"description":"More records hold several values than `count` says.","type":"boolean"},"records":{"description":"The first of them the caller may see (at most ten), to settle them.","items":{"additionalProperties":false,"properties":{"id":{"description":"The record.","type":"string"},"name":{"description":"The record’s name: a deal’s title, a contact’s or a company’s name.","type":"string"},"number":{"description":"A deal’s number within the organization.","type":"integer"},"setAside":{"description":"Present when the record is out of the lists: a deal in the trash, an archived contact or company. It still holds the values; such records come after the others.","enum":["trash","archive"],"type":"string"}},"required":["id","name"],"type":"object"},"type":"array"}},"required":["fieldId","count","more","records"],"type":"object"},"requestId":{"description":"Equals the x-request-id response header and the requestId of the server log lines.","type":"string"},"retryable":{"description":"Whether repeating the same request unchanged may succeed.","type":"boolean"},"taken":{"additionalProperties":false,"description":"VALUE_TAKEN only: who holds the value of the unique field.","properties":{"deal":{"additionalProperties":false,"description":"Absent when the caller may not see that deal.","properties":{"id":{"description":"The deal that holds the value: write to it instead.","type":"string"},"number":{"description":"Its number within the organization.","type":"integer"}},"required":["id","number"],"type":"object"},"fieldId":{"description":"The unique field whose value is taken.","type":"string"}},"required":["fieldId"],"type":"object"}},"required":["code","detail","requestId","retryable","fields"],"type":"object"}},"required":["error"],"type":"object"}},"securitySchemes":{"bearerAuth":{"bearerFormat":"alta_<key id>_<secret>","description":"Ключ API из «Настройки → Ключи API»: `Authorization: Bearer alta_…`. Действует от имени того, кто его создал, в пределах своего доступа («Только чтение» или «Чтение и запись»).","scheme":"bearer","type":"http"}}}}