До змісту
Скачати OpenAPI

Компанії

Організації клієнтів; до компанії прив’язуються контакти та угоди.

Список компаній

GET /companies

Сторінками, за назвою. Пошук q за назвою, поштою, сайтом і цифрами телефону; фільтри за відповідальним, датами, угодами, тегами та власними полями.

Параметри запиту

  • archived boolean

    типово false

  • cf string[]

    кількість ≤ 20 · довжина 1–2100

  • createdFrom string · date-time

  • createdTo string · date-time

  • creatorIds string[] · uuid

    кількість ≤ 100

  • cursor string

    довжина 1–512

  • deals string[]

    кількість ≤ 2

    Значення: open none

  • email string

    довжина ≤ 100

  • limit integer

    1–100 · типово 50

  • noOwner boolean

  • ownerId string · uuid

  • ownerIds string[] · uuid

    кількість ≤ 100

  • phone string

    довжина ≤ 100

  • q string

    довжина ≤ 200

  • stageIds string[] · uuid

    кількість ≤ 100

  • tagIds string[] · uuid

    кількість ≤ 50

  • tagMode string

    типово any

    Значення: any all none

  • updatedFrom string · date-time

  • updatedTo string · date-time

Приклад запиту

bash
curl 'https://your-company.altahub.ai/api/v1/companies' \
  -H 'Authorization: Bearer alta_…'
js
const response = await fetch('https://your-company.altahub.ai/api/v1/companies', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer alta_…',
  },
});
const data = await response.json();
python
import requests

response = requests.get(
    "https://your-company.altahub.ai/api/v1/companies",
    headers={"Authorization": "Bearer alta_…"},
)
data = response.json()
php
<?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

Успішна відповідь.

json
{
  "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
}
Поля відповіді
  • items object[]

    Вкладені поля: 16
    • archivedAt string · date-time | null

    • contactCount integer

      ≥ 0

    • createdAt string · date-time

    • customFields object[]

      Вкладені поля: 3
      • fieldId string · uuid

      • value string | boolean | string[] · uuid | object

        Варіант 1 · string

        string

        Варіант 2 · boolean

        boolean

        Варіант 3 · string[] · uuid

        string[] · uuid

        Варіант 4 · object
        • amount string

        • currency string

        Варіант 5 · object
        • city string

        • country string

        • line string

        • postcode string

      • values (string | object)[]

        Варіант 1 · string

        string

        Варіант 2 · object
        • city string

        • country string

        • line string

        • postcode string

    • email string | null

    • id string · uuid

    • industry string | null

    • name string

    • openDealsAmount object | null

      Вкладені поля: 2
      • amount string

        шаблон ^[0-9]{1,12}\.[0-9]{2}$

      • currency string

        шаблон ^[A-Z]{3}$

    • openDealsOtherCurrencies object[]

      Вкладені поля: 2
      • amount string

        шаблон ^[0-9]{1,12}\.[0-9]{2}$

      • currency string

        шаблон ^[A-Z]{3}$

    • owner object | null

      Вкладені поля: 2
      • id string · uuid

      • name string

    • phone string | null

    • tags object[]

      Вкладені поля: 3
      • color string

        Значення: gray blue teal green yellow orange red purple

      • id string · uuid

      • name string

    • updatedAt string · date-time

    • version integer

      ≥ 1

    • website string | null

  • nextCursor string | null

Створити компанію

POST /companies

Потрібна лише назва. Без відповідального (ownerId) компанія дістається тому, хто створює, для ключа — його автору (у компанії завжди є відповідальний: ownerId: null — 400 owner_required). Повтор запиту створить другу компанію: якщо відповідь не прийшла, спершу пошукайте компанію.

Тіло запиту

  • name string обов’язково

    довжина 1–200 · шаблон \S

  • customFields object[]

    кількість ≤ 100

    Вкладені поля: 3
    • fieldId string · uuid обов’язково

    • value string | boolean | string[] · uuid | object | null

      Варіант 1 · string

      string

      Варіант 2 · boolean

      boolean

      Варіант 3 · string[] · uuid

      string[] · uuid

      Варіант 4 · object
      • amount string обов’язково

        довжина ≤ 40

      • currency string обов’язково

        довжина ≤ 3

      Варіант 5 · object
      • city string | null

        довжина ≤ 200

      • country string | null

        довжина ≤ 200

      • line string | null

        довжина ≤ 600

      • postcode string | null

        довжина ≤ 40

    • values (string | object)[]

      кількість ≤ 50

      Варіант 1 · string

      string

      Варіант 2 · object
      • city string | null

        довжина ≤ 200

      • country string | null

        довжина ≤ 200

      • line string | null

        довжина ≤ 600

      • postcode string | null

        довжина ≤ 40

  • email string | null

    довжина ≤ 254

  • industry string | null

    довжина ≤ 100

  • ownerId string · uuid | null

  • phone string | null

    довжина ≤ 50

  • tagIds string[] · uuid

    кількість ≤ 50

  • website string | null

    довжина ≤ 300

Приклад запиту

bash
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"
}'
js
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();
python
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
<?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

Успішна відповідь.

