API referenceChains

Run a chain of tool calls

Several tool calls in ONE request, run server-side: each step's result feeds later steps by $ref (generations are awaited, so "$img.url" is the finished picture), each fans a step out over an array re

Several tool calls in ONE request, run server-side: each step's result feeds later steps by $ref (generations are awaited, so "$img.url" is the finished picture), each fans a step out over an array result, and spend is bounded by credit_cap (required when any step spends: every spending step is priced with dry_run first and refused if the total would pass the cap). Stops at the first failed step. recipe + inputs runs a saved recipe. The chain outlives the request: this waits up to wait_sec (default 50) and answers 200 with the finished chain or 202 with the chain so far.

POST
/chains

Authorization

bearerAuth
AuthorizationBearer <token>

Typecut API key. Generate one in app.typecut.ai → Settings → API keys. Send as Authorization: Bearer tc_live_….

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/chains" \  -H "Content-Type: application/json" \  -d '{}'
{
  "data": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "status": "queued",
    "recipe": "string",
    "failed_step": "string",
    "error": "string",
    "credits": {
      "quoted": 0,
      "charged": 0,
      "cap": 0
    },
    "calls": {
      "ops": 0,
      "quotes": 0,
      "waits": 0,
      "receipts": 0,
      "total": 0
    },
    "steps": [
      {
        "id": "string",
        "op": "string",
        "status": "pending",
        "items": {
          "total": 0,
          "completed": 0,
          "failed": 0,
          "running": 0,
          "errors": [
            {
              "index": 0,
              "error": "string"
            }
          ]
        },
        "quoted": 0,
        "credits": 0,
        "credits_source": "ledger",
        "generation_id": "string",
        "error": "string",
        "result": null
      }
    ],
    "created_at": "string",
    "finished_at": "string",
    "elapsed_s": 0
  }
}
{
  "data": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "status": "queued",
    "recipe": "string",
    "failed_step": "string",
    "error": "string",
    "credits": {
      "quoted": 0,
      "charged": 0,
      "cap": 0
    },
    "calls": {
      "ops": 0,
      "quotes": 0,
      "waits": 0,
      "receipts": 0,
      "total": 0
    },
    "steps": [
      {
        "id": "string",
        "op": "string",
        "status": "pending",
        "items": {
          "total": 0,
          "completed": 0,
          "failed": 0,
          "running": 0,
          "errors": [
            {
              "index": 0,
              "error": "string"
            }
          ]
        },
        "quoted": 0,
        "credits": 0,
        "credits_source": "ledger",
        "generation_id": "string",
        "error": "string",
        "result": null
      }
    ],
    "created_at": "string",
    "finished_at": "string",
    "elapsed_s": 0
  }
}
{
  "error": {
    "type": "string",
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "type": "string",
    "code": "string",
    "message": "string"
  }
}
{
  "error": {
    "type": "string",
    "code": "string",
    "message": "string"
  }
}