Виконайте флоу і прочитайте його виклики моделі

Надішліть запит через флоу, прив’язаний до коду операції, прочитайте операції — виклики моделі у флоу — з усіма спробами за ними й отримайте список холдів цих викликів.

Дві речі на цій сторінці мають одне ім’я. Запит до флоу називає код операції, і POST /v1/operations/execute виконує флоу, прив’язаний до цього коду. Операція — це ще й запис про один виклик моделі у флоу; два читання цієї сторінки показують список таких записів і один запис з усіма спробами за ним. Остання операція сторінки показує список холдів цих викликів. Консоль показує ті самі записи на сторінці Операції, на її вкладці Операції — екран описано в статті Операції, авторизації та реєстр.

Виконання та операція

  • POST /v1/operations/execute відповідає виконанням: одним проходом флоу, яке називає execution_id. Виконання читають знову через GET /v1/executions/{id}/status і GET /v1/executions/{id}.

  • Операція — це один виклик моделі, який називає operation_id. Одна операція відкривається на кожен виклик моделі, який робить флоу.

  • Ідентифікатор виконання — не ідентифікатор операції: на нього GET /v1/operations/{id} відповідає 404 з кодом operation_not_found.

Запис про виклик моделі

Операція відкривається, коли вузол AI-модель ось-ось викличе модель, після того як гроші на виклик зарезервовано. Вона починається зі статусу pending і закінчується одним із трьох статусів.

СтатусЩо він означає
completedМодель відповіла
failedВиклик закінчився без відповіді моделі
uncertainНевідомо, чим закінчився виклик: провайдер не відповів вчасно або прийняв виклик на виконання у фоні, і його не вдалося про цей виклик спитати

Холд виклику зі статусом uncertain не повертається одразу: провайдерові, можливо, уже заплатили, тому холд тримається, доки не спливе. Такий виклик Slen теж не повторює. Коли відповідь на виклик втрачено, про це повідомляє подія вебхука operation.uncertain. Виклик, який провайдер виконує у фоні, теж повідомляє, чим він закінчився: operation.completed — коли провайдер відповів, operation.failed — коли виклик не вдався, operation.uncertain — коли спитати провайдера про виклик більше не вдалося. Щоб знайти виклики з невідомим результатом без вебхука, виберіть операції за статусом, як у прикладі нижче.

Спроба — це один виклик одного підключення провайдера. Коли пул моделі після збою переходить до іншого підключення, операція отримує наступну спробу з черговим номером. Спроба каже, яке підключення та яку модель вона використала і чим вона закінчилася. Її cost залишається null, доки виклик не закрито.

  • Список містить операції проєкту ключа, спершу найновіші. Спроб він не показує: attempts там — порожній список. Щоб їх побачити, прочитайте одну операцію.

  • Операція не зберігає ні промпт, ні відповідь моделі.

  • Спроба називає своє підключення і свій пул: connection_name і pool_name, поряд із ними — provider і connection_deleted. Назва дорівнює null, якщо пул відтоді видалено (pool_id лишається) або якщо підключення чи пул поза досяжністю ключа. Видалене підключення зберігає назву. finish_reason — чому провайдер зупинився, так, як він це повідомив.

  • flow_execution називає виконання й вузол, викликом моделі якого є операція: execution_id, flow_id і node_key. Коли виконання поза досяжністю ключа, це null, і це поле є лише під час читання однієї операції, не в списку.

q шукає в списку. Цифри, які є ID операції проєкту, знаходять саме цю операцію, хоч би якою старою вона була: вікно from і to до неї не застосовується, а status і operation_code — застосовуються. Будь-який інший текст знаходить операції, у яких external_user_id дорівнює цьому тексту або починається з нього, всередині вікна; % і _ там — звичайні символи. На q довший за 190 символів відповідь — 422. Значення входить в адресу, тому external_user_id, який є адресою e-mail, потрапляє в історію браузерів і в журнали доступу.

