Get run status/result (optionally long-poll until terminal)

Get run details including status, result, input, and duration.

Pass ?wait=<seconds> (or ?wait=true for the maximum) to long-poll: the server holds the request until the run reaches a terminal status (success, failed, timeout, cancelled) or the wait elapses, then returns the current run object exactly as the plain call does. The wait is capped at 55 seconds — deliberately below the 60 s idle timeouts that ship as defaults in common reverse proxies (nginx proxy_read_timeout, ALB idle timeout) so the long poll always completes with a real response instead of a proxy 504; values above the cap are clamped. A response with a non-terminal status simply means the wait timed out — issue the same call again to keep waiting. One long poll replaces N sleep+getRun round-trips, which is the recommended completion-wait pattern for MCP clients (the SSE stream is not reachable through the MCP server).

Concurrency bound: each identity (user or API key) may hold at most 10 concurrent waits across all runs. Beyond the cap the request degrades to the immediate no-wait response (wait is ignored) — a non-terminal status means poll again, and capacity self-heals as earlier waits resolve.

GET/api/runs/{id}

Authorization

better-auth.session_token<token>

Cookie session from Better Auth. Requires X-Org-Id header for org-scoped routes.

In: cookie

Path Parameters

id*string

Query Parameters

wait?|

Hold the request until the run reaches a terminal status or this many seconds elapse (capped at 55, see operation description), then return the run object. 0/false/absent = return immediately (default). Negative, fractional, or non-numeric values return 400. At most 10 concurrent waits per identity — beyond the cap the request returns immediately as if wait were 0 (degrade-to-immediate, see operation description).

Header Parameters

X-Org-Id?string

Organization ID. Required for cookie auth. Not needed for API key auth (org resolved from key).

Formatuuid
X-Space-Id?string

Space ID. Required for space-scoped routes (agents, runs, schedules, and space-scoped module routes). Not needed for API key auth (space resolved from key).

curl -X GET "https://your-instance/api/runs/string"
{
  "id": "run_cm1abc123def456",
  "packageId": "@acme/email-sorter",
  "userId": "usr_k7x9m2p4q1",
  "endUserId": null,
  "apiKeyId": null,
  "orgId": "org_r3t5w8y1z6",
  "spaceId": "spc_1d4e7a90-3c21-4b6f-8e05-6a9c2f7b1d38",
  "scheduleId": "sched_cm1abc456def789",
  "status": "success",
  "input": {
    "folder": "inbox",
    "maxEmails": 50
  },
  "result": {
    "output": {
      "processed": 42,
      "labeled": 38
    }
  },
  "artifacts": {
    "status": "complete",
    "published": 2,
    "failed": []
  },
  "checkpoint": {
    "lastProcessedId": "msg_99f2a"
  },
  "error": null,
  "metadata": null,
  "generation": {
    "reasoning_level": "medium"
  },
  "generation_override": null,
  "started_at": "2026-01-15T10:30:00Z",
  "completed_at": "2026-01-15T10:31:12Z",
  "duration": 72000,
  "cost": 0.0034,
  "cost_pricing_status": "priced",
  "unread": true,
  "runNumber": 17,
  "token_usage": {
    "input_tokens": 8200,
    "output_tokens": 4250,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 1024
  },
  "version_label": "1.2.0",
  "version_ref": "1.2.0",
  "proxy_label": null,
  "model_label": "Claude Sonnet 4",
  "model_source": "system",
  "runner_name": null,
  "runner_kind": null,
  "agent_scope": "@acme",
  "agent_name": "email-sorter",
  "runOrigin": "platform",
  "contextSnapshot": null,
  "modelCredentialId": null,
  "connection_overrides": null,
  "dependency_overrides": null,
  "user_name": "Pierre",
  "end_user_name": null,
  "api_key_name": null,
  "schedule_name": "Weekday morning sort",
  "connections_used": null,
  "package_ephemeral": false,
  "file_counts": {
    "input": 0,
    "output": 0
  }
}
{
  "type": "about:blank",
  "title": "Bad Request",
  "status": 400,
  "detail": "Invalid 'wait' value: expected true, false, or a non-negative integer number of seconds (max 55)",
  "code": "invalid_request",
  "request_id": "req_abc123"
}
{
  "type": "https://docs.appstrate.dev/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Invalid or missing session",
  "code": "unauthorized",
  "request_id": "req_abc123"
}
{
  "type": "https://docs.appstrate.dev/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "Insufficient permissions",
  "code": "forbidden",
  "request_id": "req_abc123"
}
{
  "type": "https://docs.appstrate.dev/errors/not-found",
  "title": "Not Found",
  "status": 404,
  "detail": "Resource not found",
  "code": "not_found",
  "request_id": "req_abc123"
}