Сделки
Сделки в воронках: список, карточка, создание и изменение, переход по этапам, контакты сделки.
Список сделок
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
}Поля — как в ответе Создать сделку