Список читають курсором, як будь-який список, — Список сторінками, — або за номером сторінки. Надішліть page, і в meta прийдуть page, limit, total і anchor. total рахується до 10 000; далі він лишається 10 000, а total_capped дорівнює true. Надсилайте anchor першої сторінки з усіма іншими сторінками: рахуються лише операції з ID не більшим за нього, тому операція, відкрита за цей час, не зсуває рядки зі сторінки на сторінку. На page разом із cursor і на anchor без page відповідь — 422.

Холди викликів

GET /v1/authorizations показує список холдів проєкту, найновіші — першими: по одному на кожен виклик моделі, з тим, скільки виклик мав коштувати, скільки було зарезервовано і скільки списано. Він потребує дозволу read і читає вікно не довше за сім днів, як список операцій, — курсором або за номером сторінки. operation_code лишає холди одного коду операції. Що означає кожен статус холду, пояснює стаття Як працює резервування бюджету, а консоль показує ті самі холди на вкладці Авторизації екрана Операції.

Операції

Описи операцій і полів подано англійською.

Запустити флоу, прив’язаний до операції

POST /v1/operations/execute

  • Дозвіл: gateway:write
  • Потрібен Idempotency-Key
  • Доступно в SDK для PHP і Node.js

The caller names what it wants done, never a model or a pool. Answers 202 when the flow parked at a queue or approval node — waiting_on says on what — and also when execution_mode: async handed the run to a queue worker, where the status is queued and nothing has walked yet. Both carry retry_after_seconds. Idempotent.

