Зібрати, опублікувати й прив’язати флоу
Створіть флоу, збережіть його чернетку, перевірте й опублікуйте його, відкотіть його, дайте йому код операції і читайте його виконання та аналітику.
Флоу — це граф вузлів, який виконує запит: запит називає код операції, і Slen проходить флоу, прив’язаний до цього коду. Операції цієї сторінки створюють флоу, редагують його чернетку, перевіряють і публікують його, відкочують його, прив’язують його до коду операції й читають його виконання та аналітику. Консоль показує ті самі флоу на AI-флоу; статті AI-флоу і Публікація, версії та відкат описують їх там.
Хто може змінювати флоу
Читання флоу, його чернетки, його версій і його виконань потребує дозволу management:read, а його аналітика — read. Усе, що змінює флоу, потребує flows:write: створення й надсилання в архів, збереження чернетки, публікація, відкат і прив’язка коду операції.
Флоу належить одному проєкту. Ключ читає й змінює флоу свого проєкту. Флоу іншого проєкту або неіснуючий відповідає 404 з кодом flow_not_found.
Створити й надіслати в архів
Флоу створюється в проєкті ключа, з ім’ям до 120 символів. Його
slugробиться з імені, аslug, який у проєкті вже є, отримує число в кінці.У нового флоу немає версії, яка виконується: його
statusдорівнюєdraftдо першої публікації йactiveпісля неї.status, що дорівнюєarchived, в оновленні зупиняє флоу. На запит із його кодом операції відповідають404з кодомflow_not_found, а його прив’язка й активна версія зберігаються.status, що дорівнюєactive, повертає його таким, яким він був, і так само діє публікація.
Чернетка та її ревізія
Флоу редагується як чернетка й виконується як опублікована версія. GET /v1/flows/{id}/draft відповідає графом, його version_number і draft_rev та налаштуваннями, з якими це встановлення перевіряє графи, — серед них типи вузлів, яких не може бути в новій версії. Флоу без чернетки відповідає графом версії, яка виконується, from_published, що дорівнює true, і base_version, який називає цю версію.
Збереження надсилає назад увесь граф із прочитаним draft_rev.
draft_rev, який не поточний, відхиляється з409і кодомdraft_conflict, і граф не записується: хтось зберіг у проміжку. Прочитайте чернетку знову.Той, у кого граф на екрані, надсилає й
version_number, бо кожна чернетка рахує ревізії з нуля. Перше збереження флоу без чернетки надсилає йbase_version. Обидва відхиляються з тим самим409, коли чернетка вже не та, яку вони називають.Збереження перевіряє лише форму графа. Що граф означає, оцінюють перевірка й публікація.
Перевірити й опублікувати
POST /v1/flows/{id}/validateперевіряє чернетку, або версію, яка виконується, коли чернетки немає, і нічого не змінює.validкаже, чи пройшла б публікація,issuesперелічує помилки й попередження, аsourceкаже, який граф перевірено.Публікація перетворює чернетку на наступну за номером версію й робить її тією, яку виконують запити. Чернетка з помилкою відхиляється з
422і кодомflow_invalid, аerror.details.issuesперелічує знайдене. Попередження її не зупиняє.Флоу без чернетки відповідає
404з кодомflow_draft_not_found: публікувати нічого.Збереження чи інша публікація, що надійшли, поки публікація готується, відхиляють її з
409і кодомdraft_conflict, і нічого не публікується. Публікація може назвати свою чернетку черезversion_numberіdraft_rev, щоб її відхилили так само, коли чернетка зсунулася відтоді, як її прочитали.Вузол замороженого типу зупиняє публікацію: проблема
node_type_frozenназиває вузол, аparams.type— його тип. HTTP-запит заморожено, якщо сервіс не налаштовано інакше. Версія, опублікована з таким вузлом, і далі виконується, і відкат може до неї повернутися.
Стаття Як побудовано флоу перелічує, що має бути в кожному флоу. Після публікації Slen надсилає подію вебхука flow.published.
Відкотити
Відкат знову робить виконуваною ранішу опубліковану версію. З version_number він переходить до цієї версії. Без нього флоу переходить до опублікованої версії одразу під активною, тому повторні виклики йдуть назад історією.
Версія, якої у флоу не було, відповідає
404з кодомflow_version_not_found, а чернетка —409з кодомflow_version_not_published.Якщо опублікованої версії під активною немає, відповідь —
409з кодомno_previous_version.Версія, яка називає модель або пул провайдерів, що зникли відтоді, відхиляється з
422і кодомflow_invalid.
Відповідь — версія, яка виконується тепер. Чернетка лишається як є, і Slen надсилає подію вебхука flow.rolled_back.
Код операції
Запит потрапляє до флоу через його код операції, і флоу відповідає на один код. Прив’язка замінює код, який був у флоу: з наступного запиту на старий код відповідають 404 з кодом flow_not_found, і він вільний для іншого флоу. Код, який є в іншого флоу проєкту, відповідає 409 з кодом operation_already_bound, і флоу зберігає свій код. Видалення прив’язки лишає флоу без коду.
Виконання та аналітика
Виконання флоу перелічуються від нових до старих і читаються сторінка за сторінкою: з
cursorабо за номером —pageзlimitвідповідає ще йtotal, аanchor, ідентифікатор, який відповіла перша сторінка, не дає наступним сторінкам зсуватися, поки надходять нові виконання.qзнаходить одне виконання за його повним ідентифікатором, лише цифри; ідентифікатор виконання іншого флоу відповідає порожньою сторінкою.statusзвужує список, аfromіtoзвужують його до виконань, розпочатих між ними. Будь-який кінець можна надіслати окремо, а без них список іде всією історією. Значення зі зміщенням — це момент, який воно називає; значення без зміщення читається як UTC.pathзалишає виконання, що пройшли саме одним маршрутом, — ключі вузлів записуrequests_by_path, з’єднані через>, — і приймається лише разом зfromіto.Аналітика флоу за замовчуванням — рядок на кожен вузол. З
granularity=flowвідповідь — зведення флоу: його запити, витрати й результати за вікно. Вікно дотримується правил звіту — Аналітика: не більше 31 дня для рядків вузлів і 366 днів для зведення. Зведення рахується за цілими закритими годинами:windowвідповіді закінчується на початку поточної години або раніше, поки остання година ще звіряється. Кожен записrequests_by_pathнесе, чим закінчилися його виконання (status), і типи його вузлів, а кожен записcost_by_connection— пул, через який ішли виклики (pool_id).
Операції
Описи операцій і полів подано англійською.
Список флоу
GET /v1/flows
- Дозвіл:
management:read
Параметри
| Параметр | Опис |
|---|---|
limit необовʼязковоquery | Page size (default 30).
|
cursor необовʼязковоquery | The |
status необовʼязковоquery |
|
project необовʼязковоquery |
|
Відповіді
One cursor page of flows
{
"data": [
{
"flow_id": "74438200973594624",
"organization_id": "74438200973594624",
"project_id": "74438200973594624",
"name": "string",
"slug": "string",
"status": "draft",
"active_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"draft_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"operation_codes": [
"string"
],
"created_at": "2026-10-02T09:30:00Z",
"updated_at": "2026-10-02T09:30:00Z"
}
],
"meta": {
"limit": 1,
"next_cursor": "string"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Створити флоу
POST /v1/flows
- Дозвіл:
flows:write
The flow is created in the caller's organization, in project_id when given — which must be a project of that organization the caller reaches, or 404 project_not_found and nothing is stored — else in the caller's active project.
The slug is derived from name and is unique inside the project: letters outside Latin are transliterated (Cyrillic, Ukrainian included — Первый флоу → pervyy-flou), every other run of non-alphanumerics becomes one hyphen, 120 characters at most, flow when nothing is left. An ASCII name gives the slug it always gave. A slug the project already uses gets the first free numeric suffix (support-answer-2, -3, …) instead of a refusal; 409 flow_slug_taken remains only for two creates racing for the same free slug — retrying succeeds.
Тіло запиту
{
"name": "string",
"project_id": "74438200973594624"
}Відповіді
The created flow
{
"data": {
"flow_id": "74438200973594624",
"organization_id": "74438200973594624",
"project_id": "74438200973594624",
"name": "string",
"slug": "string",
"status": "draft",
"active_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"draft_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"operation_codes": [
"string"
],
"created_at": "2026-10-02T09:30:00Z",
"updated_at": "2026-10-02T09:30:00Z"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 409 | State conflict: idempotency clash, stale draft, illegal transition; the last owner of an organization ( | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Флоу з активною версією та чернеткою
GET /v1/flows/{id}
- Дозвіл:
management:read
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Відповіді
The flow
{
"data": {
"flow_id": "74438200973594624",
"organization_id": "74438200973594624",
"project_id": "74438200973594624",
"name": "string",
"slug": "string",
"status": "draft",
"active_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"draft_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"operation_codes": [
"string"
],
"created_at": "2026-10-02T09:30:00Z",
"updated_at": "2026-10-02T09:30:00Z"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Перейменувати флоу або перенести його в архів
PATCH /v1/flows/{id}
- Дозвіл:
flows:write
An archived flow is not executed: POST /v1/operations/execute for its operation answers 404 flow_not_found. Its binding and its active version are kept, so status: active brings it back as it was, and a publish un-archives it as well. An execution parked before the flow was archived still resumes and finishes on its own version.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Тіло запиту
{
"name": "string",
"status": "active"
}Відповіді
The updated flow
{
"data": {
"flow_id": "74438200973594624",
"organization_id": "74438200973594624",
"project_id": "74438200973594624",
"name": "string",
"slug": "string",
"status": "draft",
"active_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"draft_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"operation_codes": [
"string"
],
"created_at": "2026-10-02T09:30:00Z",
"updated_at": "2026-10-02T09:30:00Z"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Чернетка графа
GET /v1/flows/{id}/draft
- Дозвіл:
management:read
Beside the graph and its revision, the settings this installation validates and runs graphs with (FlowBuilderSettings), for the builder to say.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Відповіді
The draft graph, its revision and the builder's settings
{
"data": {
"version_number": 1,
"draft_rev": 1,
"from_published": true,
"base_version": 1,
"graph": {
"version": 1,
"nodes": [
{
"key": "string",
"type": "string",
"label": "string",
"config": {},
"position": {
"x": 1,
"y": 1
}
}
],
"edges": [
{
"key": "string",
"source": "string",
"source_port": "string",
"target": "string",
"label": "string"
}
]
},
"settings": {
"max_output_tokens": 1,
"max_parked_hours": 1,
"park_longest_wait_hours": 1,
"frozen_node_types": [
"sdk_request"
]
}
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Зберегти чернетку графа
PUT /v1/flows/{id}/draft
- Дозвіл:
flows:write
draft_rev is the optimistic-lock token read from the draft; a stale one is refused (409 draft_conflict).
draft_rev counts from zero in every draft, so alone it does not tell the draft of one version from the draft of the next. A caller that holds a graph on screen — the builder — also sends the version_number that GET /draft (or its last save) answered: when the draft is of another version — the one it read was published elsewhere and edited again — the save is refused with 409 draft_conflict even when the two revisions coincide, and the graph is not written. Without version_number only the revision is compared, as before.
A flow with no draft is edited from the version that runs, and a rollback replaces that graph without moving either number. The first save of such a flow therefore also names the base_version that GET /draft answered: when the working graph is read from another version by now, or is somebody's draft already, the save is refused with 409 draft_conflict. A refused save of a flow with no draft creates no draft. A caller that names no base is not held to one.
A pool_id in the graph that the caller does not reach is an unknown pool to validation (unknown_pool), exactly like one that does not exist. A pool_id that is not text — a number, a list, an object — is invalid_node_config with the detail ai_model_invalid_pool_id: the runtime routes through a named pool only for a non-empty string. A pool that is switched off is the warning pool_disabled: the graph can be saved and published, and every call of that node is refused provider_not_configured until the pool is enabled.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Тіло запиту
{
"graph": {
"version": 1,
"nodes": [
{
"key": "string",
"type": "string",
"label": "string",
"config": {},
"position": {
"x": 1,
"y": 1
}
}
],
"edges": [
{
"key": "string",
"source": "string",
"source_port": "string",
"target": "string",
"label": "string"
}
]
},
"draft_rev": 1,
"version_number": 1,
"base_version": 1
}Відповіді
The draft version after the save
{
"data": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 409 | State conflict: idempotency clash, stale draft, illegal transition; the last owner of an organization ( | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Перевірити граф без публікації
POST /v1/flows/{id}/validate
- Дозвіл:
management:read
Checks the draft when there is one and the version that runs otherwise — the active one, which after a rollback is not the latest published; source in the answer says which. 404 only when the flow has neither.
The body is optional. A caller that is looking at a graph — an editor with the draft on screen — sends back the version_number and draft_rev that GET /draft (or its last save) answered, and for a flow with no draft its base_version as well: when the working graph is no longer that one, the answer is 409 draft_conflict instead of a verdict about a graph the caller has not seen. Without the body whatever the server holds is checked.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Тіло запиту необовʼязково
{
"version_number": 1,
"draft_rev": 1,
"base_version": 1
}Відповіді
Validation issues, if any
{
"data": {
"valid": true,
"issues": [
{
"severity": "error",
"code": "invalid_graph_shape",
"message": "string",
"node_key": "string",
"edge_key": "string",
"params": {
"key": "string"
}
}
],
"source": "draft"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 409 | State conflict: idempotency clash, stale draft, illegal transition; the last owner of an organization ( | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Опублікувати чернетку
POST /v1/flows/{id}/publish
- Дозвіл:
flows:write
The version is frozen at the draft revision that was validated and compiled. A draft save, or another publish of the same draft, that lands while this one is being prepared is 409 draft_conflict: nothing is published and no flow.published is sent — read the draft again and repeat the call. 404 flow_draft_not_found when the flow has no draft (it was already published and not edited since).
That check sees only what changes *during* the call. A save that landed before it — another tab, another member — is simply the draft, and it is what gets published. A caller that publishes the graph it is looking at sends the optional body: the version_number and draft_rev that GET /draft (or its last save) answered. When the draft is another version or at another revision the answer is the same 409 draft_conflict, before the graph is validated. A body with any other field, or with a value that is not such a number, is 422.
A draft that holds a node of a frozen type is refused like any other invalid graph: 422 flow_invalid that carries a node_type_frozen issue, with the node in node_key and the type in params.type. Which types are frozen is the deployment's setting; http_request is by default. The freeze is about new versions only: a version published with such a node keeps running, an execution parked on it resumes, and a rollback onto it works — but its graph cannot be published again until the node is taken out, and POST /validate says so (valid: false) for a flow whose running version holds one.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Тіло запиту необовʼязково
{
"version_number": 1,
"draft_rev": 1
}Відповіді
The published version and any warnings
{
"data": {
"version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"warnings": [
{
"severity": "error",
"code": "invalid_graph_shape",
"message": "string",
"node_key": "string",
"edge_key": "string",
"params": {
"key": "string"
}
}
]
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 409 | State conflict: idempotency clash, stale draft, illegal transition; the last owner of an organization ( | |
| 422 | The graph cannot be published. |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Відкотити до попередньої опублікованої версії
POST /v1/flows/{id}/rollback
- Дозвіл:
flows:write
Omitting version_number means the published version next below the live one, so repeated calls walk back through the history (version 5, then 4, then 3); going forward again is a rollback by number.
A draft somebody has begun is left alone. A flow with no draft is edited from the version that is live after the rollback.
The answer is the version that is live now — a FlowVersion, not the PublishResult of a publish: a rollback re-checks references only and has no warnings to report. The switch and its flow.rolled_back event are one transaction.
Refusals: 404 flow_version_not_found — the flow has no version of that number; 409 flow_version_not_published — the version named is a draft; 409 no_previous_version — no number was given and there is no published version earlier than the live one (or the flow has no live version). 422 is one of two things: a version_number that is not a positive integer (the field-level {"message", "errors"} answer), or flow_invalid in the error envelope with details.issues, as on a publish — a model or a pool the target version refers to is gone, so it can no longer run.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Тіло запиту необовʼязково
{
"version_number": 1
}Відповіді
The version now active
{
"data": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 409 | State conflict: idempotency clash, stale draft, illegal transition; the last owner of an organization ( | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Усі версії флоу
GET /v1/flows/{id}/versions
- Дозвіл:
management:read
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Відповіді
Versions, newest first
{
"data": [
{
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z",
"published_by_name": "string"
}
]
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Одна версія повністю — зі своїм графом
GET /v1/flows/{id}/versions/{version}
- Дозвіл:
management:read
The version of the flow with this number: the summary GET /v1/flows/{id}/versions lists, plus the graph it froze, in the shape the draft endpoint uses. A number the flow never had is 404 flow_version_not_found; a flow out of reach is 404 flow_not_found.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
version обовʼязковоpath |
|
Відповіді
The version with its graph, in the draft endpoint's shape
{
"data": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z",
"graph": {
"version": 1,
"nodes": [
{
"key": "string",
"type": "string",
"label": "string",
"config": {},
"position": {
"x": 1,
"y": 1
}
}
],
"edges": [
{
"key": "string",
"source": "string",
"source_port": "string",
"target": "string",
"label": "string"
}
]
}
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Прив’язати код операції до флоу
PUT /v1/flows/{id}/binding
- Дозвіл:
flows:write
The binding is what POST /v1/operations/execute resolves by. A flow answers to one operation code: the PUT replaces the code the flow had, in one transaction. The previous code answers 404 flow_not_found to POST /v1/operations/execute from the next call and is free for another flow; the code the flow already has is answered as it is. 409 operation_already_bound — the code belongs to another flow of the project, and this flow keeps the code it had.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Тіло запиту
{
"operation_code": "generate_email"
}Відповіді
The flow with its operation code
{
"data": {
"flow_id": "74438200973594624",
"organization_id": "74438200973594624",
"project_id": "74438200973594624",
"name": "string",
"slug": "string",
"status": "draft",
"active_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"draft_version": {
"version_id": "74438200973594624",
"version_number": 1,
"status": "draft",
"draft_rev": 1,
"published_at": "2026-10-02T09:30:00Z",
"published_by": "string",
"published_by_user_id": "74438200973594624",
"created_at": "2026-10-02T09:30:00Z"
},
"operation_codes": [
"string"
],
"created_at": "2026-10-02T09:30:00Z",
"updated_at": "2026-10-02T09:30:00Z"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 409 | State conflict: idempotency clash, stale draft, illegal transition; the last owner of an organization ( | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Зняти прив’язку операції
DELETE /v1/flows/{id}/binding
- Дозвіл:
flows:write
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
Відповіді
Unbound
Без тіла
Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Запуски флоу
GET /v1/flows/{id}/executions
- Дозвіл:
management:read
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
limit необовʼязковоquery | Page size (default 30).
|
cursor необовʼязковоquery | The |
page необовʼязковоquery | The page number, from 1. Turns the list into its numbered form: the answer's
|
anchor необовʼязковоquery | The
|
status необовʼязковоquery |
|
from необовʼязковоquery | Only runs started at or after this moment. Either end may be given alone; there is no cap on the width and no default window — without either the list pages through the whole history. A value with an offset is the moment it names; one without is read as UTC. A value that is not a date is a field-validation
|
to необовʼязковоquery | Only runs started at or before this moment; see
|
q необовʼязковоquery | Search by the full id of an execution — digits only, anything else is a field-validation
|
path необовʼязковоquery | Only the runs that walked exactly this path: the node keys in the order they were entered, joined by
|
Відповіді
One page of executions — a cursor page, or a numbered one with page
{
"data": [
{
"execution_id": "74438200973594624",
"flow_id": "74438200973594624",
"flow_version_id": "74438200973594624",
"operation": "generate_email",
"operation_id": "74438200973594624",
"status": "running",
"error_code": "string",
"error_message": "string",
"cost": {
"estimated": "0.02700000",
"actual": "0.02700000"
},
"cache": {
"hit": true,
"cached_at": "2026-10-02T09:30:00Z"
},
"started_at": "2026-10-02T09:30:00Z",
"finished_at": "2026-10-02T09:30:00Z",
"duration_ms": 1
}
],
"meta": {
"limit": 1,
"next_cursor": "string"
}
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Статистика за вузлами або зведення флоу
GET /v1/flows/{id}/analytics
- Дозвіл:
read
granularity=node (the default) reads the raw node executions of the window; granularity=flow reads the hourly rollup and answers the dashboard. The two shapes differ.
Параметри
| Параметр | Опис |
|---|---|
id обовʼязковоpath | Snowflake identifier, as a string.
|
from необовʼязковоquery | Start of the window an analytics answer covers — a date the server can parse, ISO-8601 recommended (a value without an offset is read as UTC). Unlike the lists, each end is optional on its own and the window is never refused, only fitted (
|
to необовʼязковоquery | End of the window an analytics answer covers; now when absent. See
|
granularity необовʼязковоquery |
|
Відповіді
Node rows or the flow dashboard, depending on granularity
{
"data": [
{
"node_key": "string",
"node_type": "string",
"executions": 1,
"failed": 1,
"error_rate": "string",
"cost": "0.02700000",
"avg_duration_ms": 1,
"p95_duration_ms": 1,
"ports": {
"key": 1
},
"saved_cost": "0.02700000"
}
]
}Помилки
| Статус | Коди | Коли |
|---|---|---|
| 401 | No credential, or one that is not valid | |
| 403 | Authenticated, but not allowed: scope ( | |
| 404 | No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable. | |
| 422 | Validation failure or a semantically impossible request. Field-level validation from the framework answers |
Заголовки
X-Request-Id
Тіло кожної помилки — конверт помилки.
Приклади
Отримати список флоу
Активні флоу проєкту.
curl "https://api.slen.ai/api/v1/flows?status=active" \
-H "Authorization: Bearer $SLEN_API_KEY"{
"data": [
{
"flow_id": "74438623450128384",
"organization_id": "74438200973594112",
"project_id": "74438200973594624",
"name": "Follow-up email",
"slug": "follow-up-email",
"status": "active",
"active_version": {
"version_id": "74440987364098048",
"version_number": 3,
"status": "published",
"draft_rev": 7,
"published_at": "2026-10-01T15:40:22+00:00",
"published_by": "74438344587730944",
"published_by_user_id": null,
"created_at": "2026-10-01T14:02:51+00:00"
},
"draft_version": null,
"operation_codes": [
"generate_email"
],
"created_at": "2026-09-30T11:20:05+00:00",
"updated_at": "2026-10-01T15:40:22+00:00"
}
],
"meta": {
"limit": 30,
"next_cursor": null
}
}Створити флоу
Новий флоу — у проєкті ключа, і в нього ще немає версії.
curl https://api.slen.ai/api/v1/flows \
-H "Authorization: Bearer $SLEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Support answer"
}'{
"data": {
"flow_id": "74443519874433024",
"organization_id": "74438200973594112",
"project_id": "74438200973594624",
"name": "Support answer",
"slug": "support-answer",
"status": "draft",
"active_version": null,
"draft_version": null,
"operation_codes": [],
"created_at": "2026-10-02T10:20:44+00:00",
"updated_at": "2026-10-02T10:20:44+00:00"
}
}Прочитати флоу
Відповідь — флоу з його активною версією й чернеткою.
curl https://api.slen.ai/api/v1/flows/74438623450128384 \
-H "Authorization: Bearer $SLEN_API_KEY"{
"data": {
"flow_id": "74438623450128384",
"organization_id": "74438200973594112",
"project_id": "74438200973594624",
"name": "Follow-up email",
"slug": "follow-up-email",
"status": "active",
"active_version": {
"version_id": "74440987364098048",
"version_number": 3,
"status": "published",
"draft_rev": 7,
"published_at": "2026-10-01T15:40:22+00:00",
"published_by": "74438344587730944",
"published_by_user_id": null,
"created_at": "2026-10-01T14:02:51+00:00"
},
"draft_version": {
"version_id": "74443540644626432",
"version_number": 4,
"status": "draft",
"draft_rev": 2,
"published_at": null,
"published_by": null,
"published_by_user_id": null,
"created_at": "2026-10-02T10:25:13+00:00"
},
"operation_codes": [
"generate_email"
],
"created_at": "2026-09-30T11:20:05+00:00",
"updated_at": "2026-10-02T10:31:09+00:00"
}
}Надіслати флоу в архів
Запити з кодом операції флоу відхиляються, доки він знову не стане активним.
curl -X PATCH https://api.slen.ai/api/v1/flows/74438623450128384 \
-H "Authorization: Bearer $SLEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "archived"
}'{
"data": {
"flow_id": "74438623450128384",
"organization_id": "74438200973594112",
"project_id": "74438200973594624",
"name": "Follow-up email",
"slug": "follow-up-email",
"status": "archived",
"active_version": {
"version_id": "74440987364098048",
"version_number": 3,
"status": "published",
"draft_rev": 7,
"published_at": "2026-10-01T15:40:22+00:00",
"published_by": "74438344587730944",
"published_by_user_id": null,
"created_at": "2026-10-01T14:02:51+00:00"
},
"draft_version": null,
"operation_codes": [
"generate_email"
],
"created_at": "2026-09-30T11:20:05+00:00",
"updated_at": "2026-10-02T11:02:37+00:00"
}
}Прочитати чернетку
Відповідь несе граф, два числа, які збереження надсилає назад, і налаштування конструктора.
curl https://api.slen.ai/api/v1/flows/74438623450128384/draft \
-H "Authorization: Bearer $SLEN_API_KEY"Зберегти чернетку
Граф із запиту, одного виклику моделі й відповіді, збережений на тій ревізії, на якій його прочитали.
curl -X PUT https://api.slen.ai/api/v1/flows/74438623450128384/draft \
-H "Authorization: Bearer $SLEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"graph": {
"version": 1,
"nodes": [
{
"key": "request",
"type": "sdk_request",
"label": null,
"config": {},
"position": {
"x": 0,
"y": 0
}
},
{
"key": "model",
"type": "ai_model",
"label": null,
"config": {
"model": "gpt-4o-mini",
"max_output_tokens": 400
},
"position": {
"x": 280,
"y": 0
}
},
{
"key": "answer",
"type": "return_response",
"label": null,
"config": {},
"position": {
"x": 560,
"y": 0
}
}
],
"edges": [
{
"key": "request-model",
"source": "request",
"source_port": "default",
"target": "model"
},
{
"key": "model-answer",
"source": "model",
"source_port": "success",
"target": "answer"
}
]
},
"draft_rev": 2,
"version_number": 4
}'Перевірити чернетку
Тіло називає чернетку на екрані. Відповідь каже, чи пройшла б публікація, і перелічує знайдене.
curl https://api.slen.ai/api/v1/flows/74438623450128384/validate \
-H "Authorization: Bearer $SLEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version_number": 4,
"draft_rev": 3
}'Опублікувати чернетку
Тіло називає перевірену чернетку. Збереження, зроблене після цього, відхиляє публікацію.
curl https://api.slen.ai/api/v1/flows/74438623450128384/publish \
-H "Authorization: Bearer $SLEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version_number": 4,
"draft_rev": 3
}'Відкотити
Без тіла флоу повертається до версії під активною.
curl -X POST https://api.slen.ai/api/v1/flows/74438623450128384/rollback \
-H "Authorization: Bearer $SLEN_API_KEY"Отримати список версій
Версії флоу, від нових до старих.
curl https://api.slen.ai/api/v1/flows/74438623450128384/versions \
-H "Authorization: Bearer $SLEN_API_KEY"Прочитати одну версію
Відповідь — версія з графом, який вона заморозила, у формі чернетки.
curl https://api.slen.ai/api/v1/flows/74438623450128384/versions/3 \
-H "Authorization: Bearer $SLEN_API_KEY"Прив’язати код операції
З наступного запиту generate_email виконує цей флоу.
curl -X PUT https://api.slen.ai/api/v1/flows/74438623450128384/binding \
-H "Authorization: Bearer $SLEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation_code": "generate_email"
}'{
"data": {
"flow_id": "74438623450128384",
"organization_id": "74438200973594112",
"project_id": "74438200973594624",
"name": "Follow-up email",
"slug": "follow-up-email",
"status": "active",
"active_version": {
"version_id": "74440987364098048",
"version_number": 3,
"status": "published",
"draft_rev": 7,
"published_at": "2026-10-01T15:40:22+00:00",
"published_by": "74438344587730944",
"published_by_user_id": null,
"created_at": "2026-10-01T14:02:51+00:00"
},
"draft_version": null,
"operation_codes": [
"generate_email"
],
"created_at": "2026-09-30T11:20:05+00:00",
"updated_at": "2026-10-01T15:40:22+00:00"
}
}Видалити прив’язку
У відповіді немає тіла. На запит зі старим кодом відповідають 404.
curl -X DELETE https://api.slen.ai/api/v1/flows/74438623450128384/binding \
-H "Authorization: Bearer $SLEN_API_KEY"204 No Content
Отримати список виконань
Перша сторінка з 25 виконань флоу, розпочатих з ранку 2 жовтня, які закінчилися зі статусом failed.
curl "https://api.slen.ai/api/v1/flows/74438623450128384/executions?status=failed&from=2026-10-02T06%3A00%3A00Z&page=1&limit=25" \
-H "Authorization: Bearer $SLEN_API_KEY"Прочитати аналітику
Зведення флоу за останні сім днів.
curl "https://api.slen.ai/api/v1/flows/74438623450128384/analytics?granularity=flow" \
-H "Authorization: Bearer $SLEN_API_KEY"Що читати далі
AI-флоу — ті самі флоу в консолі й те, як запит знаходить свій флоу.
Публікація, версії та відкат — чернетки, публікація й відкат у консолі.
Виконання — статус і трасування одного виконання.
Як побудовано флоу — вузли й правила, яких дотримується опублікований флоу.
Зібрано з openapi b070e1f, sdk contract 5cc7055, php ae4a53b, node 84bc62d