Угоди
Угоди у воронках: список, картка, створення і зміна, перехід етапами, контакти угоди.
Список угод
GET /deals
Угоди в порядку дошки, сторінками: ліміт ділиться між етапами, щоб було видно кожен; продовження етапу — за курсором із stageCursors. Фільтри за воронкою, етапами, відповідальним, датами, сумою, тегами та власними полями. status=open, won чи lost — лише такі угоди, status=deleted — угоди в кошику. Значення власних полів — лише для полів із customFieldIds; опис угоди — в «Отримати угоду».
Параметри запиту
amountMaxstringшаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$amountMinstringшаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$cfstring[]кількість ≤ 20 · довжина 1–2100
closedFromstring · date-timeclosedTostring · date-timecompanyIdstring · uuidcontactIdstring · uuidcreatedFromstring · date-timecreatedTostring · date-timecurrencystringшаблон
^[A-Z]{3}$cursorstringдовжина 1–512
customFieldIdsstring[] · uuidкількість ≤ 50
excludeStageIdsstring[] · uuidкількість ≤ 100
expectedCloseFromstring · dateexpectedCloseTostring · datelimitinteger1–500 · типово
500noExpectedClosebooleannoOwnerbooleanownerIdstring · uuidownerIdsstring[] · uuidкількість ≤ 100
paymentsstring[]кількість ≤ 4
Значення:
instalment_todayinstalment_overduepartly_paidnot_paidpipelineIdstring · uuidqstringдовжина ≤ 200
sortstringЗначення:
positioncreatedAt-createdAtamount-amounttitle-titlestageEnteredFromstring · date-timestageEnteredTostring · date-timestageIdsstring[] · uuidкількість ≤ 100
statusstringЗначення:
openwonlostdeletedtagIdsstring[] · uuidкількість ≤ 50
tagModestringтипово
anyЗначення:
anyallnonetaskDueFromstring · date-timetaskDueTostring · date-timetasksstring[]кількість ≤ 4
Значення:
noneopenoverduedueupdatedFromstring · date-timeupdatedTostring · date-time
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/deals' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/deals",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/deals', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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": []
}Поля відповіді
itemsobject[]Вкладені поля: 30
amountstringшаблон
^[0-9]{1,12}\.[0-9]{2}$closedAtstring · date-time | nullcompanyobject | nullВкладені поля: 2
idstring · uuidnamestring
contactobject | nullВкладені поля: 3
fullNamestringidstring · uuidphonestring | null
contactsobject[]Вкладені поля: 6
emailstring | nullfullNamestringidstring · uuidjobTitlestring | nullThe contact's own job title, as the contact record has it.
phonestring | nullprimaryboolean
createdAtstring · date-timecurrencystringшаблон
^[A-Z]{3}$customFieldsobject[]Вкладені поля: 3
fieldIdstring · uuidvaluestring | boolean | string[] · uuid | objectВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstringcurrencystring
Варіант 5 · object
citystringcountrystringlinestringpostcodestring
values(string | object)[]Варіант 1 · string
string
Варіант 2 · object
citystringcountrystringlinestringpostcodestring
deletedAtstring · date-time | nulldeletedByobject | nullВкладені поля: 2
idstring · uuidnamestring
expectedCloseDatestring · date | nullidstring · uuidinTrashbooleanTrue while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.
mergedAwaybooleanTrue 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.
mergedIntoobject | nullThe 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.
Вкладені поля: 2
idstring · uuidnumberinteger≥ 1
nextTaskobject | nullВкладені поля: 7
dueAtstring · date-time | nullidstring · uuidkindstringЗначення:
taskcallmeetingemailreminderchatoverduebooleantitlestringtypeobject | nullВкладені поля: 3
iconstringidstring · uuidnamestring
allDayboolean
numberinteger≥ 1
ownerobject | nullВкладені поля: 2
idstring · uuidnamestring
pipelineIdstring · uuidpositionnumberstageEnteredAtstring · date-timestageIdstring · uuidstatusstringЗначення:
openwonlosttagsobject[]Вкладені поля: 3
colorstringЗначення:
graybluetealgreenyelloworangeredpurpleidstring · uuidnamestring
titlestringupdatedAtstring · date-timeversioninteger≥ 1
amountSourcestringЗначення:
manualproductsamountTypeablebooleanviewerMayobjectВкладені поля: 2
deletebooleaneditboolean
nextCursorstring | nullstageCursorsobject[]Вкладені поля: 2
nextCursorstringstageIdstring · uuid
Створити угоду
POST /deals
Потрібна лише назва. Без етапу угода стає на перший етап воронки, без відповідального (ownerId) — на того, хто створює, для ключа — на його автора (в угоди завжди є відповідальний: ownerId: null — 400 owner_required), без валюти — у валюті організації. Обов’язкові поля етапу запит із ключем не зупиняють: угода стає на етап і з порожнім полем (відмову stage_requires_field:<id поля> отримує лише людина в Alta). Значення поля «Унікальне значення», яке вже має інша угода, — 409 VALUE_TAKEN: угода не створюється, а error.taken.deal дає id і номер угоди, що вже є, — пишіть у неї. Повтор запиту створить другу угоду: якщо відповідь не прийшла, спершу пошукайте угоду за контактом.
Тіло запиту
titlestring обов’язководовжина 1–200 · шаблон
\Samountstring | numberшаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99companyIdstring · uuid | nullcontactIdstring · uuid | nullcurrencystringшаблон
^[A-Z]{3}$customFieldsobject[]кількість ≤ 100
Вкладені поля: 3
fieldIdstring · uuid обов’язковоvaluestring | boolean | string[] · uuid | object | nullВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstring обов’язководовжина ≤ 40
currencystring обов’язководовжина ≤ 3
Варіант 5 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
values(string | object)[]кількість ≤ 50
Варіант 1 · string
string
Варіант 2 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
descriptionstring | nullдовжина ≤ 5000
expectedCloseDatestring · date | nullшаблон
^20[0-9]{2}-ownerIdstring · uuid | nullpipelineIdstring · uuidpositionnumber-1000000000000000–1000000000000000
stageIdstring · uuidtagIdsstring[] · uuidкількість ≤ 50
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/deals' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"title": "Кавомашини для мережі кав’ярень",
"amount": "12000.00",
"currency": "UAH",
"contactId": "0192f3a1-7c2e-7b4d-9a61-00000000000a",
"pipelineId": "0192f3a1-7c2e-7b4d-9a61-00000000001e",
"stageId": "0192f3a1-7c2e-7b4d-9a61-00000000001f"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: 'Кавомашини для мережі кав’ярень',
amount: '12000.00',
currency: 'UAH',
contactId: '0192f3a1-7c2e-7b4d-9a61-00000000000a',
pipelineId: '0192f3a1-7c2e-7b4d-9a61-00000000001e',
stageId: '0192f3a1-7c2e-7b4d-9a61-00000000001f',
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/deals",
headers={"Authorization": "Bearer alta_…"},
json={
"title": "Кавомашини для мережі кав’ярень",
"amount": "12000.00",
"currency": "UAH",
"contactId": "0192f3a1-7c2e-7b4d-9a61-00000000000a",
"pipelineId": "0192f3a1-7c2e-7b4d-9a61-00000000001e",
"stageId": "0192f3a1-7c2e-7b4d-9a61-00000000001f",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/deals', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'title' => 'Кавомашини для мережі кав’ярень',
'amount' => '12000.00',
'currency' => 'UAH',
'contactId' => '0192f3a1-7c2e-7b4d-9a61-00000000000a',
'pipelineId' => '0192f3a1-7c2e-7b4d-9a61-00000000001e',
'stageId' => '0192f3a1-7c2e-7b4d-9a61-00000000001f',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 201
Успішна відповідь.
{
"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
}Поля відповіді
amountstringшаблон
^[0-9]{1,12}\.[0-9]{2}$closedAtstring · date-time | nullcompanyobject | nullВкладені поля: 2
idstring · uuidnamestring
contactobject | nullВкладені поля: 3
fullNamestringidstring · uuidphonestring | null
contactsobject[]Вкладені поля: 6
emailstring | nullfullNamestringidstring · uuidjobTitlestring | nullThe contact's own job title, as the contact record has it.
phonestring | nullprimaryboolean
createdAtstring · date-timecurrencystringшаблон
^[A-Z]{3}$customFieldsobject[]Вкладені поля: 3
fieldIdstring · uuidvaluestring | boolean | string[] · uuid | objectВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstringcurrencystring
Варіант 5 · object
citystringcountrystringlinestringpostcodestring
values(string | object)[]Варіант 1 · string
string
Варіант 2 · object
citystringcountrystringlinestringpostcodestring
deletedAtstring · date-time | nulldeletedByobject | nullВкладені поля: 2
idstring · uuidnamestring
descriptionstring | nullexpectedCloseDatestring · date | nullidstring · uuidinTrashbooleanTrue while the deal is in the trash (deletedAt set), false for a live deal; a deal in the trash keeps its status.
mergedAwaybooleanTrue 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.
mergedIntoobject | nullThe 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.
Вкладені поля: 2
idstring · uuidnumberinteger≥ 1
nextTaskobject | nullВкладені поля: 7
dueAtstring · date-time | nullidstring · uuidkindstringЗначення:
taskcallmeetingemailreminderchatoverduebooleantitlestringtypeobject | nullВкладені поля: 3
iconstringidstring · uuidnamestring
allDayboolean
numberinteger≥ 1
ownerobject | nullВкладені поля: 2
idstring · uuidnamestring
pipelineIdstring · uuidpositionnumberstageEnteredAtstring · date-timestageIdstring · uuidstatusstringЗначення:
openwonlosttagsobject[]Вкладені поля: 3
colorstringЗначення:
graybluetealgreenyelloworangeredpurpleidstring · uuidnamestring
titlestringupdatedAtstring · date-timeversioninteger≥ 1
amountSourcestringЗначення:
manualproductsamountTypeablebooleanviewerMayobjectВкладені поля: 2
deletebooleaneditboolean
Отримати угоду
GET /deals/{dealId}
Одна угода за id. Угода в кошику теж відповідає — з inTrash: true, deletedAt і deletedBy; видалена назавжди — 404. Угода, яку об’єднали з іншою, лежить у кошику зі своїм статусом, а mergedInto називає id і номер угоди, у якій вона тепер.
Параметри шляху
dealIdstring · uuid обов’язково
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/deals/{dealId}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/deals/{dealId}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/deals/{dealId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду
Змінити угоду
PATCH /deals/{dealId}
Змінює поля угоди або переносить її на інший етап: етап успіху чи відмови закриває угоду, відкритий етап знову її відкриває. Передайте лише те, що змінюється; 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 рахує її за товарами); та сама сума проходить.
Параметри шляху
dealIdstring · uuid обов’язково
Тіло запиту
amountstring | numberшаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99companyIdstring · uuid | nullcontactIdstring · uuid | nullcurrencystringшаблон
^[A-Z]{3}$customFieldsobject[]кількість ≤ 100
Вкладені поля: 3
fieldIdstring · uuid обов’язковоvaluestring | boolean | string[] · uuid | object | nullВаріант 1 · string
string
Варіант 2 · boolean
boolean
Варіант 3 · string[] · uuid
string[] · uuid
Варіант 4 · object
amountstring обов’язководовжина ≤ 40
currencystring обов’язководовжина ≤ 3
Варіант 5 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
values(string | object)[]кількість ≤ 50
Варіант 1 · string
string
Варіант 2 · object
citystring | nullдовжина ≤ 200
countrystring | nullдовжина ≤ 200
linestring | nullдовжина ≤ 600
postcodestring | nullдовжина ≤ 40
descriptionstring | nullдовжина ≤ 5000
expectedCloseDatestring · date | nullшаблон
^20[0-9]{2}-ownerIdstring · uuid | nullpositionnumber-1000000000000000–1000000000000000
stageIdstring · uuidstatusstringЗначення:
openwonlosttagIdsstring[] · uuidкількість ≤ 50
titlestringдовжина 1–200 · шаблон
\Sversioninteger≥ 1
Приклад запиту
curl -X PATCH 'https://your-company.altahub.ai/api/v1/deals/{dealId}' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"stageId": "0192f3a1-7c2e-7b4d-9a61-000000000021"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}', {
method: 'PATCH',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
stageId: '0192f3a1-7c2e-7b4d-9a61-000000000021',
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://your-company.altahub.ai/api/v1/deals/{dealId}",
headers={"Authorization": "Bearer alta_…"},
json={
"stageId": "0192f3a1-7c2e-7b4d-9a61-000000000021",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://your-company.altahub.ai/api/v1/deals/{dealId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'stageId' => '0192f3a1-7c2e-7b4d-9a61-000000000021',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду
Видалити угоду
DELETE /deals/{dealId}
Переносить угоду в кошик разом із задачами: вона зникає з дошки, списків і пошуку, а через 30 днів видаляється назавжди. Повтор нічого не змінює.
Параметри шляху
dealIdstring · uuid обов’язково
Параметри запиту
versioninteger≥ 1
Приклад запиту
curl -X DELETE 'https://your-company.altahub.ai/api/v1/deals/{dealId}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}', {
method: 'DELETE',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.delete(
"https://your-company.altahub.ai/api/v1/deals/{dealId}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-company.altahub.ai/api/v1/deals/{dealId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду
Звідки береться сума угоди
PUT /deals/{dealId}/amount-source
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. Те саме джерело ще раз нічого не змінює.
Параметри шляху
dealIdstring · uuid обов’язково
Тіло запиту
sourcestring обов’язковоWhere the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)
Значення:
manualproducts
Приклад запиту
curl -X PUT 'https://your-company.altahub.ai/api/v1/deals/{dealId}/amount-source' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"source": "manual"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/amount-source', {
method: 'PUT',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
source: 'manual',
}),
});
const data = await response.json();import requests
response = requests.put(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/amount-source",
headers={"Authorization": "Bearer alta_…"},
json={
"source": "manual",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/amount-source', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'source' => 'manual',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"amount": "84000.00",
"currency": "UAH",
"amountSource": "manual",
"version": 8
}Поля відповіді
amountstringшаблон
^[0-9]+\.[0-9]{2}$amountSourcestringWhere the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)
Значення:
manualproductscurrencystringшаблон
^[A-Z]{3}$versioninteger≥ 1
Додати контакт до угоди
POST /deals/{dealId}/contacts
Перший контакт угоди стає основним, наступні — після нього. Не більше 20 контактів в угоди (409); повтор нічого не змінює.
Параметри шляху
dealIdstring · uuid обов’язково
Тіло запиту
contactIdstring · uuid обов’язково
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"contactId": "0192f3a1-7c2e-7b4d-9a61-00000000000a"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
contactId: '0192f3a1-7c2e-7b4d-9a61-00000000000a',
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts",
headers={"Authorization": "Bearer alta_…"},
json={
"contactId": "0192f3a1-7c2e-7b4d-9a61-00000000000a",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'contactId' => '0192f3a1-7c2e-7b4d-9a61-00000000000a',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду
Прибрати контакт з угоди
DELETE /deals/{dealId}/contacts/{contactId}
Якщо контакт був основним, основним стає доданий найраніше з решти. Повтор нічого не змінює.
Параметри шляху
contactIdstring · uuid обов’язковоdealIdstring · uuid обов’язково
Приклад запиту
curl -X DELETE 'https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}', {
method: 'DELETE',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.delete(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду
Зробити контакт основним
POST /deals/{dealId}/contacts/{contactId}/primary
Попередній основний контакт лишається в угоді; контакт, якого в угоді немає, додається одразу основним.
Параметри шляху
contactIdstring · uuid обов’язковоdealIdstring · uuid обов’язково
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}/primary' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}/primary', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}/primary",
headers={"Authorization": "Bearer alta_…"},
json={},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/contacts/{contactId}/primary', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => new \stdClass(),
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду
Застосувати купон до угоди
PUT /deals/{dealId}/discounts/coupons/{couponId}
Будь-хто, хто може змінювати угоду; купон стає після решти знижок угоди, той самий купон ще раз нічого не змінює. База розкладає його по рядках самої угоди в порядку 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.
Параметри шляху
couponIdstring · uuid обов’язковоdealIdstring · uuid обов’язково
Приклад запиту
curl -X PUT 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}', {
method: 'PUT',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const data = await response.json();import requests
response = requests.put(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}",
headers={"Authorization": "Bearer alta_…"},
json={},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => new \stdClass(),
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}
]
}Поля відповіді
dealobjectВкладені поля: 4
amountstringшаблон
^[0-9]+\.[0-9]{2}$amountSourcestringЗначення:
manualproductscurrencystringшаблон
^[A-Z]{3}$versioninteger≥ 1
discountsobject[]Вкладені поля: 14
amountstringшаблон
^[0-9]+\.[0-9]{2}$capPercentstring | nullшаблон
^[0-9]{1,3}\.[0-9]{2}$couponIdstring · uuid | nullcurrencystring | nullшаблон
^[A-Z]{3}$discountobjectВкладені поля: 2
typestringЗначення:
percentamountvaluestringшаблон
^[0-9]+\.[0-9]{2}$
idstring · uuidinactiveReasonstring | nullЗначення:
amount_typedused_upused_by_clientother_currencyno_matching_productsbelow_minimumkindstringЗначення:
couponmanuallineIdsstring[] · uuidminimumAmountstring | nullшаблон
^[0-9]+\.[0-9]{2}$namestring | nullpositioninteger≥ 1
targetedbooleantargetsobject | nullВкладені поля: 2
categoryIdsstring[] · uuidproductIdsstring[] · uuid
Прибрати купон з угоди
DELETE /deals/{dealId}/discounts/coupons/{couponId}
Використання купона повертається, решта знижок угоди розкладаються заново. Купона на угоді немає — нічого не змінюється.
Параметри шляху
couponIdstring · uuid обов’язковоdealIdstring · uuid обов’язково
Приклад запиту
curl -X DELETE 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}', {
method: 'DELETE',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.delete(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/coupons/{couponId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"deal": {
"amount": "89400.00",
"currency": "UAH",
"amountSource": "products",
"version": 10
},
"discounts": []
}Поля — як у відповіді Застосувати купон до угоди
Знижка на всю угоду
PUT /deals/{dealId}/discounts/manual
Знижка угоди без купона (право «Змінювати ціну в угоді», інакше 403): percent — відсоток від того, що лишилося від угоди до її черги (більше 0, не більше 100), або amount — сума у валюті угоди (не більше того, що лишилося). Одна на угоду; змінена лишається на своєму місці серед знижок і розкладається по рядках, як купон. Не більше «Максимальної знижки» ролі (403 discount_above_role_cap). Та сама знижка ще раз нічого не змінює. 409 imported_lines, amount_kept_by_sync, amount_not_from_products. Межа ролі того, хто дав знижку, лишається з нею (capPercent): вона ніколи не бере більше цієї частки того, що лишилося, хоч би як змінювалися рядки потім.
Параметри шляху
dealIdstring · uuid обов’язково
Тіло запиту
typestring обов’язковоA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestring | number обов’язковошаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99
Приклад запиту
curl -X PUT 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"type": "percent",
"value": "5"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual', {
method: 'PUT',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'percent',
value: '5',
}),
});
const data = await response.json();import requests
response = requests.put(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual",
headers={"Authorization": "Bearer alta_…"},
json={
"type": "percent",
"value": "5",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'type' => 'percent',
'value' => '5',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}
]
}Поля — як у відповіді Застосувати купон до угоди
Прибрати знижку на угоду
DELETE /deals/{dealId}/discounts/manual
Право «Змінювати ціну в угоді», інакше 403; решта знижок розкладаються заново. Знижки немає — нічого не змінюється.
Параметри шляху
dealIdstring · uuid обов’язково
Приклад запиту
curl -X DELETE 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual', {
method: 'DELETE',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.delete(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/discounts/manual', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"deal": {
"amount": "89400.00",
"currency": "UAH",
"amountSource": "products",
"version": 12
},
"discounts": []
}Поля — як у відповіді Застосувати купон до угоди
Товари угоди
GET /deals/{dealId}/products
Рядки угоди за порядком: товар каталогу і ціна, за якою його взяли; назва, артикул і одиниця — якими були в момент додавання; кількість, ціна за одиницю, за якою рядок продається (price), своя ціна рядка до знижки (priceBeforeDiscount) і знижка (discount, null — без знижки), ціна каталогу на той момент (listPrice) і сума рядка: кількість × price. Рядки іншої системи (imported) лише для читання. amountSource: сума угоди введена вручну (manual) або рахується з її товарів (products).
Параметри шляху
dealIdstring · uuid обов’язково
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/products', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/products",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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": []
}Поля відповіді
amountSourcestringWhere the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)
Значення:
manualproductsdiscountsobject[]Вкладені поля: 14
amountstringшаблон
^[0-9]+\.[0-9]{2}$capPercentstring | nullшаблон
^[0-9]{1,3}\.[0-9]{2}$couponIdstring · uuid | nullcurrencystring | nullшаблон
^[A-Z]{3}$discountobjectВкладені поля: 2
typestringЗначення:
percentamountvaluestringшаблон
^[0-9]+\.[0-9]{2}$
idstring · uuidinactiveReasonstring | nullЗначення:
amount_typedused_upused_by_clientother_currencyno_matching_productsbelow_minimumkindstringЗначення:
couponmanuallineIdsstring[] · uuidminimumAmountstring | nullшаблон
^[0-9]+\.[0-9]{2}$namestring | nullpositioninteger≥ 1
targetedbooleantargetsobject | nullВкладені поля: 2
categoryIdsstring[] · uuidproductIdsstring[] · uuid
itemsobject[]Вкладені поля: 20
amountstringшаблон
^[0-9]+\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$discountobject | nullВкладені поля: 2
typestringA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestringшаблон
^[0-9]+\.[0-9]{2}$
discountsobject[]Вкладені поля: 2
amountstringшаблон
^[0-9]+\.[0-9]{2}$discountIdstring · uuid
idstring · uuidimportedbooleanlistPricestring | nullшаблон
^[0-9]+\.[0-9]{2}$namestringpositionintegerpricestringшаблон
^[0-9]+\.[0-9]{2}$priceBeforeDiscountstringшаблон
^[0-9]+\.[0-9]{2}$priceIdstring · uuid | nullproductIdstring · uuid | nullquantitystringrateIdstring · uuid | nullskustring | nulltotalstringшаблон
^[0-9]+\.[0-9]{2}$unitstring | nullversioninteger≥ 1
taxobject | nullВкладені поля: 6
amountstringшаблон
^[0-9]+\.[0-9]{2}$basestringшаблон
^[0-9]+\.[0-9]{2}$inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
totalsobject[]Вкладені поля: 2
amountstringшаблон
^[0-9]+\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$
amountKeptBySyncbooleanTrue 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`
taxesobject[]Вкладені поля: 6
amountstringшаблон
^[0-9]+\.[0-9]{2}$basestringшаблон
^[0-9]+\.[0-9]{2}$inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
Додати товар до угоди
POST /deals/{dealId}/products
Товар каталогу стає в кінець, у валюті угоди: 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 після втраченої відповіді поверне той самий рядок.
Параметри шляху
dealIdstring · uuid обов’язково
Тіло запиту
productIdstring · uuid обов’язковоdiscountobjectВкладені поля: 2
typestring обов’язковоA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestring | number обов’язковошаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99
idempotencyKeystringшаблон
^[\x21-\x7e]{1,255}$pricestring | numberшаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99priceIdstring · uuidquantitystring | numberшаблон
^[0-9]{1,8}(\.[0-9]{1,3})?$· > 0, ≤ 99999999.999
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"productId": "0192f3a1-7c2e-7b4d-9a61-000000000067",
"priceId": "0192f3a1-7c2e-7b4d-9a61-00000000006a",
"quantity": "1",
"discount": {
"type": "percent",
"value": "10"
}
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/products', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
productId: '0192f3a1-7c2e-7b4d-9a61-000000000067',
priceId: '0192f3a1-7c2e-7b4d-9a61-00000000006a',
quantity: '1',
discount: {
type: 'percent',
value: '10',
},
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/products",
headers={"Authorization": "Bearer alta_…"},
json={
"productId": "0192f3a1-7c2e-7b4d-9a61-000000000067",
"priceId": "0192f3a1-7c2e-7b4d-9a61-00000000006a",
"quantity": "1",
"discount": {
"type": "percent",
"value": "10",
},
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'productId' => '0192f3a1-7c2e-7b4d-9a61-000000000067',
'priceId' => '0192f3a1-7c2e-7b4d-9a61-00000000006a',
'quantity' => '1',
'discount' => [
'type' => 'percent',
'value' => '10',
],
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 201
Успішна відповідь.
{
"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
}
}Поля відповіді
dealobjectВкладені поля: 4
amountstringшаблон
^[0-9]+\.[0-9]{2}$amountSourcestringWhere the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)
Значення:
manualproductscurrencystringшаблон
^[A-Z]{3}$versioninteger≥ 1
lineobjectВкладені поля: 20
amountstringшаблон
^[0-9]+\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$discountobject | nullВкладені поля: 2
typestringA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestringшаблон
^[0-9]+\.[0-9]{2}$
discountsobject[]Вкладені поля: 2
amountstringшаблон
^[0-9]+\.[0-9]{2}$discountIdstring · uuid
idstring · uuidimportedbooleanlistPricestring | nullшаблон
^[0-9]+\.[0-9]{2}$namestringpositionintegerpricestringшаблон
^[0-9]+\.[0-9]{2}$priceBeforeDiscountstringшаблон
^[0-9]+\.[0-9]{2}$priceIdstring · uuid | nullproductIdstring · uuid | nullquantitystringrateIdstring · uuid | nullskustring | nulltotalstringшаблон
^[0-9]+\.[0-9]{2}$unitstring | nullversioninteger≥ 1
taxobject | nullВкладені поля: 6
amountstringшаблон
^[0-9]+\.[0-9]{2}$basestringшаблон
^[0-9]+\.[0-9]{2}$inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
amountSourceChangedboolean
Змінити товар угоди
PATCH /deals/{dealId}/products/{lineId}
Кількість, інша ціна товару у валюті угоди (priceId: її сума стає ціною рядка) або своя ціна (price, право «Змінювати ціну в угоді»). Без discount price і priceId — ціна, за якою рядок продається, як до знижок: та сама, що зараз (прочитаний рядок, надісланий назад), нічого не змінює, знижка лишається; інша — рядок продається рівно за нею, знижка знімається. З discount (те саме право, якщо знижка змінюється) price і priceId — ціна до знижки, а discount — знижка рядка на одиницю (null — без знижки); але price, що дорівнює ціні продажу, разом із тією самою знижкою (прочитаний рядок, надісланий цілком) нічого не змінює — знижка не застосовується двічі. Зміна самої кількості знижку зберігає. З version рядка, яку ви прочитали: його встигли змінити — 409. Рядок іншої системи — 409 imported_line. Поки сума угоди з товарів, вона перераховується.
Параметри шляху
dealIdstring · uuid обов’язковоlineIdstring · uuid обов’язково
Тіло запиту
discountobject | nullВкладені поля: 2
typestring обов’язковоA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestring | number обов’язковошаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99
pricestring | numberшаблон
^[0-9]{1,12}(\.[0-9]{1,2})?$· 0–999999999999.99priceIdstring · uuidquantitystring | numberшаблон
^[0-9]{1,8}(\.[0-9]{1,3})?$· > 0, ≤ 99999999.999versioninteger≥ 1
Приклад запиту
curl -X PATCH 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"quantity": "2",
"price": "42000",
"version": 1
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}', {
method: 'PATCH',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
quantity: '2',
price: '42000',
version: 1,
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}",
headers={"Authorization": "Bearer alta_…"},
json={
"quantity": "2",
"price": "42000",
"version": 1,
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'quantity' => '2',
'price' => '42000',
'version' => 1,
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}
}Поля — як у відповіді Додати товар до угоди
Прибрати товар з угоди
DELETE /deals/{dealId}/products/{lineId}
Рядок іншої системи не прибрати (409 imported_line). Поки сума угоди з товарів, вона перераховується; у відповіді — нова сума угоди. Коли прибрано останній власний рядок, сума знову вводиться вручну (amountSource manual) і лишається такою, якою була з цим рядком.
Параметри шляху
dealIdstring · uuid обов’язковоlineIdstring · uuid обов’язково
Приклад запиту
curl -X DELETE 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}', {
method: 'DELETE',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.delete(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products/{lineId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"deal": {
"amount": "84000.00",
"currency": "UAH",
"amountSource": "products",
"version": 7
}
}Поля відповіді
dealobjectВкладені поля: 4
amountstringшаблон
^[0-9]+\.[0-9]{2}$amountSourcestringWhere the deal's amount comes from: typed (`manual`) or the sum of its own product lines (`products`)
Значення:
manualproductscurrencystringшаблон
^[A-Z]{3}$versioninteger≥ 1
Порядок товарів угоди
PUT /deals/{dealId}/products/order
lineIds — усі рядки самої угоди рівно по разу, у новому порядку (інакше 409 order_mismatch); рядки іншої системи стоять на своїх місцях. В історії угоди не позначається.
Параметри шляху
dealIdstring · uuid обов’язково
Тіло запиту
lineIdsstring[] · uuid обов’язковокількість ≤ 400 · без повторів
Приклад запиту
curl -X PUT 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products/order' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"lineIds": [
"0192f3a1-7c2e-7b4d-9a61-000000000902",
"0192f3a1-7c2e-7b4d-9a61-000000000901"
]
}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/products/order', {
method: 'PUT',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
lineIds: [
'0192f3a1-7c2e-7b4d-9a61-000000000902',
'0192f3a1-7c2e-7b4d-9a61-000000000901',
],
}),
});
const data = await response.json();import requests
response = requests.put(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/products/order",
headers={"Authorization": "Bearer alta_…"},
json={
"lineIds": [
"0192f3a1-7c2e-7b4d-9a61-000000000902",
"0192f3a1-7c2e-7b4d-9a61-000000000901",
],
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/products/order', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'lineIds' => [
'0192f3a1-7c2e-7b4d-9a61-000000000902',
'0192f3a1-7c2e-7b4d-9a61-000000000901',
],
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}
]
}Поля відповіді
itemsobject[]Вкладені поля: 20
amountstringшаблон
^[0-9]+\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$discountobject | nullВкладені поля: 2
typestringA percentage of the price before the discount (`percent`) or an amount of the line's currency (`amount`), per unit
Значення:
percentamountvaluestringшаблон
^[0-9]+\.[0-9]{2}$
discountsobject[]Вкладені поля: 2
amountstringшаблон
^[0-9]+\.[0-9]{2}$discountIdstring · uuid
idstring · uuidimportedbooleanlistPricestring | nullшаблон
^[0-9]+\.[0-9]{2}$namestringpositionintegerpricestringшаблон
^[0-9]+\.[0-9]{2}$priceBeforeDiscountstringшаблон
^[0-9]+\.[0-9]{2}$priceIdstring · uuid | nullproductIdstring · uuid | nullquantitystringrateIdstring · uuid | nullskustring | nulltotalstringшаблон
^[0-9]+\.[0-9]{2}$unitstring | nullversioninteger≥ 1
taxobject | nullВкладені поля: 6
amountstringшаблон
^[0-9]+\.[0-9]{2}$basestringшаблон
^[0-9]+\.[0-9]{2}$inclusivebooleannamestringratestringшаблон
^[0-9]{1,3}\.[0-9]{2}$taxRateIdstring · uuid
Відновити угоду
POST /deals/{dealId}/restore
Повертає угоду з кошика такою, як була, разом із задачами. Видалена назавжди — 404. Угода в кошику не тримає значень унікальних полів: якщо одне з них тим часом узяла інша угода — 409 VALUE_TAKEN (error.taken).
Параметри шляху
dealIdstring · uuid обов’язково
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/deals/{dealId}/restore' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{}'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/{dealId}/restore', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/deals/{dealId}/restore",
headers={"Authorization": "Bearer alta_…"},
json={},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/deals/{dealId}/restore', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => new \stdClass(),
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду
Угода за номером
GET /deals/by-number/{number}
Угода за її номером в організації, а імпортована — ще й за id у попередній системі.
Параметри шляху
numberstring обов’язковошаблон
^[1-9][0-9]{0,8}$
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/deals/by-number/{number}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/deals/by-number/{number}', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/deals/by-number/{number}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/deals/by-number/{number}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"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
}Поля — як у відповіді Створити угоду