json
{
  "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
}
Поля відповіді
  • archivedAt string · date-time | null

  • contactCount integer

    ≥ 0

  • createdAt string · date-time

  • customFields object[]

    Вкладені поля: 3
    • fieldId string · uuid

    • value string | boolean | string[] · uuid | object

      Варіант 1 · string

      string

      Варіант 2 · boolean

      boolean

      Варіант 3 · string[] · uuid

      string[] · uuid

      Варіант 4 · object
      • amount string

      • currency string

      Варіант 5 · object
      • city string

      • country string

      • line string

      • postcode string

    • values (string | object)[]

      Варіант 1 · string

      string

      Варіант 2 · object
      • city string

      • country string

      • line string

      • postcode string

  • email string | null

  • id string · uuid

  • industry string | null

  • name string

  • openDealsAmount object | null

    Вкладені поля: 2
    • amount string

      шаблон ^[0-9]{1,12}\.[0-9]{2}$

    • currency string

      шаблон ^[A-Z]{3}$

  • openDealsOtherCurrencies object[]

    Вкладені поля: 2
    • amount string

      шаблон ^[0-9]{1,12}\.[0-9]{2}$

    • currency string

      шаблон ^[A-Z]{3}$

  • owner object | null

    Вкладені поля: 2
    • id string · uuid

    • name string

  • phone string | null

  • tags object[]

    Вкладені поля: 3
    • color string

      Значення: gray blue teal green yellow orange red purple

    • id string · uuid

    • name string

  • updatedAt string · date-time

  • version integer

    ≥ 1

  • website string | null

Отримати компанію

GET /companies/{companyId}

Одна компанія за id: з кількістю контактів і сумою відкритих угод.

Параметри шляху

  • companyId string · uuid обов’язково

Приклад запиту

bash
curl 'https://your-company.altahub.ai/api/v1/companies/{companyId}' \
  -H 'Authorization: Bearer alta_…'
js
const response = await fetch('https://your-company.altahub.ai/api/v1/companies/{companyId}', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer alta_…',
  },
});
const data = await response.json();
python
import requests

response = requests.get(
    "https://your-company.altahub.ai/api/v1/companies/{companyId}",
    headers={"Authorization": "Bearer alta_…"},
)
data = response.json()
php
<?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

Успішна відповідь.

json
{
  "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 відповідальний лишається колишнім).

Параметри шляху

  • companyId string · uuid обов’язково

Тіло запиту

  • customFields object[]

    кількість ≤ 100

    Вкладені поля: 3
    • fieldId string · uuid обов’язково

    • value string | boolean | string[] · uuid | object | null

      Варіант 1 · string

      string

      Варіант 2 · boolean

      boolean

      Варіант 3 · string[] · uuid

      string[] · uuid

      Варіант 4 · object
      • amount string обов’язково

        довжина ≤ 40

      • currency string обов’язково

        довжина ≤ 3

      Варіант 5 · object
      • city string | null

        довжина ≤ 200

      • country string | null

        довжина ≤ 200

      • line string | null

        довжина ≤ 600

      • postcode string | null

        довжина ≤ 40

    • values (string | object)[]

      кількість ≤ 50

      Варіант 1 · string

      string

      Варіант 2 · object
      • city string | null

        довжина ≤ 200

      • country string | null

        довжина ≤ 200

      • line string | null

        довжина ≤ 600

      • postcode string | null

        довжина ≤ 40

  • email string | null

    довжина ≤ 254

  • industry string | null

    довжина ≤ 100

  • name string

    довжина 1–200 · шаблон \S

  • ownerId string · uuid | null

  • phone string | null

    довжина ≤ 50

  • tagIds string[] · uuid

    кількість ≤ 50

  • version integer

    ≥ 1

  • website string | null

    довжина ≤ 300

Приклад запиту

bash
curl -X PATCH 'https://your-company.altahub.ai/api/v1/companies/{companyId}' \
  -H 'Authorization: Bearer alta_…' \
  -H 'Content-Type: application/json' \
  -d '{
  "industry": "Ресторани та кав’ярні"
}'
js
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();
python
import requests

response = requests.patch(
    "https://your-company.altahub.ai/api/v1/companies/{companyId}",
    headers={"Authorization": "Bearer alta_…"},
    json={
        "industry": "Ресторани та кав’ярні",
    },
)
data = response.json()
php
<?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

Успішна відповідь.

json
{
  "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). Повтор нічого не змінює.

Параметри шляху

  • companyId string · uuid обов’язково

Приклад запиту

bash
curl -X POST 'https://your-company.altahub.ai/api/v1/companies/{companyId}/archive' \
  -H 'Authorization: Bearer alta_…' \
  -H 'Content-Type: application/json' \
  -d '{}'
js
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();
python
import requests

response = requests.post(
    "https://your-company.altahub.ai/api/v1/companies/{companyId}/archive",
    headers={"Authorization": "Bearer alta_…"},
    json={},
)
data = response.json()
php
<?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

Успішна відповідь.

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

Компанія знову в списках. Повтор нічого не змінює.

Параметри шляху

  • companyId string · uuid обов’язково

Приклад запиту

bash
curl -X POST 'https://your-company.altahub.ai/api/v1/companies/{companyId}/restore' \
  -H 'Authorization: Bearer alta_…' \
  -H 'Content-Type: application/json' \
  -d '{}'
js
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();
python
import requests

response = requests.post(
    "https://your-company.altahub.ai/api/v1/companies/{companyId}/restore",
    headers={"Authorization": "Bearer alta_…"},
    json={},
)
data = response.json()
php
<?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

Успішна відповідь.

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

Поля — як у відповіді Створити компанію