{"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"}}}}