К содержанию

Воронки

Воронки продаж и их этапы в порядке доски.

Список воронок

GET /pipelines

Воронки продаж с этапами в порядке доски. Воронки настраивают в CRM; через API — только чтение.

Пример запроса

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

response = requests.get(
    "https://your-company.altahub.ai/api/v1/pipelines",
    headers={"Authorization": "Bearer alta_…"},
)
data = response.json()
php
<?php
$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/pipelines', [
    'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);

Ответ 200

Успешный ответ.

json
{
  "items": [
    {
      "id": "0192f3a1-7c2e-7b4d-9a61-00000000001e",
      "name": "Продажи",
      "dealPanel": {
        "payment": true,
        "contacts": true,
        "products": false
      },
      "stages": [
        {
          "id": "0192f3a1-7c2e-7b4d-9a61-00000000001f",
          "name": "Новый запрос",
          "position": 1,
          "kind": "open",
          "color": "blue",
          "durationNormSeconds": 172800
        },
        {
          "id": "0192f3a1-7c2e-7b4d-9a61-000000000020",
          "name": "Переговоры",
          "position": 2,
          "kind": "open",
          "color": "yellow",
          "durationNormSeconds": 604800
        },
        {
          "id": "0192f3a1-7c2e-7b4d-9a61-000000000021",
          "name": "Счёт выставлен",
          "position": 3,
          "kind": "open",
          "color": "orange",
          "durationNormSeconds": null
        },
        {
          "id": "0192f3a1-7c2e-7b4d-9a61-000000000022",
          "name": "Успешно",
          "position": 4,
          "kind": "won",
          "color": "green",
          "durationNormSeconds": null
        },
        {
          "id": "0192f3a1-7c2e-7b4d-9a61-000000000023",
          "name": "Отказ",
          "position": 5,
          "kind": "lost",
          "color": "red",
          "durationNormSeconds": null
        }
      ]
    }
  ]
}
Поля ответа
  • items object[]

    Вложенные поля: 4
    • dealPanel object

      Which blocks the deal page shows for deals of this pipeline; each is on unless turned off.

      Вложенные поля: 3
      • contacts boolean

        The deal page shows its contacts block: the company and the people of the deal.

      • payment boolean

        The deal page shows its payment block: what was paid of the amount, and adding a payment.

      • products boolean

        The deal page shows its products block: the deal's product lines.

    • id string · uuid

    • name string

    • stages object[]

      Вложенные поля: 6
      • color string

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

      • durationNormSeconds integer | null

        How long deals of the organization usually stand on this stage, in seconds (the 80th percentile of its own recent history, refreshed nightly); null while the stage has too little history.

        ≥ 0

      • id string · uuid

      • kind string

        Значения: open won lost

      • name string

      • position integer

        ≥ 1

Получить воронку

GET /pipelines/{pipelineId}

Одна воронка с этапами в порядке доски.

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

  • pipelineId string · uuid обязательно

Пример запроса

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

response = requests.get(
    "https://your-company.altahub.ai/api/v1/pipelines/{pipelineId}",
    headers={"Authorization": "Bearer alta_…"},
)
data = response.json()
php
<?php
$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://your-company.altahub.ai/api/v1/pipelines/{pipelineId}', [
    'headers' => ['Authorization' => 'Bearer alta_…'],
]);
$data = json_decode((string) $response->getBody(), true);

Ответ 200

Успешный ответ.

json
{
  "id": "0192f3a1-7c2e-7b4d-9a61-00000000001e",
  "name": "Продажи",
  "dealPanel": {
    "payment": true,
    "contacts": true,
    "products": false
  },
  "stages": [
    {
      "id": "0192f3a1-7c2e-7b4d-9a61-00000000001f",
      "name": "Новый запрос",
      "position": 1,
      "kind": "open",
      "color": "blue",
      "durationNormSeconds": 172800
    },
    {
      "id": "0192f3a1-7c2e-7b4d-9a61-000000000020",
      "name": "Переговоры",
      "position": 2,
      "kind": "open",
      "color": "yellow",
      "durationNormSeconds": 604800
    },
    {
      "id": "0192f3a1-7c2e-7b4d-9a61-000000000021",
      "name": "Счёт выставлен",
      "position": 3,
      "kind": "open",
      "color": "orange",
      "durationNormSeconds": null
    },
    {
      "id": "0192f3a1-7c2e-7b4d-9a61-000000000022",
      "name": "Успешно",
      "position": 4,
      "kind": "won",
      "color": "green",
      "durationNormSeconds": null
    },
    {
      "id": "0192f3a1-7c2e-7b4d-9a61-000000000023",
      "name": "Отказ",
      "position": 5,
      "kind": "lost",
      "color": "red",
      "durationNormSeconds": null
    }
  ]
}
Поля ответа
  • dealPanel object

    Which blocks the deal page shows for deals of this pipeline; each is on unless turned off.

    Вложенные поля: 3
    • contacts boolean

      The deal page shows its contacts block: the company and the people of the deal.

    • payment boolean

      The deal page shows its payment block: what was paid of the amount, and adding a payment.

    • products boolean

      The deal page shows its products block: the deal's product lines.

  • id string · uuid

  • name string

  • stages object[]

    Вложенные поля: 6
    • color string

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

    • durationNormSeconds integer | null

      How long deals of the organization usually stand on this stage, in seconds (the 80th percentile of its own recent history, refreshed nightly); null while the stage has too little history.

      ≥ 0

    • id string · uuid

    • kind string

      Значения: open won lost

    • name string

    • position integer

      ≥ 1