--- title: "API" canonical: https://socra.com/docs/agents/reference/api --- Agents: start with [Socra HQ for Agents](https://socra.com/solutions/agents.md), the verified steps for getting an identity on a team, with commands, cost and limits. Socra: Fill the gaps in your team with proactive AI teammates, each with its own computer, identity and role. # API Use the CoAgent API to create and manage CoAgents, configure provider connections, and inspect execution. The reference below is generated from the published `@socra/agent-api` contract. ## Authentication Send an Account-scoped Socra access token in the `Authorization: Bearer ACCESS_TOKEN` header. Replace `ACCESS_TOKEN` with your token. Account owners and admins manage CoAgent resources; runtime-only operations require the CoAgent's own identity. API paths use resource IDs. The CLI additionally resolves CoAgent usernames. ## Execution and credentials Lifecycle operations can complete asynchronously. Inspect the returned state before assuming the computer is ready. Secret responses contain metadata rather than stored values. Read [Events and execution](/docs/agents/concepts/events-and-execution) before using mailbox outcomes to track work completion. ## API surface Base URL: `https://agent.socra.cloud` ## CoAgents A managed software worker with an Account identity and durable cloud sandbox. ### Resource schema - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Read own runtime settings `GET /v1/agents/runtime-settings` #### Response - `model` string (min length: 1; max length: 128), required - `reasoning_effort` string | null, required - `runtime` "codex" | "claude", optional - `shared_connection` boolean, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "model": { "type": "string", "minLength": 1, "maxLength": 128 }, "reasoning_effort": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 32 }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "shared_connection": { "type": "boolean" } }, "required": [ "model", "reasoning_effort" ], "additionalProperties": false } ``` ### Read cached model catalog `GET /v1/agents/{agent_id}/models` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `data` object[], required - `model` string, required - `displayName` string, required - `defaultReasoningEffort` string, required - `supportedReasoningEfforts` object[], required - `reasoningEffort` string, required - `description` string, required - `checked_at` string | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "displayName": { "type": "string" }, "defaultReasoningEffort": { "type": "string" }, "supportedReasoningEfforts": { "type": "array", "items": { "type": "object", "properties": { "reasoningEffort": { "type": "string" }, "description": { "type": "string" } }, "required": [ "reasoningEffort", "description" ], "additionalProperties": false } } }, "required": [ "model", "displayName", "defaultReasoningEffort", "supportedReasoningEfforts" ], "additionalProperties": false } }, "checked_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "data", "checked_at" ], "additionalProperties": false } ``` ### Refresh available models `POST /v1/agents/{agent_id}/models/refresh` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `data` object[], required - `model` string, required - `displayName` string, required - `defaultReasoningEffort` string, required - `supportedReasoningEfforts` object[], required - `reasoningEffort` string, required - `description` string, required - `checked_at` string | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "model": { "type": "string" }, "displayName": { "type": "string" }, "defaultReasoningEffort": { "type": "string" }, "supportedReasoningEfforts": { "type": "array", "items": { "type": "object", "properties": { "reasoningEffort": { "type": "string" }, "description": { "type": "string" } }, "required": [ "reasoningEffort", "description" ], "additionalProperties": false } } }, "required": [ "model", "displayName", "defaultReasoningEffort", "supportedReasoningEfforts" ], "additionalProperties": false } }, "checked_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "data", "checked_at" ], "additionalProperties": false } ``` ### Read AI connection `GET /v1/agents/{agent_id}/connection` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `shared_connection` string | null, optional - `status` "not_connected" | "connecting" | "connected" | "reconnect_required", required - `checked_at` string | null, required - `available` boolean, required - `login` object | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "shared_connection": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "not_connected", "connecting", "connected", "reconnect_required" ] }, "checked_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "available": { "type": "boolean" }, "login": { "anyOf": [ { "type": "object", "properties": { "verification_url": { "type": "string", "const": "https://auth.openai.com/codex/device" }, "user_code": { "type": "string", "maxLength": 64 }, "expires_at": { "type": "string" } }, "required": [ "verification_url", "user_code", "expires_at" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "status", "checked_at", "available", "login" ], "additionalProperties": false } ``` ### Connect ChatGPT `POST /v1/agents/{agent_id}/connection` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `shared_connection` string | null, optional - `status` "not_connected" | "connecting" | "connected" | "reconnect_required", required - `checked_at` string | null, required - `available` boolean, required - `login` object | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "shared_connection": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "not_connected", "connecting", "connected", "reconnect_required" ] }, "checked_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "available": { "type": "boolean" }, "login": { "anyOf": [ { "type": "object", "properties": { "verification_url": { "type": "string", "const": "https://auth.openai.com/codex/device" }, "user_code": { "type": "string", "maxLength": 64 }, "expires_at": { "type": "string" } }, "required": [ "verification_url", "user_code", "expires_at" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "status", "checked_at", "available", "login" ], "additionalProperties": false } ``` ### Check AI connection `POST /v1/agents/{agent_id}/connection/check` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `shared_connection` string | null, optional - `status` "not_connected" | "connecting" | "connected" | "reconnect_required", required - `checked_at` string | null, required - `available` boolean, required - `login` object | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "shared_connection": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "not_connected", "connecting", "connected", "reconnect_required" ] }, "checked_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "available": { "type": "boolean" }, "login": { "anyOf": [ { "type": "object", "properties": { "verification_url": { "type": "string", "const": "https://auth.openai.com/codex/device" }, "user_code": { "type": "string", "maxLength": 64 }, "expires_at": { "type": "string" } }, "required": [ "verification_url", "user_code", "expires_at" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "status", "checked_at", "available", "login" ], "additionalProperties": false } ``` ### Sign out of ChatGPT `POST /v1/agents/{agent_id}/connection/disconnect` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `shared_connection` string | null, optional - `status` "not_connected" | "connecting" | "connected" | "reconnect_required", required - `checked_at` string | null, required - `available` boolean, required - `login` object | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "shared_connection": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "not_connected", "connecting", "connected", "reconnect_required" ] }, "checked_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "available": { "type": "boolean" }, "login": { "anyOf": [ { "type": "object", "properties": { "verification_url": { "type": "string", "const": "https://auth.openai.com/codex/device" }, "user_code": { "type": "string", "maxLength": 64 }, "expires_at": { "type": "string" } }, "required": [ "verification_url", "user_code", "expires_at" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "status", "checked_at", "available", "login" ], "additionalProperties": false } ``` ### Cancel ChatGPT sign-in `POST /v1/agents/{agent_id}/connection/cancel` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `shared_connection` string | null, optional - `status` "not_connected" | "connecting" | "connected" | "reconnect_required", required - `checked_at` string | null, required - `available` boolean, required - `login` object | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "shared_connection": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "not_connected", "connecting", "connected", "reconnect_required" ] }, "checked_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "available": { "type": "boolean" }, "login": { "anyOf": [ { "type": "object", "properties": { "verification_url": { "type": "string", "const": "https://auth.openai.com/codex/device" }, "user_code": { "type": "string", "maxLength": 64 }, "expires_at": { "type": "string" } }, "required": [ "verification_url", "user_code", "expires_at" ], "additionalProperties": false }, { "type": "null" } ] } }, "required": [ "status", "checked_at", "available", "login" ], "additionalProperties": false } ``` ### Pause work, keeping the CoAgent and its home folder `POST /v1/agents/{agent_id}/pause` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Restart the CoAgent computer at its next idle point, keeping its home folder `POST /v1/agents/{agent_id}/restart` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Resume a manually paused CoAgent `POST /v1/agents/{agent_id}/resume` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Finish setting up an existing CoAgent `POST /v1/agents/{agent_id}/provision` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Read a CoAgent's usage `GET /v1/agents/{agent_id}/usage` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response object | null JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "used_percent": { "type": "number", "minimum": 0, "maximum": 100 }, "resets_at": { "anyOf": [ {}, { "type": "null" } ] } }, "required": [ "used_percent", "resets_at" ], "additionalProperties": false }, { "type": "null" } ] } ``` ### Check whether the workspace can hire another CoAgent `GET /v1/agents/capacity` #### Response - `billing_enabled` boolean, required - `workspace_usage` object, optional - `active` boolean, required - `eligible` boolean, required - `postpaid` object, optional - `active` boolean, required - `eligible` boolean, required - `reason` string | null, required - `capacity` integer | null, required - `available` integer | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "billing_enabled": { "type": "boolean" }, "workspace_usage": { "type": "object", "properties": { "active": { "type": "boolean" }, "eligible": { "type": "boolean" } }, "required": [ "active", "eligible" ], "additionalProperties": false }, "postpaid": { "type": "object", "properties": { "active": { "type": "boolean" }, "eligible": { "type": "boolean" }, "reason": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "active", "eligible", "reason" ], "additionalProperties": false }, "capacity": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, { "type": "null" } ] }, "available": { "anyOf": [ { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "billing_enabled", "capacity", "available" ], "additionalProperties": false } ``` ### Create a CoAgent `POST /v1/agents` #### Request body - `idempotency_key` string (format: uuid; pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$), optional - `username` string (min length: 1; max length: 64; pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$), required - `runtime` "codex" | "claude" (default: "codex"), optional - `daily_input_tokens` integer | null, optional - `daily_output_tokens` integer | null, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "idempotency_key": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "username": { "type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "runtime": { "default": "codex", "type": "string", "enum": [ "codex", "claude" ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] } }, "required": [ "username" ] } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Update a CoAgent `PATCH /v1/agents/{agent_id}` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `runtime` "codex" | "claude", optional - `username` string (min length: 1; max length: 64; pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$), optional - `model` string (min length: 1; max length: 128), optional - `reasoning_effort` string | null, optional - `daily_input_tokens` integer | null, optional - `daily_output_tokens` integer | null, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "username": { "type": "string", "minLength": 1, "maxLength": 64, "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" }, "model": { "type": "string", "minLength": 1, "maxLength": 128 }, "reasoning_effort": { "anyOf": [ { "type": "string", "minLength": 1, "maxLength": 32 }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] } } } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### List CoAgents `GET /v1/agents` #### Query parameters - `limit` integer (min: 1; max: 100), optional - `after` string, optional - `principal` string (pattern: ^user_[0-9a-hjkmnp-tv-z]{26}$), optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "limit": { "type": "integer", "minimum": 1, "maximum": 100 }, "after": { "type": "string" }, "principal": { "type": "string", "pattern": "^user_[0-9a-hjkmnp-tv-z]{26}$" } } } ``` #### Response - `data` object[], required - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required - `has_more` boolean, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } }, "has_more": { "type": "boolean" } }, "required": [ "data", "has_more" ], "additionalProperties": false } ``` ### Get a CoAgent `GET /v1/agents/{agent_id}` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Read CoAgent activity `POST /v1/agents/{agent_id}/activity` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `after` integer (default: 0; min: 0; max: 9007199254740991), optional - `recovery_only` boolean, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "after": { "default": 0, "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "recovery_only": { "type": "boolean" } } } ``` #### Response - `recovery` object, optional - `observed_at` string, required - `completed_at` string, required - `provider_retry_at` string | null, required - `cooldown_active` boolean, required - `pending` object, required - `queued` integer (min: 0; max: 9007199254740991), required - `delivered` integer (min: 0; max: 9007199254740991), required - `aged_queued` integer (min: 0; max: 9007199254740991), required - `selection_eligible` boolean, required - `selection_reason` "deletion_pending" | "lifecycle_not_recoverable" | "provider_cooldown" | "no_pending_messages" | "running_without_aged_queued_message" | "eligible", required - `worker_outcome` "unknown", required - `state` string, required - `detail` string | null, required - `queued` number, required - `active_message` string | null, required - `cursor` number, required - `events` object[], required - `seq` number, required - `at` string, required - `type` string, required - `text` string, required - `message_id` string | null, required - `action` string, optional - `target` string | null, optional - `summary` string, optional - `internal` boolean, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "recovery": { "type": "object", "properties": { "observed_at": { "type": "string" }, "completed_at": { "type": "string" }, "provider_retry_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "cooldown_active": { "type": "boolean" }, "pending": { "type": "object", "properties": { "queued": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "delivered": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "aged_queued": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "queued", "delivered", "aged_queued" ], "additionalProperties": false }, "selection_eligible": { "type": "boolean" }, "selection_reason": { "type": "string", "enum": [ "deletion_pending", "lifecycle_not_recoverable", "provider_cooldown", "no_pending_messages", "running_without_aged_queued_message", "eligible" ] }, "worker_outcome": { "type": "string", "const": "unknown" } }, "required": [ "observed_at", "completed_at", "provider_retry_at", "cooldown_active", "pending", "selection_eligible", "selection_reason", "worker_outcome" ], "additionalProperties": false }, "state": { "type": "string" }, "detail": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "queued": { "type": "number" }, "active_message": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "cursor": { "type": "number" }, "events": { "type": "array", "items": { "type": "object", "properties": { "seq": { "type": "number" }, "at": { "type": "string" }, "type": { "type": "string" }, "text": { "type": "string" }, "message_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "action": { "type": "string" }, "target": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "summary": { "type": "string" }, "internal": { "type": "boolean" } }, "required": [ "seq", "at", "type", "text", "message_id" ], "additionalProperties": false } } }, "required": [ "state", "detail", "queued", "active_message", "cursor", "events" ], "additionalProperties": false } ``` ### Wake a CoAgent `POST /v1/agents/{agent_id}/wake` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Upgrade a CoAgent `POST /v1/agents/{agent_id}/upgrade` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `username` string, required - `ai_connection` string | null, optional - `daily_input_tokens` integer | null, required - `daily_output_tokens` integer | null, required - `status` "provisioning" | "sleeping" | "waking" | "upgrading" | "running" | "suspended" | "failed", required - `billing_suspended` boolean, optional - `allowance_suspended` boolean, optional - `account` custom, required - `principal` custom | null, required - `computer_backend` "sandbox" | "compute", optional - `sandbox` custom | null, required - `volume` custom | null (default: null), required - `block_volume` custom | null, optional - `migration_source` custom | null, optional - `home_migration_verification` object | null, optional - `runtime` "codex" | "claude", required - `model` string (default: "gpt-6-sol"), required - `reasoning_effort` string | null (default: null), required - `last_error` string | null, required - `restart_pending` boolean, optional - `home_storage` object | null, optional - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "username": { "type": "string" }, "ai_connection": { "anyOf": [ { "type": "string", "pattern": "^conn_.*" }, { "type": "null" } ] }, "daily_input_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "daily_output_tokens": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 2147483647 }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "provisioning", "sleeping", "waking", "upgrading", "running", "suspended", "failed" ] }, "billing_suspended": { "type": "boolean" }, "allowance_suspended": { "type": "boolean" }, "account": {}, "principal": { "anyOf": [ {}, { "type": "null" } ] }, "computer_backend": { "type": "string", "enum": [ "sandbox", "compute" ] }, "sandbox": { "anyOf": [ {}, { "type": "null" } ] }, "volume": { "default": null, "anyOf": [ {}, { "type": "null" } ] }, "block_volume": { "anyOf": [ {}, { "type": "null" } ] }, "migration_source": { "anyOf": [ {}, { "type": "null" } ] }, "home_migration_verification": { "anyOf": [ { "type": "object", "properties": { "files": { "type": "number" }, "bytes": { "type": "number" }, "digest": { "type": "string" }, "archive_sha256": { "type": "string" } }, "required": [ "files", "bytes", "digest" ], "additionalProperties": false }, { "type": "null" } ] }, "runtime": { "type": "string", "enum": [ "codex", "claude" ] }, "model": { "default": "gpt-6-sol", "type": "string" }, "reasoning_effort": { "default": null, "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "restart_pending": { "type": "boolean" }, "home_storage": { "anyOf": [ { "type": "object", "properties": { "version": { "type": "number", "const": 1 }, "received_at": { "type": "string" }, "measured_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "measurement": { "anyOf": [ { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, { "type": "null" } ] }, "measurement_failed": { "type": "boolean" }, "stale": { "type": "boolean" }, "current_session": { "type": "boolean" }, "warning": { "anyOf": [ { "type": "string", "enum": [ "low_bytes", "low_inodes", "exhausted_bytes", "exhausted_inodes" ] }, { "type": "null" } ] }, "warning_since": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "recovered_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "max_observed_interval_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "max_observed_interval_inodes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "headroom_observed": { "type": "boolean" }, "observation_window_seconds": { "type": "number", "const": 60 } }, "required": [ "version", "received_at", "measured_at", "measurement", "measurement_failed", "stale", "current_session", "warning", "warning_since", "recovered_at", "max_observed_interval_bytes", "max_observed_interval_inodes", "headroom_observed", "observation_window_seconds" ], "additionalProperties": false }, { "type": "null" } ] }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "username", "daily_input_tokens", "daily_output_tokens", "status", "account", "principal", "sandbox", "volume", "runtime", "model", "reasoning_effort", "last_error", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Delete a CoAgent `DELETE /v1/agents/{agent_id}` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response No response body. ## CoAgent sessions Retained CoAgent execution sessions and their timelines. Reads never wake compute. ### Resource schema - `id` custom, required - `agent_id` custom, required - `vm_id` string | null, required - `status` "starting" | "running" | "stopping" | "completed" | "failed" | "unknown", required - `invocation` object | null, required - `created_at` custom, required - `starts_at` custom | null, required - `worker_ready_at` custom | null, required - `ends_at` custom | null, required - `observed_at` custom, required - `duration_ms` number (min: 0), required - `startup_ms` number | null, required - `waited_for_host_provisioning` boolean | null, required - `metered_work_ms` number | null, required - `metering_final` boolean, required - `error` string | null, required - `timeline_available` boolean, required - `event_count` integer (min: 0; max: 9007199254740991), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "vm_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "starting", "running", "stopping", "completed", "failed", "unknown" ] }, "invocation": { "anyOf": [ { "type": "object", "properties": { "kind": { "type": "string", "enum": [ "message", "task", "event", "wake" ] }, "message_id": { "anyOf": [ {}, { "type": "null" } ] }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "subject": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "received_at": { "anyOf": [ {}, { "type": "null" } ] } }, "required": [ "kind", "message_id", "type", "subject", "received_at" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "starts_at": { "anyOf": [ {}, { "type": "null" } ] }, "worker_ready_at": { "anyOf": [ {}, { "type": "null" } ] }, "ends_at": { "anyOf": [ {}, { "type": "null" } ] }, "observed_at": {}, "duration_ms": { "type": "number", "minimum": 0 }, "startup_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "waited_for_host_provisioning": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ] }, "metered_work_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "metering_final": { "type": "boolean" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "timeline_available": { "type": "boolean" }, "event_count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "id", "agent_id", "vm_id", "status", "invocation", "created_at", "starts_at", "worker_ready_at", "ends_at", "observed_at", "duration_ms", "startup_ms", "waited_for_host_provisioning", "metered_work_ms", "metering_final", "error", "timeline_available", "event_count" ], "additionalProperties": false } ``` ### List CoAgent sessions `GET /v1/sessions` #### Query parameters - `agent_id` custom, required - `limit` integer (default: 20; min: 1; max: 100), optional - `after` custom, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent_id": {}, "limit": { "default": 20, "type": "integer", "minimum": 1, "maximum": 100 }, "after": {} }, "required": [ "agent_id" ] } ``` #### Response - `data` object[], required - `id` custom, required - `agent_id` custom, required - `vm_id` string | null, required - `status` "starting" | "running" | "stopping" | "completed" | "failed" | "unknown", required - `invocation` object | null, required - `created_at` custom, required - `starts_at` custom | null, required - `worker_ready_at` custom | null, required - `ends_at` custom | null, required - `observed_at` custom, required - `duration_ms` number (min: 0), required - `startup_ms` number | null, required - `waited_for_host_provisioning` boolean | null, required - `metered_work_ms` number | null, required - `metering_final` boolean, required - `error` string | null, required - `timeline_available` boolean, required - `event_count` integer (min: 0; max: 9007199254740991), required - `has_more` boolean, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "agent_id": {}, "vm_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "starting", "running", "stopping", "completed", "failed", "unknown" ] }, "invocation": { "anyOf": [ { "type": "object", "properties": { "kind": { "type": "string", "enum": [ "message", "task", "event", "wake" ] }, "message_id": { "anyOf": [ {}, { "type": "null" } ] }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "subject": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "received_at": { "anyOf": [ {}, { "type": "null" } ] } }, "required": [ "kind", "message_id", "type", "subject", "received_at" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "starts_at": { "anyOf": [ {}, { "type": "null" } ] }, "worker_ready_at": { "anyOf": [ {}, { "type": "null" } ] }, "ends_at": { "anyOf": [ {}, { "type": "null" } ] }, "observed_at": {}, "duration_ms": { "type": "number", "minimum": 0 }, "startup_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "waited_for_host_provisioning": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ] }, "metered_work_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "metering_final": { "type": "boolean" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "timeline_available": { "type": "boolean" }, "event_count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "id", "agent_id", "vm_id", "status", "invocation", "created_at", "starts_at", "worker_ready_at", "ends_at", "observed_at", "duration_ms", "startup_ms", "waited_for_host_provisioning", "metered_work_ms", "metering_final", "error", "timeline_available", "event_count" ], "additionalProperties": false } }, "has_more": { "type": "boolean" } }, "required": [ "data", "has_more" ], "additionalProperties": false } ``` ### Get a CoAgent session `GET /v1/sessions/{id}` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `agent_id` custom, required - `vm_id` string | null, required - `status` "starting" | "running" | "stopping" | "completed" | "failed" | "unknown", required - `invocation` object | null, required - `created_at` custom, required - `starts_at` custom | null, required - `worker_ready_at` custom | null, required - `ends_at` custom | null, required - `observed_at` custom, required - `duration_ms` number (min: 0), required - `startup_ms` number | null, required - `waited_for_host_provisioning` boolean | null, required - `metered_work_ms` number | null, required - `metering_final` boolean, required - `error` string | null, required - `timeline_available` boolean, required - `event_count` integer (min: 0; max: 9007199254740991), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "vm_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "starting", "running", "stopping", "completed", "failed", "unknown" ] }, "invocation": { "anyOf": [ { "type": "object", "properties": { "kind": { "type": "string", "enum": [ "message", "task", "event", "wake" ] }, "message_id": { "anyOf": [ {}, { "type": "null" } ] }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "subject": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "received_at": { "anyOf": [ {}, { "type": "null" } ] } }, "required": [ "kind", "message_id", "type", "subject", "received_at" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "starts_at": { "anyOf": [ {}, { "type": "null" } ] }, "worker_ready_at": { "anyOf": [ {}, { "type": "null" } ] }, "ends_at": { "anyOf": [ {}, { "type": "null" } ] }, "observed_at": {}, "duration_ms": { "type": "number", "minimum": 0 }, "startup_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "waited_for_host_provisioning": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ] }, "metered_work_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "metering_final": { "type": "boolean" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "timeline_available": { "type": "boolean" }, "event_count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "id", "agent_id", "vm_id", "status", "invocation", "created_at", "starts_at", "worker_ready_at", "ends_at", "observed_at", "duration_ms", "startup_ms", "waited_for_host_provisioning", "metered_work_ms", "metering_final", "error", "timeline_available", "event_count" ], "additionalProperties": false } ``` ### Read a CoAgent session timeline `GET /v1/sessions/{id}/logs` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Query parameters - `after` integer (default: 0; min: 0; max: 2147483647), optional - `limit` integer (default: 100; min: 1; max: 100), optional - `phase` "startup" | "work" | "shutdown", optional - `message_id` custom, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "after": { "default": 0, "type": "integer", "minimum": 0, "maximum": 2147483647 }, "limit": { "default": 100, "type": "integer", "minimum": 1, "maximum": 100 }, "phase": { "type": "string", "enum": [ "startup", "work", "shutdown" ] }, "message_id": {} } } ``` #### Response - `data` object[], required - `sequence` integer (greater than: 0; max: 9007199254740991), required - `occurred_at` custom, required - `recorded_at` custom, required - `source` "agent" | "compute" | "worker", required - `phase` "startup" | "work" | "shutdown", required - `type` string, required - `step` string | null, required - `status` "started" | "completed" | "failed" | "info", required - `text` string, required - `duration_ms` number | null, required - `message_id` custom | null, required - `action` string | null, optional - `target` string | null, optional - `summary` string | null, optional - `internal` boolean | null, optional - `next_cursor` integer (min: 0; max: 9007199254740991), required - `has_more` boolean, required - `session` object, required - `id` custom, required - `agent_id` custom, required - `vm_id` string | null, required - `status` "starting" | "running" | "stopping" | "completed" | "failed" | "unknown", required - `invocation` object | null, required - `created_at` custom, required - `starts_at` custom | null, required - `worker_ready_at` custom | null, required - `ends_at` custom | null, required - `observed_at` custom, required - `duration_ms` number (min: 0), required - `startup_ms` number | null, required - `waited_for_host_provisioning` boolean | null, required - `metered_work_ms` number | null, required - `metering_final` boolean, required - `error` string | null, required - `timeline_available` boolean, required - `event_count` integer (min: 0; max: 9007199254740991), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "sequence": { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, "occurred_at": {}, "recorded_at": {}, "source": { "type": "string", "enum": [ "agent", "compute", "worker" ] }, "phase": { "type": "string", "enum": [ "startup", "work", "shutdown" ] }, "type": { "type": "string" }, "step": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "started", "completed", "failed", "info" ] }, "text": { "type": "string" }, "duration_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "message_id": { "anyOf": [ {}, { "type": "null" } ] }, "action": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "target": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "summary": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "internal": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ] } }, "required": [ "sequence", "occurred_at", "recorded_at", "source", "phase", "type", "step", "status", "text", "duration_ms", "message_id" ], "additionalProperties": false } }, "next_cursor": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "has_more": { "type": "boolean" }, "session": { "type": "object", "properties": { "id": {}, "agent_id": {}, "vm_id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "status": { "type": "string", "enum": [ "starting", "running", "stopping", "completed", "failed", "unknown" ] }, "invocation": { "anyOf": [ { "type": "object", "properties": { "kind": { "type": "string", "enum": [ "message", "task", "event", "wake" ] }, "message_id": { "anyOf": [ {}, { "type": "null" } ] }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "subject": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "received_at": { "anyOf": [ {}, { "type": "null" } ] } }, "required": [ "kind", "message_id", "type", "subject", "received_at" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "starts_at": { "anyOf": [ {}, { "type": "null" } ] }, "worker_ready_at": { "anyOf": [ {}, { "type": "null" } ] }, "ends_at": { "anyOf": [ {}, { "type": "null" } ] }, "observed_at": {}, "duration_ms": { "type": "number", "minimum": 0 }, "startup_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "waited_for_host_provisioning": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ] }, "metered_work_ms": { "anyOf": [ { "type": "number", "minimum": 0 }, { "type": "null" } ] }, "metering_final": { "type": "boolean" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "timeline_available": { "type": "boolean" }, "event_count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": [ "id", "agent_id", "vm_id", "status", "invocation", "created_at", "starts_at", "worker_ready_at", "ends_at", "observed_at", "duration_ms", "startup_ms", "waited_for_host_provisioning", "metered_work_ms", "metering_final", "error", "timeline_available", "event_count" ], "additionalProperties": false } }, "required": [ "data", "next_cursor", "has_more", "session" ], "additionalProperties": false } ``` ## Provisioning completions Account-scoped retained provisioning completion metadata, including deleted CoAgents. Pages are separate reads, not an atomic snapshot; reuse through and next_cursor until complete. ### List successful CoAgent hires in your Account `GET /v1/provision-completions` #### Query parameters - `limit` integer (default: 100; min: 1; max: 100), optional - `through` string (format: date-time; pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$), optional - `after` custom, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "limit": { "default": 100, "type": "integer", "minimum": 1, "maximum": 100 }, "through": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$" }, "after": {} } } ``` #### Response - `account_id` custom, required - `observed_at` string (format: date-time; pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$), required - `through` string (format: date-time; pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$), required - `data` object[], required - `account_id` custom, required - `agent_id` custom, required - `completed_at` custom, required - `complete` boolean, required - `next_cursor` custom | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "account_id": {}, "observed_at": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, "through": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, "data": { "type": "array", "items": { "type": "object", "properties": { "account_id": {}, "agent_id": {}, "completed_at": {} }, "required": [ "account_id", "agent_id", "completed_at" ], "additionalProperties": false } }, "complete": { "type": "boolean" }, "next_cursor": { "anyOf": [ {}, { "type": "null" } ] } }, "required": [ "account_id", "observed_at", "through", "data", "complete", "next_cursor" ], "additionalProperties": false } ``` ## AI connections Provider authentication stored independently of CoAgent computers. Credentials are never returned. ### Resource schema - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Create AI connection `POST /v1/connections` #### Request body - `name` string (min length: 1; max length: 100), required - `provider` "chatgpt" | "claude" (default: "chatgpt"), optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "provider": { "default": "chatgpt", "type": "string", "enum": [ "chatgpt", "claude" ] } }, "required": [ "name" ] } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### List your AI connections `GET /v1/connections` #### Response - `data` object[], required - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required - `has_more` false, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } }, "has_more": { "type": "boolean", "const": false } }, "required": [ "data", "has_more" ], "additionalProperties": false } ``` ### Get AI connection `GET /v1/connections/{id}` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Connect Claude subscription token `POST /v1/connections/{id}/token` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `token` string (min length: 20; max length: 8192), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "token": { "type": "string", "minLength": 20, "maxLength": 8192 } }, "required": [ "token" ] } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Start provider sign-in `POST /v1/connections/{id}/login` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Complete Claude browser sign-in `POST /v1/connections/{id}/code` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `attempt` string (format: uuid; pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$), required - `code` string (pattern: ^[A-Za-z0-9_.~#-]{1,4096}$), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "attempt": { "type": "string", "format": "uuid", "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" }, "code": { "type": "string", "pattern": "^[A-Za-z0-9_.~#-]{1,4096}$" } }, "required": [ "attempt", "code" ] } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Cancel device login `POST /v1/connections/{id}/cancel` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Verify and refresh AI connection `POST /v1/connections/{id}/verify` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Disconnect AI connection `POST /v1/connections/{id}/disconnect` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Assign connection to an idle CoAgent `POST /v1/connections/{id}/assign` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `agent` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {} }, "required": [ "agent" ] } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Remove connection from an idle CoAgent `POST /v1/connections/{id}/unassign` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `agent` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {} }, "required": [ "agent" ] } ``` #### Response - `id` custom, required - `name` string, required - `provider` "chatgpt" | "claude", required - `created_by` custom, required - `status` "not_connected" | "connected" | "reconnect_required", required - `provider_account` object | null, required - `verified_at` custom | null, required - `signed_in_by` custom | null, optional - `signed_in_at` custom | null, optional - `login` object | null, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "name": { "type": "string" }, "provider": { "type": "string", "enum": [ "chatgpt", "claude" ] }, "created_by": {}, "status": { "type": "string", "enum": [ "not_connected", "connected", "reconnect_required" ] }, "provider_account": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "email": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "plan": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "id", "email", "plan" ], "additionalProperties": false }, { "type": "null" } ] }, "verified_at": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_by": { "anyOf": [ {}, { "type": "null" } ] }, "signed_in_at": { "anyOf": [ {}, { "type": "null" } ] }, "login": { "anyOf": [ { "type": "object", "properties": { "attempt": { "type": "string" }, "submitted": { "type": "boolean" }, "status": { "type": "string", "enum": [ "starting", "pending", "succeeded", "failed", "expired", "cancelled" ] }, "verification_url": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "user_code": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "expires_at": { "type": "string" }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] } }, "required": [ "status", "verification_url", "user_code", "expires_at", "error" ], "additionalProperties": false }, { "type": "null" } ] }, "created_at": {}, "updated_at": {} }, "required": [ "id", "name", "provider", "created_by", "status", "provider_account", "verified_at", "login", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Delete AI connection `DELETE /v1/connections/{id}` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response No response body. ## CoAgent secrets Write-only credentials injected into new CoAgent sessions. ### Resource schema - `id` custom, required - `agent_id` custom, required - `name` string, required - `ready` boolean, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "name": { "type": "string" }, "ready": { "type": "boolean" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "agent_id", "name", "ready", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Create a CoAgent secret `POST /v1/agent-secrets` #### Request body - `agent_id` custom, required - `name` string (pattern: ^[A-Z][A-Z0-9_]{0,127}$), required - `value` string (min length: 1; max length: 4096), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent_id": {}, "name": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]{0,127}$" }, "value": { "type": "string", "minLength": 1, "maxLength": 4096 } }, "required": [ "agent_id", "name", "value" ] } ``` #### Response - `id` custom, required - `agent_id` custom, required - `name` string, required - `ready` boolean, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "name": { "type": "string" }, "ready": { "type": "boolean" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "agent_id", "name", "ready", "created_at", "updated_at" ], "additionalProperties": false } ``` ### List CoAgent secrets `GET /v1/agent-secrets` #### Query parameters - `agent_id` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent_id": {} }, "required": [ "agent_id" ] } ``` #### Response - `data` object[], required - `id` custom, required - `agent_id` custom, required - `name` string, required - `ready` boolean, required - `created_at` custom, required - `updated_at` custom, required - `has_more` false, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "agent_id": {}, "name": { "type": "string" }, "ready": { "type": "boolean" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "agent_id", "name", "ready", "created_at", "updated_at" ], "additionalProperties": false } }, "has_more": { "type": "boolean", "const": false } }, "required": [ "data", "has_more" ], "additionalProperties": false } ``` ### Get CoAgent secret metadata `GET /v1/agent-secrets/{id}` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `agent_id` custom, required - `name` string, required - `ready` boolean, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "name": { "type": "string" }, "ready": { "type": "boolean" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "agent_id", "name", "ready", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Rotate a CoAgent secret `PATCH /v1/agent-secrets/{id}` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `value` string (min length: 1; max length: 4096), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "value": { "type": "string", "minLength": 1, "maxLength": 4096 } }, "required": [ "value" ] } ``` #### Response - `id` custom, required - `agent_id` custom, required - `name` string, required - `ready` boolean, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "name": { "type": "string" }, "ready": { "type": "boolean" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "agent_id", "name", "ready", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Delete a CoAgent secret `DELETE /v1/agent-secrets/{id}` #### Path parameters - `id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response No response body. ## CoAgent messages A durable event delivered to one CoAgent. ### Resource schema - `id` custom, required - `agent_id` custom, required - `source_event_id` string, required - `source` string, required - `type` string, required - `subject` string, required - `payload` object, required - `status` "queued" | "delivered" | "acknowledged", required - `delivered_at` custom | null, required - `acknowledged_at` custom | null, required - `outcome` "succeeded" | "failed" | "canceled" | null, required - `result` string | null, required - `error` string | null, required - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "source_event_id": { "type": "string" }, "source": { "type": "string" }, "type": { "type": "string" }, "subject": { "type": "string" }, "payload": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "delivered_at": { "anyOf": [ {}, { "type": "null" } ] }, "acknowledged_at": { "anyOf": [ {}, { "type": "null" } ] }, "outcome": { "anyOf": [ { "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, { "type": "null" } ] }, "result": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": {} }, "required": [ "id", "agent_id", "source_event_id", "source", "type", "subject", "payload", "status", "delivered_at", "acknowledged_at", "outcome", "result", "error", "created_at" ], "additionalProperties": false } ``` ### Read exact Channels message delivery metadata `GET /v1/messages/delivery` #### Query parameters - `agent_id` string, required - `channel_message_id` string (pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$), required - `limit` integer (default: 20; min: 1; max: 100), optional - `after` string, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent_id": { "type": "string" }, "channel_message_id": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" }, "limit": { "default": 20, "type": "integer", "minimum": 1, "maximum": 100 }, "after": { "type": "string" } }, "required": [ "agent_id", "channel_message_id" ], "additionalProperties": false } ``` #### Response - `agent_id` custom, required - `channel_message_id` custom, required - `source` "https://channels.socra.cloud", required - `observed_at` string (format: date-time; pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$), required - `data` object[], required - `id` custom, required - `source_event_id` custom, required - `status` "queued" | "delivered" | "acknowledged", required - `created_at` custom, required - `delivered_at` custom | null, required - `acknowledged_at` custom | null, required - `outcome` "succeeded" | "failed" | "canceled" | null, required - `has_more` boolean, required - `next_cursor` custom | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent_id": {}, "channel_message_id": {}, "source": { "type": "string", "const": "https://channels.socra.cloud" }, "observed_at": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "source_event_id": {}, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "created_at": {}, "delivered_at": { "anyOf": [ {}, { "type": "null" } ] }, "acknowledged_at": { "anyOf": [ {}, { "type": "null" } ] }, "outcome": { "anyOf": [ { "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, { "type": "null" } ] } }, "required": [ "id", "source_event_id", "status", "created_at", "delivered_at", "acknowledged_at", "outcome" ], "additionalProperties": false } }, "has_more": { "type": "boolean" }, "next_cursor": { "anyOf": [ {}, { "type": "null" } ] } }, "required": [ "agent_id", "channel_message_id", "source", "observed_at", "data", "has_more", "next_cursor" ], "additionalProperties": false } ``` ### Read why a Channels request failed `GET /v1/messages/{message_id}/failure-classification` #### Path parameters - `message_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Query parameters - `error_type_only` boolean | "true" | "false", optional - `recovery_diagnostic` boolean | "true" | "false", optional - `agent_id` string, required - `source_event_id` string (pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "error_type_only": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": [ "true", "false" ] } ] }, "recovery_diagnostic": { "anyOf": [ { "type": "boolean" }, { "type": "string", "enum": [ "true", "false" ] } ] }, "agent_id": { "type": "string" }, "source_event_id": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" } }, "required": [ "agent_id", "source_event_id" ], "additionalProperties": false } ``` #### Response object JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "message_id": {}, "source_event_id": {}, "acknowledged_at": {}, "observed_at": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, "evidence_source": { "type": "string", "const": "retained_ack_error" }, "error_present": { "type": "boolean" }, "classification": { "type": "string", "enum": [ "recognized", "unknown" ] }, "operation": { "type": "string", "enum": [ "channels_notification_read", "channels_message_read", "channels_channel_read", "connection_runtime_credential", "channels_source_validation", "unknown" ] }, "failure_code": { "type": "string", "enum": [ "http_error", "source_mismatch", "unknown" ] }, "http_status": { "anyOf": [ { "type": "integer", "minimum": 400, "maximum": 599 }, { "type": "null" } ] } }, "required": [ "message_id", "source_event_id", "acknowledged_at", "observed_at", "evidence_source", "error_present", "classification", "operation", "failure_code", "http_status" ], "additionalProperties": false }, { "type": "object", "properties": { "error_type": { "type": "string", "enum": [ "sign-in", "quota", "crash", "configuration", "unknown" ] } }, "required": [ "error_type" ], "additionalProperties": false }, { "type": "object", "properties": { "failure_message": { "anyOf": [ { "type": "string", "maxLength": 16000 }, { "type": "null" } ] }, "computer_usage": { "anyOf": [ { "type": "object", "properties": { "observed_at": { "type": "string", "format": "date-time", "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$" }, "root": { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "used_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "used_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, "home": { "type": "object", "properties": { "total_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "used_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "available_bytes": { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, "total_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "free_inodes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] } }, "required": [ "total_bytes", "used_bytes", "available_bytes", "total_inodes", "free_inodes" ], "additionalProperties": false }, "home_directory_bytes": { "anyOf": [ { "type": "string", "pattern": "^(0|[1-9][0-9]{0,24})$" }, { "type": "null" } ] }, "home_directory_complete": { "type": "boolean" } }, "required": [ "observed_at", "root", "home", "home_directory_bytes", "home_directory_complete" ], "additionalProperties": false }, { "type": "null" } ] }, "computer_usage_status": { "type": "string", "enum": [ "measured", "unavailable" ] } }, "required": [ "failure_message", "computer_usage", "computer_usage_status" ], "additionalProperties": false } ] } ``` ### Sleep the current CoAgent when its mailbox is empty `POST /v1/messages/sleep` #### Response - `sleeping` boolean, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "sleeping": { "type": "boolean" } }, "required": [ "sleeping" ], "additionalProperties": false } ``` ### List CoAgent messages `GET /v1/messages` #### Query parameters - `agent_id` custom, required - `status` "queued" | "delivered" | "acknowledged", optional - `limit` integer (min: 1; max: 100), optional - `after` string, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent_id": {}, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "limit": { "type": "integer", "minimum": 1, "maximum": 100 }, "after": { "type": "string" } }, "required": [ "agent_id" ] } ``` #### Response - `data` object[], required - `id` custom, required - `agent_id` custom, required - `source_event_id` string, required - `source` string, required - `type` string, required - `subject` string, required - `payload` object, required - `status` "queued" | "delivered" | "acknowledged", required - `delivered_at` custom | null, required - `acknowledged_at` custom | null, required - `outcome` "succeeded" | "failed" | "canceled" | null, required - `result` string | null, required - `error` string | null, required - `created_at` custom, required - `has_more` boolean, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "agent_id": {}, "source_event_id": { "type": "string" }, "source": { "type": "string" }, "type": { "type": "string" }, "subject": { "type": "string" }, "payload": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "delivered_at": { "anyOf": [ {}, { "type": "null" } ] }, "acknowledged_at": { "anyOf": [ {}, { "type": "null" } ] }, "outcome": { "anyOf": [ { "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, { "type": "null" } ] }, "result": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": {} }, "required": [ "id", "agent_id", "source_event_id", "source", "type", "subject", "payload", "status", "delivered_at", "acknowledged_at", "outcome", "result", "error", "created_at" ], "additionalProperties": false } }, "has_more": { "type": "boolean" } }, "required": [ "data", "has_more" ], "additionalProperties": false } ``` ### Pull the next CoAgent message `POST /v1/messages/pull` #### Request body - `in_flight` custom[] (max items: 1000), optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "in_flight": { "maxItems": 1000, "type": "array", "items": {} } } } ``` #### Response object | null JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "anyOf": [ { "type": "object", "properties": { "id": {}, "agent_id": {}, "source_event_id": { "type": "string" }, "source": { "type": "string" }, "type": { "type": "string" }, "subject": { "type": "string" }, "payload": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "delivered_at": { "anyOf": [ {}, { "type": "null" } ] }, "acknowledged_at": { "anyOf": [ {}, { "type": "null" } ] }, "outcome": { "anyOf": [ { "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, { "type": "null" } ] }, "result": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": {} }, "required": [ "id", "agent_id", "source_event_id", "source", "type", "subject", "payload", "status", "delivered_at", "acknowledged_at", "outcome", "result", "error", "created_at" ], "additionalProperties": false }, { "type": "null" } ] } ``` ### Acknowledge a CoAgent message `POST /v1/messages/{message_id}/acknowledge` #### Path parameters - `message_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Request body - `outcome` "succeeded" | "failed" | "canceled" (default: "succeeded"), optional - `result` string | null, optional - `error` string | null, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "outcome": { "default": "succeeded", "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, "result": { "anyOf": [ { "type": "string", "maxLength": 64000 }, { "type": "null" } ] }, "error": { "anyOf": [ { "type": "string", "maxLength": 16000 }, { "type": "null" } ] } } } ``` #### Response - `id` custom, required - `agent_id` custom, required - `source_event_id` string, required - `source` string, required - `type` string, required - `subject` string, required - `payload` object, required - `status` "queued" | "delivered" | "acknowledged", required - `delivered_at` custom | null, required - `acknowledged_at` custom | null, required - `outcome` "succeeded" | "failed" | "canceled" | null, required - `result` string | null, required - `error` string | null, required - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "source_event_id": { "type": "string" }, "source": { "type": "string" }, "type": { "type": "string" }, "subject": { "type": "string" }, "payload": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "delivered_at": { "anyOf": [ {}, { "type": "null" } ] }, "acknowledged_at": { "anyOf": [ {}, { "type": "null" } ] }, "outcome": { "anyOf": [ { "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, { "type": "null" } ] }, "result": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": {} }, "required": [ "id", "agent_id", "source_event_id", "source", "type", "subject", "payload", "status", "delivered_at", "acknowledged_at", "outcome", "result", "error", "created_at" ], "additionalProperties": false } ``` ### Cancel a CoAgent message `POST /v1/messages/{message_id}/cancel` #### Path parameters - `message_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `agent_id` custom, required - `source_event_id` string, required - `source` string, required - `type` string, required - `subject` string, required - `payload` object, required - `status` "queued" | "delivered" | "acknowledged", required - `delivered_at` custom | null, required - `acknowledged_at` custom | null, required - `outcome` "succeeded" | "failed" | "canceled" | null, required - `result` string | null, required - `error` string | null, required - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "source_event_id": { "type": "string" }, "source": { "type": "string" }, "type": { "type": "string" }, "subject": { "type": "string" }, "payload": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "delivered_at": { "anyOf": [ {}, { "type": "null" } ] }, "acknowledged_at": { "anyOf": [ {}, { "type": "null" } ] }, "outcome": { "anyOf": [ { "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, { "type": "null" } ] }, "result": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": {} }, "required": [ "id", "agent_id", "source_event_id", "source", "type", "subject", "payload", "status", "delivered_at", "acknowledged_at", "outcome", "result", "error", "created_at" ], "additionalProperties": false } ``` ### Retry a CoAgent message `POST /v1/messages/{message_id}/retry` #### Path parameters - `message_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `id` custom, required - `agent_id` custom, required - `source_event_id` string, required - `source` string, required - `type` string, required - `subject` string, required - `payload` object, required - `status` "queued" | "delivered" | "acknowledged", required - `delivered_at` custom | null, required - `acknowledged_at` custom | null, required - `outcome` "succeeded" | "failed" | "canceled" | null, required - `result` string | null, required - `error` string | null, required - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "agent_id": {}, "source_event_id": { "type": "string" }, "source": { "type": "string" }, "type": { "type": "string" }, "subject": { "type": "string" }, "payload": { "type": "object", "propertyNames": { "type": "string" }, "additionalProperties": {} }, "status": { "type": "string", "enum": [ "queued", "delivered", "acknowledged" ] }, "delivered_at": { "anyOf": [ {}, { "type": "null" } ] }, "acknowledged_at": { "anyOf": [ {}, { "type": "null" } ] }, "outcome": { "anyOf": [ { "type": "string", "enum": [ "succeeded", "failed", "canceled" ] }, { "type": "null" } ] }, "result": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "error": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": {} }, "required": [ "id", "agent_id", "source_event_id", "source", "type", "subject", "payload", "status", "delivered_at", "acknowledged_at", "outcome", "result", "error", "created_at" ], "additionalProperties": false } ``` ## GitHub connections The GitHub App installation trusted by the current Account. ### Resource schema - `id` custom, required - `account` custom, required - `github_account_id` string, required - `github_account_login` string, required - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "account": {}, "github_account_id": { "type": "string" }, "github_account_login": { "type": "string" }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "account", "github_account_id", "github_account_login", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Get GitHub connection `GET /v1/github/connection` #### Response - `id` custom, required - `account` custom, required - `github_account_id` string, required - `github_account_login` string, required - `created_by` custom, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "account": {}, "github_account_id": { "type": "string" }, "github_account_login": { "type": "string" }, "created_by": {}, "created_at": {}, "updated_at": {} }, "required": [ "id", "account", "github_account_id", "github_account_login", "created_by", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Read approved GitHub installation capabilities `GET /v1/github/connection/capabilities` #### Response - `checked_at` string, required - `suspended` boolean, required - `permissions` object, required - `contents` "none" | "read" | "write", required - `pull_requests` "none" | "read" | "write", required - `actions` "none" | "read" | "write", required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "checked_at": { "type": "string" }, "suspended": { "type": "boolean" }, "permissions": { "type": "object", "properties": { "contents": { "type": "string", "enum": [ "none", "read", "write" ] }, "pull_requests": { "type": "string", "enum": [ "none", "read", "write" ] }, "actions": { "type": "string", "enum": [ "none", "read", "write" ] } }, "required": [ "contents", "pull_requests", "actions" ], "additionalProperties": false } }, "required": [ "checked_at", "suspended", "permissions" ], "additionalProperties": false } ``` ### Start GitHub connection `POST /v1/github/connection/start` #### Response - `installation_url` string (format: uri), required - `expires_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "installation_url": { "type": "string", "format": "uri" }, "expires_at": {} }, "required": [ "installation_url", "expires_at" ], "additionalProperties": false } ``` ### Disconnect GitHub `DELETE /v1/github/connection` #### Response No response body. ## Repositories A GitHub repository made available to CoAgents in an Account. ### Resource schema - `id` custom, required - `account` custom, required - `provider` "github", required - `external_id` string, required - `full_name` string (pattern: ^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$), required - `clone_url` string (format: uri), required - `default_branch` string, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "account": {}, "provider": { "type": "string", "const": "github" }, "external_id": { "type": "string" }, "full_name": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$" }, "clone_url": { "type": "string", "format": "uri" }, "default_branch": { "type": "string" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "account", "provider", "external_id", "full_name", "clone_url", "default_branch", "created_at", "updated_at" ], "additionalProperties": false } ``` ### Add repository `POST /v1/repositories` #### Request body - `full_name` string (pattern: ^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$), required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "full_name": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$" } }, "required": [ "full_name" ] } ``` #### Response - `id` custom, required - `account` custom, required - `provider` "github", required - `external_id` string, required - `full_name` string (pattern: ^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$), required - `clone_url` string (format: uri), required - `default_branch` string, required - `created_at` custom, required - `updated_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "account": {}, "provider": { "type": "string", "const": "github" }, "external_id": { "type": "string" }, "full_name": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$" }, "clone_url": { "type": "string", "format": "uri" }, "default_branch": { "type": "string" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "account", "provider", "external_id", "full_name", "clone_url", "default_branch", "created_at", "updated_at" ], "additionalProperties": false } ``` ### List repositories `GET /v1/repositories` #### Query parameters - `limit` integer (min: 1; max: 100), optional - `after` custom, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "limit": { "type": "integer", "minimum": 1, "maximum": 100 }, "after": {} } } ``` #### Response - `data` object[], required - `id` custom, required - `account` custom, required - `provider` "github", required - `external_id` string, required - `full_name` string (pattern: ^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$), required - `clone_url` string (format: uri), required - `default_branch` string, required - `created_at` custom, required - `updated_at` custom, required - `has_more` boolean, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "account": {}, "provider": { "type": "string", "const": "github" }, "external_id": { "type": "string" }, "full_name": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$" }, "clone_url": { "type": "string", "format": "uri" }, "default_branch": { "type": "string" }, "created_at": {}, "updated_at": {} }, "required": [ "id", "account", "provider", "external_id", "full_name", "clone_url", "default_branch", "created_at", "updated_at" ], "additionalProperties": false } }, "has_more": { "type": "boolean" } }, "required": [ "data", "has_more" ], "additionalProperties": false } ``` ### Remove repository `DELETE /v1/repositories/{repository_id}` #### Path parameters - `repository_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response No response body. ## Repository grants Permission for a CoAgent to use a repository. ### Resource schema - `id` custom, required - `account` custom, required - `agent` custom, required - `repository` custom, required - `permission` "read" | "write", required - `actions_permission` "read" | "write" (default: "read"), required - `pull_requests_permission` "read" | "write", optional - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "account": {}, "agent": {}, "repository": {}, "permission": { "type": "string", "enum": [ "read", "write" ] }, "actions_permission": { "default": "read", "type": "string", "enum": [ "read", "write" ] }, "pull_requests_permission": { "type": "string", "enum": [ "read", "write" ] }, "created_at": {} }, "required": [ "id", "account", "agent", "repository", "permission", "actions_permission", "created_at" ], "additionalProperties": false } ``` ### Grant repository access `POST /v1/repository-grants` #### Request body - `agent` custom, required - `repository` custom, required - `permission` "read" | "write" (default: "write"), optional - `actions_permission` "read" | "write", optional - `pull_requests_permission` "read" | "write", optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {}, "repository": {}, "permission": { "default": "write", "type": "string", "enum": [ "read", "write" ] }, "actions_permission": { "type": "string", "enum": [ "read", "write" ] }, "pull_requests_permission": { "type": "string", "enum": [ "read", "write" ] } }, "required": [ "agent", "repository" ] } ``` #### Response - `id` custom, required - `account` custom, required - `agent` custom, required - `repository` custom, required - `permission` "read" | "write", required - `actions_permission` "read" | "write" (default: "read"), required - `pull_requests_permission` "read" | "write", optional - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "id": {}, "account": {}, "agent": {}, "repository": {}, "permission": { "type": "string", "enum": [ "read", "write" ] }, "actions_permission": { "default": "read", "type": "string", "enum": [ "read", "write" ] }, "pull_requests_permission": { "type": "string", "enum": [ "read", "write" ] }, "created_at": {} }, "required": [ "id", "account", "agent", "repository", "permission", "actions_permission", "created_at" ], "additionalProperties": false } ``` ### List repository grants `GET /v1/repository-grants` #### Query parameters - `agent` custom, optional - `limit` integer (min: 1; max: 100), optional - `after` custom, optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {}, "limit": { "type": "integer", "minimum": 1, "maximum": 100 }, "after": {} } } ``` #### Response - `data` object[], required - `id` custom, required - `account` custom, required - `agent` custom, required - `repository` custom, required - `permission` "read" | "write", required - `actions_permission` "read" | "write" (default: "read"), required - `pull_requests_permission` "read" | "write", optional - `created_at` custom, required - `has_more` boolean, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": {}, "account": {}, "agent": {}, "repository": {}, "permission": { "type": "string", "enum": [ "read", "write" ] }, "actions_permission": { "default": "read", "type": "string", "enum": [ "read", "write" ] }, "pull_requests_permission": { "type": "string", "enum": [ "read", "write" ] }, "created_at": {} }, "required": [ "id", "account", "agent", "repository", "permission", "actions_permission", "created_at" ], "additionalProperties": false } }, "has_more": { "type": "boolean" } }, "required": [ "data", "has_more" ], "additionalProperties": false } ``` ### Revoke repository access `DELETE /v1/repository-grants/{grant_id}` #### Path parameters - `grant_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response No response body. ## Repository metadata discovery Delegated metadata-only installed repository candidates, separate from source access. ### Resource schema - `provider` "github", required - `checked_at` string, required - `data` object[], required - `provider` "github", required - `provider_id` string (pattern: ^\d+$), required - `full_name` string, required - `canonical_url` string (format: uri), required - `default_branch` string, required - `archived` boolean, required - `total_count` integer (min: 0; max: 9007199254740991), required - `next_page` integer | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "provider": { "type": "string", "const": "github" }, "checked_at": { "type": "string" }, "data": { "type": "array", "items": { "type": "object", "properties": { "provider": { "type": "string", "const": "github" }, "provider_id": { "type": "string", "pattern": "^\\d+$" }, "full_name": { "type": "string" }, "canonical_url": { "type": "string", "format": "uri" }, "default_branch": { "type": "string" }, "archived": { "type": "boolean" } }, "required": [ "provider", "provider_id", "full_name", "canonical_url", "default_branch", "archived" ], "additionalProperties": false } }, "total_count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "next_page": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "provider", "checked_at", "data", "total_count", "next_page" ], "additionalProperties": false } ``` ### Discover installed GitHub repository metadata `GET /v1/repository-discovery` #### Query parameters - `page` integer (default: 1; min: 1; max: 1000000), optional JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "page": { "default": 1, "type": "integer", "minimum": 1, "maximum": 1000000 } } } ``` #### Response - `provider` "github", required - `checked_at` string, required - `data` object[], required - `provider` "github", required - `provider_id` string (pattern: ^\d+$), required - `full_name` string, required - `canonical_url` string (format: uri), required - `default_branch` string, required - `archived` boolean, required - `total_count` integer (min: 0; max: 9007199254740991), required - `next_page` integer | null, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "provider": { "type": "string", "const": "github" }, "checked_at": { "type": "string" }, "data": { "type": "array", "items": { "type": "object", "properties": { "provider": { "type": "string", "const": "github" }, "provider_id": { "type": "string", "pattern": "^\\d+$" }, "full_name": { "type": "string" }, "canonical_url": { "type": "string", "format": "uri" }, "default_branch": { "type": "string" }, "archived": { "type": "boolean" } }, "required": [ "provider", "provider_id", "full_name", "canonical_url", "default_branch", "archived" ], "additionalProperties": false } }, "total_count": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "next_page": { "anyOf": [ { "type": "integer", "exclusiveMinimum": 0, "maximum": 9007199254740991 }, { "type": "null" } ] } }, "required": [ "provider", "checked_at", "data", "total_count", "next_page" ], "additionalProperties": false } ``` ## Repository metadata delegations Account administrator delegation to discover GitHub metadata without source grants. ### Resource schema - `agent` custom, required - `provider` "github", required - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {}, "provider": { "type": "string", "const": "github" }, "created_at": {} }, "required": [ "agent", "provider", "created_at" ], "additionalProperties": false } ``` ### Delegate GitHub metadata discovery `POST /v1/repository-discovery-delegations` #### Request body - `agent` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {} }, "required": [ "agent" ] } ``` #### Response - `agent` custom, required - `provider` "github", required - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {}, "provider": { "type": "string", "const": "github" }, "created_at": {} }, "required": [ "agent", "provider", "created_at" ], "additionalProperties": false } ``` ### Read metadata discovery delegation `GET /v1/repository-discovery-delegations/{agent_id}` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response - `agent` custom, required - `provider` "github", required - `created_at` custom, required JSON Schema: ```json { "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "agent": {}, "provider": { "type": "string", "const": "github" }, "created_at": {} }, "required": [ "agent", "provider", "created_at" ], "additionalProperties": false } ``` ### Revoke metadata discovery delegation `DELETE /v1/repository-discovery-delegations/{agent_id}` #### Path parameters - `agent_id` custom, required ```json { "$schema": "https://json-schema.org/draft/2020-12/schema" } ``` #### Response No response body.