The Idempotency-Key belongs to the execution it opened, and no copy of the answer is kept beside it: a repeated key with the same body is answered from that execution as it is now (replayed: true) and runs nothing. 202 with retry_after_seconds while it has not finished — queued, waiting, or running when the retry met a walk still under way (a synchronous run may outlast the caller's timeout) — and 200 with the outcome once it has: output of a completed run, error_code and error_message of one that was refused or failed, even when the first answer was an error envelope — error repeats the two as {code, message}, on a replay exactly as on the first answer. The same key with a different body is 409 idempotency_conflict.

A flow that refuses is not an HTTP error: a reject node answers 200 with status: rejected. A walk that throws is one: the execution is closed — failed, rejected when the gateway refused to spend (policy_denied, customer_blocked, budget_exceeded, insufficient_credits, an overrun), uncertain when the provider's answer was lost — with the same code in its error_code, and the answer is the error envelope with the status of what threw. The code of the envelope and the code of the row are one and the same, also for what is wrong with the setup rather than refused by a policy: customer_not_found (404), model_not_allowed (403), cost_calculation_failed (422) and ledger_unavailable (503) close the execution failed with that code.

A synchronous run that outlives the running ceiling (15 minutes by default) is closed failed with execution_lost while its walk is still under way. Whatever that walk goes on to compute is not the outcome of the execution, and the call is answered with the execution as its row has it — 200, failed, execution_lost, no output, replayed: false — exactly what a repeated key is told afterwards. A model call the walk did make is paid for, and cost.actual arrives.

A model node routes a refusal to spend into its deny port when something is connected to it — policy_denied, customer_blocked, budget_exceeded, insufficient_credits, overrun_stopped — and then the flow decides what the caller hears. The setup errors above are never routed.

403 customer_blocked — the context.user_id names a customer that is blocked (POST /v1/customers/{externalUserId}/block). Nothing is created: no execution, no hold. A repeated key of an execution opened before the block is still answered by that execution. A run already under way — queued, or parked at an approval — meets the block at its next model node that takes credits: the hold is refused, and the execution closes rejected with customer_blocked (a model node with something on its deny port routes it there, like a policy refusal). A run whose operation has no price in credits takes no hold and finishes.

404 flow_not_found — no flow is bound to the operation, the flow was never published, or it is archived. Nothing is created for such a call — no execution, no hold — so the same key runs once the flow is un-archived. An execution parked before its flow was archived still finishes, and the key of an execution that exists is answered by it whatever became of the flow or its binding since: the 404 is for a key that opened nothing.

Параметри

ПараметрОпис
Idempotency-Key обовʼязково

headerstring

Replay guard for a financial write. The same key returns the original result with the original status and never charges twice; a different body under a used key answers idempotency_conflict.

  • Максимальна довжина: 190

Тіло запиту

application/json
{
  "operation": "generate_email",
  "input": {},
  "context": {
    "user_id": "74438200973594624",
    "credit_type": "default"
  },
  "execution_mode": "sync"
}

Відповіді

200

The finished run

application/json
{
  "data": {
    "execution_id": "74438200973594624",
    "status": "running",
    "operation": "generate_email",
    "output": {},
    "error_code": "string",
    "error_message": "string",
    "cost": {
      "estimated": "0.02700000",
      "actual": "0.02700000"
    },
    "cache": {
      "hit": true,
      "cached_at": "2026-10-02T09:30:00Z"
    },
    "waiting_on": {
      "node_key": "string",
      "type": "queue_node",
      "resume_at": "2026-10-02T09:30:00Z"
    },
    "trace_url": "string",
    "retry_after_seconds": 1,
    "error": {
      "code": "string",
      "message": "string"
    },
    "replayed": true
  }
}
202

The run has not finished: it parked, was queued, or — on a repeated key — is still walking. Come back after retry_after_seconds.

application/json
{
  "data": {
    "execution_id": "74438200973594624",
    "status": "running",
    "operation": "generate_email",
    "output": {},
    "error_code": "string",
    "error_message": "string",
    "cost": {
      "estimated": "0.02700000",
      "actual": "0.02700000"
    },
    "cache": {
      "hit": true,
      "cached_at": "2026-10-02T09:30:00Z"
    },
    "waiting_on": {
      "node_key": "string",
      "type": "queue_node",
      "resume_at": "2026-10-02T09:30:00Z"
    },
    "trace_url": "string",
    "retry_after_seconds": 1,
    "error": {
      "code": "string",
      "message": "string"
    },
    "replayed": true
  }
}

Помилки

СтатусКодиКоли
400

Malformed request — e.g. the Idempotency-Key header is missing

401

No credential, or one that is not valid

402
403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

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 (last_owner); the owned-organization limit (organization_limit_reached); an end customer with credit history that cannot be deleted (customer_has_history)

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

429

Rate limited for this API key

500

The walk broke and the execution is closed as failed (uncertain for operation_uncertain). 500: unrouted_port (a node left by a port nothing is connected to), step_limit_exceeded, unknown_node, node_type_not_supported, execution_conflict. 502: provider_error, http_request_failed. 503: pool_exhausted, ledger_unavailable (the spend ledger could not be reached when a model node asked for its hold: a flow is never served in degraded mode, so the provider was not called for that node and nothing was spent on it; with the database gone before the request arrived the answer is service_unavailable from the connection check instead, and no execution exists). 504: provider_timeout, execution_timeout, or operation_uncertain when we do not know whether the money was spent. execution_timeout is the walk stopping itself between two nodes. While the run has not paid for a model answer, no node of any type is started once its current stretch is older than its deadline (two minutes by default) — an unpaid tail of transform or http_request nodes does not run to the end. Once a model answer has been paid for, no further model call is started past that deadline and no http_request past the tail deadline (four minutes by default) — the remaining nodes that call nobody still run. A model call that was paid for before the stop is settled as for a completed run, so a retry under a new Idempotency-Key pays again. A model call entered before the deadline finishes the attempt in flight and starts no new one past it: the call then ends as pool_exhausted, with the code of its last attempt. An exhausted pool is the caller's answer only when the model node has an edge on neither rate_limit nor error: it leaves by rate_limit when that port is connected, otherwise by error when that one is. A pool_exhausted that reaches the caller as the gateway raised it carries error.details.last_error_code and, when the provider gave a hint, Retry-After

502

The walk broke and the execution is closed as failed (uncertain for operation_uncertain). 500: unrouted_port (a node left by a port nothing is connected to), step_limit_exceeded, unknown_node, node_type_not_supported, execution_conflict. 502: provider_error, http_request_failed. 503: pool_exhausted, ledger_unavailable (the spend ledger could not be reached when a model node asked for its hold: a flow is never served in degraded mode, so the provider was not called for that node and nothing was spent on it; with the database gone before the request arrived the answer is service_unavailable from the connection check instead, and no execution exists). 504: provider_timeout, execution_timeout, or operation_uncertain when we do not know whether the money was spent. execution_timeout is the walk stopping itself between two nodes. While the run has not paid for a model answer, no node of any type is started once its current stretch is older than its deadline (two minutes by default) — an unpaid tail of transform or http_request nodes does not run to the end. Once a model answer has been paid for, no further model call is started past that deadline and no http_request past the tail deadline (four minutes by default) — the remaining nodes that call nobody still run. A model call that was paid for before the stop is settled as for a completed run, so a retry under a new Idempotency-Key pays again. A model call entered before the deadline finishes the attempt in flight and starts no new one past it: the call then ends as pool_exhausted, with the code of its last attempt. An exhausted pool is the caller's answer only when the model node has an edge on neither rate_limit nor error: it leaves by rate_limit when that port is connected, otherwise by error when that one is. A pool_exhausted that reaches the caller as the gateway raised it carries error.details.last_error_code and, when the provider gave a hint, Retry-After

503

The walk broke and the execution is closed as failed (uncertain for operation_uncertain). 500: unrouted_port (a node left by a port nothing is connected to), step_limit_exceeded, unknown_node, node_type_not_supported, execution_conflict. 502: provider_error, http_request_failed. 503: pool_exhausted, ledger_unavailable (the spend ledger could not be reached when a model node asked for its hold: a flow is never served in degraded mode, so the provider was not called for that node and nothing was spent on it; with the database gone before the request arrived the answer is service_unavailable from the connection check instead, and no execution exists). 504: provider_timeout, execution_timeout, or operation_uncertain when we do not know whether the money was spent. execution_timeout is the walk stopping itself between two nodes. While the run has not paid for a model answer, no node of any type is started once its current stretch is older than its deadline (two minutes by default) — an unpaid tail of transform or http_request nodes does not run to the end. Once a model answer has been paid for, no further model call is started past that deadline and no http_request past the tail deadline (four minutes by default) — the remaining nodes that call nobody still run. A model call that was paid for before the stop is settled as for a completed run, so a retry under a new Idempotency-Key pays again. A model call entered before the deadline finishes the attempt in flight and starts no new one past it: the call then ends as pool_exhausted, with the code of its last attempt. An exhausted pool is the caller's answer only when the model node has an edge on neither rate_limit nor error: it leaves by rate_limit when that port is connected, otherwise by error when that one is. A pool_exhausted that reaches the caller as the gateway raised it carries error.details.last_error_code and, when the provider gave a hint, Retry-After

504

The walk broke and the execution is closed as failed (uncertain for operation_uncertain). 500: unrouted_port (a node left by a port nothing is connected to), step_limit_exceeded, unknown_node, node_type_not_supported, execution_conflict. 502: provider_error, http_request_failed. 503: pool_exhausted, ledger_unavailable (the spend ledger could not be reached when a model node asked for its hold: a flow is never served in degraded mode, so the provider was not called for that node and nothing was spent on it; with the database gone before the request arrived the answer is service_unavailable from the connection check instead, and no execution exists). 504: provider_timeout, execution_timeout, or operation_uncertain when we do not know whether the money was spent. execution_timeout is the walk stopping itself between two nodes. While the run has not paid for a model answer, no node of any type is started once its current stretch is older than its deadline (two minutes by default) — an unpaid tail of transform or http_request nodes does not run to the end. Once a model answer has been paid for, no further model call is started past that deadline and no http_request past the tail deadline (four minutes by default) — the remaining nodes that call nobody still run. A model call that was paid for before the stop is settled as for a completed run, so a retry under a new Idempotency-Key pays again. A model call entered before the deadline finishes the attempt in flight and starts no new one past it: the call then ends as pool_exhausted, with the code of its last attempt. An exhausted pool is the caller's answer only when the model node has an edge on neither rate_limit nor error: it leaves by rate_limit when that port is connected, otherwise by error when that one is. A pool_exhausted that reaches the caller as the gateway raised it carries error.details.last_error_code and, when the provider gave a hint, Retry-After

Заголовки

  • X-Request-Id
  • Retry-After429

Тіло кожної помилки — конверт помилки.

Список операцій

GET /v1/operations

  • Дозвіл: read

Параметри

ПараметрОпис
cursor необовʼязково

querystring

The meta.next_cursor of the previous page.

limit необовʼязково

queryinteger

Page size (default 30).

  • Мінімум: 1
  • Максимум: 100
page необовʼязково

queryinteger

The page number, from 1. Turns the list into its numbered form: the answer's meta is a PageMeta (with total) instead of a CursorMeta. Together with cursor it is a 422; without page the answer is the cursor page, unchanged. A page past the last one is an empty data with the same total.

  • Мінімум: 1
  • Максимум: 10000
anchor необовʼязково

querystring

The meta.anchor of the first numbered page: only rows with an id at or below it are counted and paged, so rows written after the first page do not shift pages 2..N. Without it the newest matching row is the anchor, and the answer names it. Only with page (422 otherwise).

  • Шаблон: ^\d{1,20}$
q необовʼязково

querystring

Search. Digits that are the id of an operation of the project find exactly that operation, past the window — the id carries its own moment, so from / to (and the default last 7 days) do not apply to it; status and operation_code still do. Anything else — and digits that are no operation of the project — is an external_user_id: equal to it or starting with it, inside the window. % and _ are characters, not patterns. An empty value is no search. The value lands in the URL; an external_user_id that is an e-mail address is then in browser history and access logs.

  • Максимальна довжина: 190
operation_code необовʼязково

querystring

  • Максимальна довжина: 120
status необовʼязково

queryOperationStatus

  • Одне з: pending, completed, failed, uncertain
from необовʼязково

querystring

Window start, ISO-8601 — a value with an offset is the moment it names, one without is read as UTC. The rule of the three lists that take this parameter (/v1/operations, /v1/authorizations, /v1/ledger-entries): from and to are given together or not at all, to must not precede from, and the window must not exceed 7 days. Naming neither end selects the last 7 days rather than the whole table — an unbounded range is the one query shape that cannot use the (project_id, created_at, id) index. Anything else answers 422 invalid_date_range. The analytics read their window by another rule (WindowFrom).

  • Формат: date-time
to необовʼязково

querystring

Window end, ISO-8601, inclusive. See from for the window rule of the three lists: both ends together, to >= from, at most 7 days, otherwise 422 invalid_date_range.

  • Формат: date-time

Відповіді

200

One page of operations — a cursor page, or a numbered one with page

application/json
{
  "data": [
    {
      "operation_id": "74438200973594624",
      "operation_code": "generate_email",
      "external_user_id": "user_8421",
      "status": "pending",
      "attempts": [
        {
          "attempt_id": "74438200973594624",
          "attempt_number": 1,
          "connection_id": "74438200973594624",
          "pool_id": "74438200973594624",
          "model_code": "gpt-4o-mini",
          "model_price_id": "74438200973594624",
          "status": "pending",
          "error_code": "string",
          "provider_request_id": "74438200973594624",
          "input_tokens": 1,
          "output_tokens": 1,
          "cost": "0.02700000",
          "cost_multiplier": "string",
          "latency_ms": 1,
          "started_at": "2026-10-02T09:30:00Z",
          "completed_at": "2026-10-02T09:30:00Z",
          "pool_name": "string",
          "connection_name": "string",
          "connection_deleted": true,
          "provider": "string",
          "finish_reason": "string"
        }
      ],
      "created_at": "2026-10-02T09:30:00Z",
      "updated_at": "2026-10-02T09:30:00Z",
      "flow_execution": {
        "execution_id": "74438200973594624",
        "flow_id": "74438200973594624",
        "node_key": "string"
      }
    }
  ],
  "meta": {
    "limit": 1,
    "next_cursor": "string"
  }
}

Помилки

СтатусКодиКоли
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тіло кожної помилки — конверт помилки.

Один запит з усіма спробами провайдерів

GET /v1/operations/{id}

  • Дозвіл: read

The way to find out what an uncertain operation actually did.

Параметри

ПараметрОпис
id обовʼязково

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Приклад: 74438200973594624

Відповіді

200

The operation and its attempts

application/json
{
  "data": {
    "operation_id": "74438200973594624",
    "operation_code": "generate_email",
    "external_user_id": "user_8421",
    "status": "pending",
    "attempts": [
      {
        "attempt_id": "74438200973594624",
        "attempt_number": 1,
        "connection_id": "74438200973594624",
        "pool_id": "74438200973594624",
        "model_code": "gpt-4o-mini",
        "model_price_id": "74438200973594624",
        "status": "pending",
        "error_code": "string",
        "provider_request_id": "74438200973594624",
        "input_tokens": 1,
        "output_tokens": 1,
        "cost": "0.02700000",
        "cost_multiplier": "string",
        "latency_ms": 1,
        "started_at": "2026-10-02T09:30:00Z",
        "completed_at": "2026-10-02T09:30:00Z",
        "pool_name": "string",
        "connection_name": "string",
        "connection_deleted": true,
        "provider": "string",
        "finish_reason": "string"
      }
    ],
    "created_at": "2026-10-02T09:30:00Z",
    "updated_at": "2026-10-02T09:30:00Z",
    "flow_execution": {
      "execution_id": "74438200973594624",
      "flow_id": "74438200973594624",
      "node_key": "string"
    }
  }
}

Помилки

СтатусКодиКоли
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

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/authorizations

  • Дозвіл: read

Параметри

ПараметрОпис
cursor необовʼязково

querystring

The meta.next_cursor of the previous page.

limit необовʼязково

queryinteger

Page size (default 30).

  • Мінімум: 1
  • Максимум: 100
page необовʼязково

queryinteger

The page number, from 1. Turns the list into its numbered form: the answer's meta is a PageMeta (with total) instead of a CursorMeta. Together with cursor it is a 422; without page the answer is the cursor page, unchanged. A page past the last one is an empty data with the same total.

  • Мінімум: 1
  • Максимум: 10000
anchor необовʼязково

querystring

The meta.anchor of the first numbered page: only rows with an id at or below it are counted and paged, so rows written after the first page do not shift pages 2..N. Without it the newest matching row is the anchor, and the answer names it. Only with page (422 otherwise).

  • Шаблон: ^\d{1,20}$
operation_code необовʼязково

querystring

  • Максимальна довжина: 120
from необовʼязково

querystring

Window start, ISO-8601 — a value with an offset is the moment it names, one without is read as UTC. The rule of the three lists that take this parameter (/v1/operations, /v1/authorizations, /v1/ledger-entries): from and to are given together or not at all, to must not precede from, and the window must not exceed 7 days. Naming neither end selects the last 7 days rather than the whole table — an unbounded range is the one query shape that cannot use the (project_id, created_at, id) index. Anything else answers 422 invalid_date_range. The analytics read their window by another rule (WindowFrom).

  • Формат: date-time
to необовʼязково

querystring

Window end, ISO-8601, inclusive. See from for the window rule of the three lists: both ends together, to >= from, at most 7 days, otherwise 422 invalid_date_range.

  • Формат: date-time

Відповіді

200

One page of reservations — a cursor page, or a numbered one with page

application/json
{
  "data": [
    {
      "reservation_id": "74438200973594624",
      "status": "authorized",
      "model_code": "gpt-4o-mini",
      "operation_code": "generate_email",
      "external_user_id": "user_8421",
      "idempotency_key": "order-42:email",
      "estimated_cost": "0.02700000",
      "reserved_amount": "0.02700000",
      "captured_amount": "0.02700000",
      "overrun_amount": "0.02700000",
      "estimated_input_tokens": 1,
      "estimated_output_tokens": 1,
      "max_output_tokens": 1,
      "safety_multiplier": "string",
      "estimation_strategy": "fixed",
      "model_price_id": "74438200973594624",
      "customer_hold_id": "74438200973594624",
      "customer_hold_credits": "12.5000",
      "currency": "USD",
      "expires_at": "2026-10-02T09:30:00Z",
      "created_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 (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тіло кожної помилки — конверт помилки.

Приклади

Виконати флоу

Флоу, прив’язаний до generate_email, відповів одразу, тому статус — completed, а в output лежить те, що повернув флоу. cost.actual тут — null: виклик моделі закривається після відповіді.

Terminal
curl https://api.slen.ai/api/v1/operations/execute \
  -H "Authorization: Bearer $SLEN_API_KEY" \
  -H "Idempotency-Key: order-42:email" \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "generate_email",
    "input": {
      "messages": [
        {
          "role": "user",
          "content": "Write a short follow-up email."
        }
      ]
    }
  }'
200 OK
{
  "data": {
    "execution_id": "74438200973594700",
    "status": "completed",
    "operation": "generate_email",
    "output": {
      "model": "gpt-4o",
      "content": "Hi Ada, just checking in on the proposal I sent last week.",
      "finish_reason": "stop",
      "tool_calls": null,
      "usage": {
        "input_tokens": 14,
        "output_tokens": 16,
        "cached_input_tokens": 0
      }
    },
    "error": null,
    "error_code": null,
    "error_message": null,
    "cost": {
      "estimated": "0.00412500",
      "actual": null
    },
    "cache": {
      "hit": false,
      "cached_at": null
    },
    "replayed": false,
    "waiting_on": null,
    "trace_url": "/v1/executions/74438200973594700"
  }
}

Знайти виклики з невідомим результатом

Фільтр залишає операції зі статусом uncertain одного коду операції, ID клієнта яких починається з user_84, на першій нумерованій сторінці. Серед них — один виклик для user_8421.

Terminal
curl "https://api.slen.ai/api/v1/operations?q=user_84&operation_code=generate_email&status=uncertain&page=1" \
  -H "Authorization: Bearer $SLEN_API_KEY"
200 OK
{
  "data": [
    {
      "operation_id": "74442181054119936",
      "operation_code": "generate_email",
      "external_user_id": "user_8421",
      "status": "uncertain",
      "attempts": [],
      "created_at": "2026-10-02T09:12:04+00:00",
      "updated_at": "2026-10-02T09:13:04+00:00"
    }
  ],
  "meta": {
    "limit": 30,
    "page": 1,
    "total": 1,
    "total_capped": false,
    "anchor": "74442181054119936"
  }
}

Прочитати виклик із його спробами

Виклик мав одну спробу, через пул Primary. Підключення не відповіло вчасно, тому спроба — uncertain, і в ній немає ні токенів, ні вартості, ні finish_reason. Виклик — це виклик моделі вузла model одного флоу, і flow_execution називає його виконання.

Terminal
curl https://api.slen.ai/api/v1/operations/74442181054119936 \
  -H "Authorization: Bearer $SLEN_API_KEY"
200 OK
{
  "data": {
    "operation_id": "74442181054119936",
    "operation_code": "generate_email",
    "external_user_id": "user_8421",
    "status": "uncertain",
    "attempts": [
      {
        "attempt_id": "74442181058314240",
        "attempt_number": 1,
        "connection_id": "74438912450035712",
        "pool_id": "74438955400675328",
        "model_code": "gpt-4o-mini",
        "model_price_id": "1108",
        "status": "uncertain",
        "error_code": "operation_uncertain",
        "provider_request_id": null,
        "input_tokens": null,
        "output_tokens": null,
        "cost": null,
        "cost_multiplier": "1.0000",
        "latency_ms": 60004,
        "started_at": "2026-10-02T09:12:04+00:00",
        "completed_at": "2026-10-02T09:13:04+00:00",
        "pool_name": "Primary",
        "connection_name": "OpenAI production",
        "connection_deleted": false,
        "provider": "openai",
        "finish_reason": null
      }
    ],
    "created_at": "2026-10-02T09:12:04+00:00",
    "updated_at": "2026-10-02T09:13:04+00:00",
    "flow_execution": {
      "execution_id": "74442180941398016",
      "flow_id": "74438623450128384",
      "node_key": "model"
    }
  }
}

Отримати холди однієї операції

Запит лишає холди generate_email за останні сім днів, по двадцять на сторінку.

Terminal
curl "https://api.slen.ai/api/v1/authorizations?operation_code=generate_email&limit=20" \
  -H "Authorization: Bearer $SLEN_API_KEY"

Що читати далі

Зібрано з openapi b070e1f, sdk contract 5cc7055, php ae4a53b, node 84bc62d