---
title: "Batch operations"
method: POST
path: "/v2/workspaces/{id}/execute"
tags: ["Runtime"]
---

# Batch operations

`POST /v2/workspaces/{id}/execute`

## Request

- Base URL: `https://api.infolang.ai`
- URL: `https://api.infolang.ai/v2/workspaces/{id}/execute`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Up to 100 sub-ops, each billed individually; nested `execute` is rejected. The gateway wraps the body in Kairos's `{op,args}` dispatch envelope — clients send the bare `{operations}` shape documented here. The response is the NATIVE OpResult envelope (`{ok,payload:{results:[…]}}`), one result per sub-op in order. Class A — accepts a session JWT, an `il_live_`/`il_test_` API key, or an `il_oauth_` token. On the `il_*` lanes the bearer is forwarded to Kairos verbatim and Kairos enforces the credential's grant on this workspace (its 401/403 is surfaced in the v2 envelope). The response body is Kairos's, passed through unchanged; `X-InfoLang-Tokens-Saved` / `X-InfoLang-Overage` are echoed when set.

Requires the `memories:write` scope. Accepts all three lanes: a session JWT (bounded by the caller's role on this workspace) or an `il_*` machine credential whose own scope set, workspace set and validity window cover it — both ceilings apply and neither can raise the other, so a credential carrying `memories:write` is still refused where the role does not permit it.

A credential with no scope record resolves to `LEGACY_DEFAULT`, which INCLUDES `memories:write` — every key minted before scoping keeps working here.

## Path parameters

- `id` string, required

## Request body

- object
  - `operations` object[], required
    - `op` 'remember' | 'recall' | 'forget' | 'encode' | 'similarity' | 'get' | 'list' | 'set' | 'delete' | 'stats', required
    - `args` object, required

## Response `200`

Per-operation results (native envelope)

- object
  - `ok` boolean, required
  - `payload` object, nullable
  - `error` union
    - object
      - `code` string, required
      - `message` string, required
      - `capability` string
      - `available_on_tiers` string[]
      - `meter` string
      - `spend_cents` number
      - `budget_cents` number
    - string
    - unknown

## Other responses

- `401`: Missing/invalid credential
- `403`: The credential holds no grant on this workspace. Or `lane_not_supported` — the credential is well-formed but this route does not accept its lane
- `422`: Body failed the pinned kairos-runtime schema
- `502`: Upstream Kairos failure
- `503`: not_ready — Kairos ML backend still warming up

---

[API](https://skmtc.dev/infolang/apis/infolang-api.md) · [All operations](https://skmtc.dev/infolang/apis/infolang-api/llms.txt) · [OpenAPI document](https://skmtc.dev/infolang/apis/infolang-api/revisions/d04bf6de72c8?raw)
