Компанії
Організації клієнтів; до компанії прив’язуються контакти та угоди.
Список компаній
GET /companies
Сторінками, за назвою. Пошук q за назвою, поштою, сайтом і цифрами телефону; фільтри за відповідальним, датами, угодами, тегами та власними полями.
Параметри запиту
archivedbooleanтипово
falsecfstring[]кількість ≤ 20 · довжина 1–2100
createdFromstring · date-timecreatedTostring · date-timecreatorIdsstring[] · uuidкількість ≤ 100
cursorstringдовжина 1–512
dealsstring[]кількість ≤ 2
Значення:
opennoneemailstringдовжина ≤ 100
limitinteger1–100 · типово
50noOwnerbooleanownerIdstring · uuidownerIdsstring[] · uuidкількість ≤ 100
phonestringдовжина ≤ 100
qstringдовжина ≤ 200
stageIdsstring[] · uuidкількість ≤ 100
tagIdsstring[] · uuidкількість ≤ 50
tagModestringтипово
anyЗначення:
anyallnoneupdatedFromstring · date-timeupdatedTostring · date-time
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/companies' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/companies', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/companies",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/companies', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"items": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-00000000000b",
"name": "ТОВ «Кавова гільдія»",
"industry": "Ресторани та кав’ярні",
"website": "kavova.ua",
"phone": "+380442223344",
"email": "info@kavova.ua",
"owner": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"tags": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000029",
"name": "Опт",
"color": "teal"
}
],
"customFields": [],
"contactCount": 1,
"openDealsAmount": {
"amount": "12000.00",
"currency": "UAH"
},
"openDealsOtherCurrencies": [],
"archivedAt": null,
"createdAt": "2026-10-20T08:15:00Z",
"updatedAt": "2026-10-24T16:45:00Z",
"version": 1
}
],
"nextCursor": null
}Поля відповіді
itemsobject[]Вкладені поля: 16
archivedAtstring · date-time | nullcontactCountinteger≥ 0
createdAtstring · date-timecustomFieldsobject[]Вкладені поля: 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
emailstring | nullidstring · uuidindustrystring | nullnamestringopenDealsAmountobject | nullВкладені поля: 2
amountstringшаблон
^[0-9]{1,12}\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$
openDealsOtherCurrenciesobject[]Вкладені поля: 2
amountstringшаблон
^[0-9]{1,12}\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$
ownerobject | nullВкладені поля: 2
idstring · uuidnamestring
phonestring | nulltagsobject[]Вкладені поля: 3
colorstringЗначення:
graybluetealgreenyelloworangeredpurpleidstring · uuidnamestring
updatedAtstring · date-timeversioninteger≥ 1
websitestring | null
nextCursorstring | null
Створити компанію
POST /companies
Потрібна лише назва. Без відповідального (ownerId) компанія дістається тому, хто створює, для ключа — його автору (у компанії завжди є відповідальний: ownerId: null — 400 owner_required). Повтор запиту створить другу компанію: якщо відповідь не прийшла, спершу пошукайте компанію.
Тіло запиту
namestring обов’язководовжина 1–200 · шаблон
\ScustomFieldsobject[]кількість ≤ 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
emailstring | nullдовжина ≤ 254
industrystring | nullдовжина ≤ 100
ownerIdstring · uuid | nullphonestring | nullдовжина ≤ 50
tagIdsstring[] · uuidкількість ≤ 50
websitestring | nullдовжина ≤ 300
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/companies' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"name": "ТОВ «Кавова гільдія»",
"phone": "+380442223344",
"email": "info@kavova.ua",
"website": "kavova.ua"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/companies', {
method: 'POST',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'ТОВ «Кавова гільдія»',
phone: '+380442223344',
email: 'info@kavova.ua',
website: 'kavova.ua',
}),
});
const data = await response.json();import requests
response = requests.post(
"https://your-company.altahub.ai/api/v1/companies",
headers={"Authorization": "Bearer alta_…"},
json={
"name": "ТОВ «Кавова гільдія»",
"phone": "+380442223344",
"email": "info@kavova.ua",
"website": "kavova.ua",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/companies', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'name' => 'ТОВ «Кавова гільдія»',
'phone' => '+380442223344',
'email' => 'info@kavova.ua',
'website' => 'kavova.ua',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 201
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-00000000000b",
"name": "ТОВ «Кавова гільдія»",
"industry": null,
"website": "kavova.ua",
"phone": "+380442223344",
"email": "info@kavova.ua",
"owner": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000001",
"name": "Андрій Шевченко"
},
"tags": [],
"customFields": [],
"contactCount": 0,
"openDealsAmount": null,
"openDealsOtherCurrencies": [],
"archivedAt": null,
"createdAt": "2026-10-20T08:15:00Z",
"updatedAt": "2026-10-20T08:15:00Z",
"version": 1
}Поля відповіді
archivedAtstring · date-time | nullcontactCountinteger≥ 0
createdAtstring · date-timecustomFieldsobject[]Вкладені поля: 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
emailstring | nullidstring · uuidindustrystring | nullnamestringopenDealsAmountobject | nullВкладені поля: 2
amountstringшаблон
^[0-9]{1,12}\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$
openDealsOtherCurrenciesobject[]Вкладені поля: 2
amountstringшаблон
^[0-9]{1,12}\.[0-9]{2}$currencystringшаблон
^[A-Z]{3}$
ownerobject | nullВкладені поля: 2
idstring · uuidnamestring
phonestring | nulltagsobject[]Вкладені поля: 3
colorstringЗначення:
graybluetealgreenyelloworangeredpurpleidstring · uuidnamestring
updatedAtstring · date-timeversioninteger≥ 1
websitestring | null
Отримати компанію
GET /companies/{companyId}
Одна компанія за id: з кількістю контактів і сумою відкритих угод.
Параметри шляху
companyIdstring · uuid обов’язково
Приклад запиту
curl 'https://your-company.altahub.ai/api/v1/companies/{companyId}' \
-H 'Authorization: Bearer alta_…'const response = await fetch('https://your-company.altahub.ai/api/v1/companies/{companyId}', {
method: 'GET',
headers: {
Authorization: 'Bearer alta_…',
},
});
const data = await response.json();import requests
response = requests.get(
"https://your-company.altahub.ai/api/v1/companies/{companyId}",
headers={"Authorization": "Bearer alta_…"},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/companies/{companyId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-00000000000b",
"name": "ТОВ «Кавова гільдія»",
"industry": "Ресторани та кав’ярні",
"website": "kavova.ua",
"phone": "+380442223344",
"email": "info@kavova.ua",
"owner": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"tags": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000029",
"name": "Опт",
"color": "teal"
}
],
"customFields": [],
"contactCount": 1,
"openDealsAmount": {
"amount": "12000.00",
"currency": "UAH"
},
"openDealsOtherCurrencies": [],
"archivedAt": null,
"createdAt": "2026-10-20T08:15:00Z",
"updatedAt": "2026-10-24T16:45:00Z",
"version": 1
}Поля — як у відповіді Створити компанію
Змінити компанію
PATCH /companies/{companyId}
Передайте лише те, що змінюється; version необов’язковий: з ним зміна пройде, лише якщо запис не змінили після вашого читання (інакше 409 CONFLICT). ownerId передає компанію іншому співробітнику; прибрати відповідального не можна: ownerId: null — 400 owner_required (без ownerId відповідальний лишається колишнім).
Параметри шляху
companyIdstring · uuid обов’язково
Тіло запиту
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
emailstring | nullдовжина ≤ 254
industrystring | nullдовжина ≤ 100
namestringдовжина 1–200 · шаблон
\SownerIdstring · uuid | nullphonestring | nullдовжина ≤ 50
tagIdsstring[] · uuidкількість ≤ 50
versioninteger≥ 1
websitestring | nullдовжина ≤ 300
Приклад запиту
curl -X PATCH 'https://your-company.altahub.ai/api/v1/companies/{companyId}' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{
"industry": "Ресторани та кав’ярні"
}'const response = await fetch('https://your-company.altahub.ai/api/v1/companies/{companyId}', {
method: 'PATCH',
headers: {
Authorization: 'Bearer alta_…',
'Content-Type': 'application/json',
},
body: JSON.stringify({
industry: 'Ресторани та кав’ярні',
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://your-company.altahub.ai/api/v1/companies/{companyId}",
headers={"Authorization": "Bearer alta_…"},
json={
"industry": "Ресторани та кав’ярні",
},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://your-company.altahub.ai/api/v1/companies/{companyId}', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => [
'industry' => 'Ресторани та кав’ярні',
],
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-00000000000b",
"name": "ТОВ «Кавова гільдія»",
"industry": "Ресторани та кав’ярні",
"website": "kavova.ua",
"phone": "+380442223344",
"email": "info@kavova.ua",
"owner": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"tags": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000029",
"name": "Опт",
"color": "teal"
}
],
"customFields": [],
"contactCount": 1,
"openDealsAmount": {
"amount": "12000.00",
"currency": "UAH"
},
"openDealsOtherCurrencies": [],
"archivedAt": null,
"createdAt": "2026-10-20T08:15:00Z",
"updatedAt": "2026-10-24T16:45:00Z",
"version": 2
}Поля — як у відповіді Створити компанію
Прибрати компанію в архів
POST /companies/{companyId}/archive
Компанія зникає зі списків (видно з archived=true). Повтор нічого не змінює.
Параметри шляху
companyIdstring · uuid обов’язково
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/companies/{companyId}/archive' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{}'const response = await fetch('https://your-company.altahub.ai/api/v1/companies/{companyId}/archive', {
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/companies/{companyId}/archive",
headers={"Authorization": "Bearer alta_…"},
json={},
)
data = response.json()<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-company.altahub.ai/api/v1/companies/{companyId}/archive', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => new \stdClass(),
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-00000000000b",
"name": "ТОВ «Кавова гільдія»",
"industry": "Ресторани та кав’ярні",
"website": "kavova.ua",
"phone": "+380442223344",
"email": "info@kavova.ua",
"owner": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"tags": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000029",
"name": "Опт",
"color": "teal"
}
],
"customFields": [],
"contactCount": 1,
"openDealsAmount": {
"amount": "12000.00",
"currency": "UAH"
},
"openDealsOtherCurrencies": [],
"archivedAt": "2026-10-24T16:45:00Z",
"createdAt": "2026-10-20T08:15:00Z",
"updatedAt": "2026-10-24T16:45:00Z",
"version": 2
}Поля — як у відповіді Створити компанію
Повернути компанію з архіву
POST /companies/{companyId}/restore
Компанія знову в списках. Повтор нічого не змінює.
Параметри шляху
companyIdstring · uuid обов’язково
Приклад запиту
curl -X POST 'https://your-company.altahub.ai/api/v1/companies/{companyId}/restore' \
-H 'Authorization: Bearer alta_…' \
-H 'Content-Type: application/json' \
-d '{}'const response = await fetch('https://your-company.altahub.ai/api/v1/companies/{companyId}/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/companies/{companyId}/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/companies/{companyId}/restore', [
'headers' => ['Authorization' => 'Bearer alta_…'],
'json' => new \stdClass(),
]);
$data = json_decode((string) $response->getBody(), true);Відповідь 200
Успішна відповідь.
{
"id": "0192f3a1-7c2e-7b4d-9a61-00000000000b",
"name": "ТОВ «Кавова гільдія»",
"industry": "Ресторани та кав’ярні",
"website": "kavova.ua",
"phone": "+380442223344",
"email": "info@kavova.ua",
"owner": {
"id": "0192f3a1-7c2e-7b4d-9a61-000000000002",
"name": "Ірина Мельник"
},
"tags": [
{
"id": "0192f3a1-7c2e-7b4d-9a61-000000000029",
"name": "Опт",
"color": "teal"
}
],
"customFields": [],
"contactCount": 1,
"openDealsAmount": {
"amount": "12000.00",
"currency": "UAH"
},
"openDealsOtherCurrencies": [],
"archivedAt": null,
"createdAt": "2026-10-20T08:15:00Z",
"updatedAt": "2026-10-24T16:45:00Z",
"version": 3
}Поля — як у відповіді Створити компанію