{"openapi":"3.1.0","info":{"title":"Twin API","description":"REST API for managing Twin agents, runs, schedules, instructions, and webhooks.\n\n## Authentication\n\nAll endpoints require an `x-api-key` header. Create your first API key in the Twin UI (Settings → API Keys). Bearer/JWT tokens are not accepted.","license":{"name":""},"version":"1.0.0"},"servers":[{"url":"https://builder.twin.so","description":"Production"}],"paths":{"/api/public/v1/access-api-keys":{"get":{"tags":["api-keys"],"operationId":"list_access_api_keys","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListApiKeysResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"post":{"tags":["api-keys"],"description":"Create an additional API key. Requires an existing API key for authentication. The first API key must be created via the Twin UI (Settings > API Keys).","operationId":"create_access_api_key","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccessApiKeyBody"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/api/public/v1/access-api-keys/{key_id}":{"delete":{"tags":["api-keys"],"operationId":"revoke_access_api_key","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeApiKeyResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents":{"get":{"tags":["agents"],"operationId":"list_agents","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"cursor","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32","minimum":0}},{"name":"policy_type","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListAgentsResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"post":{"tags":["agents"],"operationId":"create_agent","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentBody"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}":{"get":{"tags":["agents"],"operationId":"get_agent","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAgentResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"delete":{"tags":["agents"],"operationId":"delete_agent","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Agent deleted"},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/instructions":{"get":{"tags":["instructions"],"operationId":"get_instructions","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInstructionsResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"put":{"tags":["instructions"],"operationId":"update_instructions","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInstructionsBody"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelRunResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/instructions/history":{"get":{"tags":["instructions"],"operationId":"get_instructions_history","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetInstructionsHistoryResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/move":{"post":{"tags":["workspaces"],"operationId":"move_agent_to_workspace","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveAgentBody"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveAgentToWorkspaceResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/runs":{"get":{"tags":["runs"],"operationId":"list_runs","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","format":"int32","minimum":0}},{"name":"filter_user_email","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"filter_goal","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"filter_status","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"filter_run_id","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"filter_started_after","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"filter_started_before","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"filter_policy_type","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"filter_policy_group","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRunsResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"post":{"tags":["runs"],"operationId":"start_run","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartRunBody"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartRunResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/runs/{run_id}":{"delete":{"tags":["runs"],"operationId":"delete_run","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Run deleted"},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/runs/{run_id}/cancel":{"post":{"tags":["runs"],"operationId":"cancel_run","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelRunBody"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelRunResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/runs/{run_id}/events":{"get":{"tags":["events"],"operationId":"list_run_events","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32","minimum":0}},{"name":"after_index","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int64","minimum":0}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRunEventsResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/schedule":{"get":{"tags":["schedules"],"operationId":"get_agent_schedule","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetScheduleResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"put":{"tags":["schedules"],"operationId":"set_agent_schedule","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleBody"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetScheduleResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"delete":{"tags":["schedules"],"operationId":"delete_agent_schedule","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteScheduleResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/schedule/pause":{"post":{"tags":["schedules"],"operationId":"pause_agent_schedule","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PauseScheduleResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/schedule/resume":{"post":{"tags":["schedules"],"operationId":"resume_agent_schedule","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResumeScheduleResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/webhooks":{"get":{"tags":["webhooks"],"operationId":"list_webhooks","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListWebhooksResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"post":{"tags":["webhooks"],"operationId":"create_webhook","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookBody"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWebhookResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/agents/{agent_id}/webhooks/{webhook_id}":{"get":{"tags":["webhooks"],"operationId":"get_webhook","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"delete":{"tags":["webhooks"],"operationId":"delete_webhook","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Webhook deleted"},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"patch":{"tags":["webhooks"],"operationId":"update_webhook","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"webhook_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWebhookBody"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/me":{"get":{"tags":["me"],"operationId":"me","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/schedules":{"get":{"tags":["schedules"],"operationId":"list_schedules","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListSchedulesResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/workspaces":{"get":{"tags":["workspaces"],"operationId":"list_workspaces","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListWorkspacesResponse"}}}},"401":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"post":{"tags":["workspaces"],"operationId":"create_workspace","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkspaceBody"}}},"required":true},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkspaceResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/workspaces/reorder":{"post":{"tags":["workspaces"],"operationId":"reorder_workspaces","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderWorkspacesBody"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderWorkspacesResponse"}}}},"400":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}},"/v1/workspaces/{workspace_id}":{"put":{"tags":["workspaces"],"operationId":"update_workspace","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkspaceBody"}}},"required":true},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkspaceResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]},"delete":{"tags":["workspaces"],"operationId":"delete_workspace","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteWorkspaceResponse"}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}}},"security":[{"api_key":[]}]}}},"components":{"schemas":{"Agent":{"type":"object","required":["agent_id","unread"],"properties":{"active_build_run_id":{"type":["string","null"]},"agent_id":{"type":"string"},"agent_name":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AgentName"}]},"has_instruction_build":{"type":["boolean","null"]},"has_runs":{"type":["boolean","null"]},"icon_config":{"type":["string","null"]},"last_activity_at":{"type":["string","null"]},"last_chat_message":{"type":["string","null"]},"latest_build_run_id":{"type":["string","null"]},"latest_instruction_build_run_id":{"type":["string","null"]},"latest_run_has_pending_input":{"type":["boolean","null"]},"latest_run_id":{"type":["string","null"]},"latest_run_is_finished":{"type":["boolean","null"]},"latest_run_status":{"type":["string","null"]},"unread":{"type":"boolean"},"workspace_id":{"type":["string","null"]}}},"AgentName":{"type":"object","required":["name"],"properties":{"explanation":{"type":["string","null"]},"name":{"type":"string"}}},"ApiKeyInfo":{"type":"object","required":["key_id","name","display_prefix","created_at"],"properties":{"created_at":{"type":"integer","format":"int64"},"display_prefix":{"type":"string"},"key_id":{"type":"string"},"last_used_at":{"type":["integer","null"],"format":"int64"},"name":{"type":"string"}}},"CancelRunBody":{"type":"object","properties":{"reason":{"type":["string","null"]}}},"CancelRunResponse":{"type":"object","required":["success"],"properties":{"error":{"type":["string","null"]},"success":{"type":"boolean"}}},"CreateAccessApiKeyBody":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}},"CreateAgentBody":{"type":"object","properties":{"agent_id":{"type":["string","null"],"format":"uuid"},"derived_from_agent_id":{"type":["string","null"],"format":"uuid"},"is_subagent":{"type":"boolean"},"owner_user_id":{"type":["string","null"]},"workspace_id":{"type":["string","null"]}}},"CreateAgentResponse":{"type":"object","properties":{"agent":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Agent"}]}}},"CreateApiKeyResponse":{"type":"object","required":["key_id","name","api_key","display_prefix","created_at"],"properties":{"api_key":{"type":"string"},"created_at":{"type":"integer","format":"int64"},"display_prefix":{"type":"string"},"key_id":{"type":"string"},"name":{"type":"string"}}},"CreateWebhookBody":{"type":"object","required":["url","events"],"properties":{"events":{"type":"array","items":{"type":"string"}},"url":{"type":"string"}}},"CreateWebhookResponse":{"type":"object","required":["webhook_id","url","events","signing_secret","status","created_at"],"properties":{"created_at":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"signing_secret":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"},"webhook_id":{"type":"string","format":"uuid"}}},"CreateWorkspaceBody":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}},"CreateWorkspaceResponse":{"type":"object","properties":{"workspace":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Workspace"}]}}},"DeleteScheduleResponse":{"type":"object","required":["success"],"properties":{"error":{"type":["string","null"]},"success":{"type":"boolean"}}},"DeleteWorkspaceResponse":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"boolean"},"error":{"type":["string","null"]}}},"GetAgentResponse":{"type":"object","properties":{"agent":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Agent"}]}}},"GetInstructionsHistoryResponse":{"type":"object","required":["instruction_versions"],"properties":{"instruction_versions":{"type":"array","items":{"$ref":"#/components/schemas/InstructionVersion"}}}},"GetInstructionsResponse":{"type":"object","properties":{"instructions":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/InstructionsSummary"}]}}},"GetScheduleResponse":{"type":"object","properties":{"schedule":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Schedule"}]}}},"InstructionVersion":{"type":"object","required":["id","content","source_type","source_id","created_at","storage_key","content_hash"],"properties":{"content":{"type":"string"},"content_hash":{"type":"string"},"created_at":{"type":"string"},"id":{"type":"integer","format":"int64","minimum":0},"source_id":{"type":"string"},"source_type":{"type":"string"},"storage_key":{"type":"string"}}},"InstructionsSummary":{"type":"object","required":["agent_id","user_id","user_email","content","source_id","updated_at","storage_key","content_hash"],"properties":{"agent_id":{"type":"string"},"content":{"type":"string"},"content_hash":{"type":"string"},"plan_steps":{"type":"array","items":{"$ref":"#/components/schemas/RestPlanStep"}},"source_id":{"type":"string"},"storage_key":{"type":"string"},"updated_at":{"type":"string"},"user_email":{"type":"string"},"user_id":{"type":"string"}}},"ListAgentsResponse":{"type":"object","required":["agents"],"properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"next_cursor":{"type":["string","null"]}}},"ListApiKeysResponse":{"type":"object","required":["keys"],"properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyInfo"}}}},"ListRunEventsResponse":{"type":"object","required":["events","total_count"],"properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/RunEventItem"}},"total_count":{"type":"integer","format":"int64"}}},"ListRunsResponse":{"type":"object","required":["runs","total_runs","page","page_size","all_run_summaries"],"properties":{"all_run_summaries":{"type":"array","items":{"$ref":"#/components/schemas/RunSummary"}},"page":{"type":"integer","format":"int32","minimum":0},"page_size":{"type":"integer","format":"int32","minimum":0},"runs":{"type":"array","items":{"$ref":"#/components/schemas/Run"}},"total_runs":{"type":"integer","format":"int64","minimum":0}}},"ListSchedulesResponse":{"type":"object","required":["schedules"],"properties":{"schedules":{"type":"array","items":{"$ref":"#/components/schemas/Schedule"}}}},"ListWebhooksResponse":{"type":"object","required":["webhooks"],"properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/WebhookResponse"}}}},"ListWorkspacesResponse":{"type":"object","required":["workspaces"],"properties":{"workspaces":{"type":"array","items":{"$ref":"#/components/schemas/Workspace"}}}},"MeResponse":{"type":"object","required":["user_id","needs_onboarding"],"properties":{"needs_onboarding":{"type":"boolean"},"user_id":{"type":"string"}}},"MoveAgentBody":{"type":"object","required":["workspace_id"],"properties":{"workspace_id":{"type":"string"}}},"MoveAgentToWorkspaceResponse":{"type":"object","required":["success"],"properties":{"error":{"type":["string","null"]},"success":{"type":"boolean"}}},"PauseScheduleResponse":{"type":"object","required":["success"],"properties":{"error":{"type":["string","null"]},"success":{"type":"boolean"}}},"ProblemDetail":{"type":"object","required":["type","title","status","detail"],"properties":{"detail":{"type":"string"},"status":{"type":"integer","format":"int32","minimum":0},"title":{"type":"string"},"type":{"type":"string"}}},"ReorderWorkspacesBody":{"type":"object","required":["workspace_ids"],"properties":{"workspace_ids":{"type":"array","items":{"type":"string"}}}},"ReorderWorkspacesResponse":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean"}}},"RestPlanStep":{"type":"object","required":["title","description","tools","order"],"properties":{"description":{"type":"string"},"icon":{"type":["string","null"]},"order":{"type":"integer","format":"int32","minimum":0},"title":{"type":"string"},"tools":{"type":"array","items":{"type":"string"}}}},"ResumeScheduleResponse":{"type":"object","required":["success"],"properties":{"error":{"type":["string","null"]},"success":{"type":"boolean"}}},"RevokeApiKeyResponse":{"type":"object","required":["revoked"],"properties":{"revoked":{"type":"boolean"}}},"Run":{"type":"object","required":["agent_id","run_id","started_at","last_event_at","event_count","step_count","is_finished","run_number","event_bytes"],"properties":{"agent_id":{"type":"string"},"event_bytes":{"type":"integer","format":"int64"},"event_count":{"type":"integer","format":"int64"},"goal":{"type":["string","null"]},"is_finished":{"type":"boolean"},"last_event_at":{"type":"string"},"policy_model":{"type":["string","null"]},"policy_type":{"type":["string","null"]},"run_id":{"type":"string"},"run_kind":{"type":["string","null"]},"run_number":{"type":"integer","format":"int32"},"schedule_agent_id":{"type":["string","null"]},"started_at":{"type":"string"},"status":{"type":["string","null"]},"step_count":{"type":"integer","format":"int64"},"user_email":{"type":["string","null"]},"user_id":{"type":["string","null"]},"webhook_subscription_id":{"type":["string","null"]},"wrote_instructions":{"type":["boolean","null"]}}},"RunEventItem":{"type":"object","required":["recorded_at","event_index","event"],"properties":{"event":{"type":"object"},"event_index":{"type":"integer","format":"int64","minimum":0},"recorded_at":{"type":"string"}}},"RunSummary":{"type":"object","required":["run_id","run_number","started_at","is_finished","is_paused","tool_icons","total_action_count"],"properties":{"attention_reason":{"type":["string","null"]},"credits_consumed":{"type":["integer","null"],"format":"int32"},"is_finished":{"type":"boolean"},"is_paused":{"type":"boolean"},"outcome":{"type":["string","null"]},"policy_model":{"type":["string","null"]},"policy_type":{"type":["string","null"]},"run_id":{"type":"string"},"run_kind":{"type":["string","null"]},"run_number":{"type":"integer","format":"int32"},"run_phase":{"type":["string","null"]},"schedule_agent_id":{"type":["string","null"]},"started_at":{"type":"string"},"summary":{"type":["string","null"]},"title":{"type":["string","null"]},"tool_icons":{"type":"array","items":{"$ref":"#/components/schemas/ToolIcon"}},"total_action_count":{"type":"integer","format":"int32"},"trigger_kind":{"type":["string","null"]},"webhook_subscription_id":{"type":["string","null"]},"wrote_instructions":{"type":["boolean","null"]}}},"Schedule":{"type":"object","required":["agent_id","cron","next_run","paused","consecutive_failures","auto_paused"],"properties":{"agent_id":{"type":"string"},"auto_paused":{"type":"boolean"},"consecutive_failures":{"type":"integer","format":"int32","minimum":0},"cron":{"type":"string"},"next_run":{"type":"integer","format":"int64"},"paused":{"type":"boolean"},"timezone":{"type":["string","null"]}}},"ScheduleBody":{"type":"object","required":["cron"],"properties":{"cron":{"type":"string"}}},"SetScheduleResponse":{"type":"object","required":["success"],"properties":{"error":{"type":["string","null"]},"success":{"type":"boolean"}}},"StartRunBody":{"type":"object","properties":{"run_mode":{"type":["string","null"]},"user_message":{"type":["string","null"]}}},"StartRunResponse":{"type":"object","required":["run"],"properties":{"run":{"$ref":"#/components/schemas/Run"}}},"ToolIcon":{"type":"object","required":["action_type"],"properties":{"action_type":{"type":"string"},"favicon_url":{"type":["string","null"]},"icon":{"type":["string","null"]}}},"UpdateInstructionsBody":{"type":"object","required":["content"],"properties":{"content":{"type":"string"},"source_id":{"type":["string","null"]},"source_type":{"type":["string","null"]}}},"UpdateWebhookBody":{"type":"object","properties":{"events":{"type":["array","null"],"items":{"type":"string"}},"status":{"type":["string","null"]},"url":{"type":["string","null"]}}},"UpdateWorkspaceBody":{"type":"object","required":["name"],"properties":{"icon_config":{"type":["string","null"]},"name":{"type":"string"}}},"UpdateWorkspaceResponse":{"type":"object","properties":{"workspace":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Workspace"}]}}},"WebhookResponse":{"type":"object","required":["webhook_id","agent_id","user_id","url","events","status","created_at","updated_at"],"properties":{"agent_id":{"type":"string","format":"uuid"},"created_at":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"updated_at":{"type":"string"},"url":{"type":"string"},"user_id":{"type":"string"},"webhook_id":{"type":"string","format":"uuid"}}},"Workspace":{"type":"object","required":["workspace_id","name","position","created_at","updated_at","agent_count"],"properties":{"agent_count":{"type":"integer","format":"int32"},"created_at":{"type":"string"},"icon_config":{"type":["string","null"]},"name":{"type":"string"},"position":{"type":"integer","format":"int32"},"updated_at":{"type":"string"},"workspace_id":{"type":"string"}}}},"securitySchemes":{"api_key":{"type":"apiKey","in":"header","name":"x-api-key"}}},"security":[{"api_key":[]}]}