{"openapi":"3.1.0","info":{"title":"GET /api/v1/agents/roles","version":"1.0.0","description":"List agent roles"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/agents/roles":{"get":{"tags":["agents"],"summary":"List agent roles","description":"The business's team of agents with open runs and cost this month.","operationId":"agents_list_roles","parameters":[{"name":"include_disabled","in":"query","required":false,"schema":{"type":"boolean","description":"Include disabled roles","default":false,"title":"Include Disabled"},"description":"Include disabled roles"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRoleListResponse_"}}}},"401":{"description":"Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business","content":{"application/json":{"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"validation_error","message":"Validation failed: amount: Input should be a valid integer","errors":{"amount":"Input should be a valid integer"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_list_roles_api_v1_agents_roles_get"}}},"components":{"schemas":{"AgentPersona":{"properties":{"color":{"type":"string","enum":["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"],"title":"Color"},"body":{"type":"string","enum":["cursor","blob","circle","squircle","capsule","drop","shield","hexagon","diamond","star","jujube"],"title":"Body"},"vibe":{"type":"string","enum":["steady","upbeat","witty","blunt"],"title":"Vibe","default":"steady"},"greeting":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Greeting"}},"type":"object","required":["color","body"],"title":"AgentPersona","description":"How a role looks and sounds: always fully resolved on read."},"AgentRoleListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentRoleOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"AgentRoleListResponse"},"AgentRoleOut":{"properties":{"name":{"type":"string","maxLength":80,"minLength":1,"title":"Name","description":"Short role name, e.g. Bookkeeper."},"title":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Title"},"instructions":{"type":"string","title":"Instructions","description":"Standing instructions (markdown).","default":""},"skills":{"items":{"$ref":"#/components/schemas/AgentSkill"},"type":"array","title":"Skills"},"engine":{"type":"string","enum":["native","claude_code","codex"],"title":"Engine","description":"native runs DayZero's own loop on Gemini (every role); claude_code and codex run the firm's CLIs on its subscriptions (DayZero staff only).","default":"native"},"model":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Model","description":"Model id for the engine; null = the engine's default (google/gemini-4-argon)."},"scope":{"type":"string","enum":["read","changes"],"title":"Scope","description":"read never proposes; changes files gated writes as proposed changes.","default":"read"},"allowed_tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Tools","description":"Tool access: tool names, group:<mount> (a whole tool group) and server:<handle> (a connected MCP server); null = every tool its scope allows. AGENT_026 for a token it cannot hold."},"params":{"additionalProperties":true,"type":"object","title":"Params"},"spend_cap_usd_month":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Spend Cap Usd Month","description":"Monthly spend cap in USD; new runs refuse above it and a run in flight stops before its next turn once it is reached."},"max_cost_usd_run":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Max Cost Usd Run","description":"Default cost limit of one run in USD; null = no per-run limit."},"browser":{"type":"boolean","title":"Browser","description":"Drives a real browser with saved logins (Claude Code or Codex only).","default":false},"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"library_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Library Key"},"enabled":{"type":"boolean","title":"Enabled"},"paused":{"type":"boolean","title":"Paused"},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"open_runs":{"type":"integer","title":"Open Runs","default":0},"cost_usd_month":{"type":"string","title":"Cost Usd Month","default":"0"},"last_run_status":{"anyOf":[{"type":"string","enum":["queued","running","needs_input","completed","failed","cancelled"]},{"type":"null"}],"title":"Last Run Status"},"account_label":{"type":"string","title":"Account Label","default":""},"engine_allowed":{"type":"boolean","title":"Engine Allowed","default":true},"persona":{"$ref":"#/components/schemas/AgentPersona","description":"Face and vibe, always resolved (gaps filled from the role id)."},"next_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Run At"},"next_job_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Job Title"},"next_job_href":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Job Href","description":"Automations deep link for the schedule."},"next_schedule_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Schedule Id"}},"type":"object","required":["name","id","business_id","enabled","paused","created_at","updated_at","persona"],"title":"AgentRoleOut"},"AgentSkill":{"properties":{"name":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[a-z0-9][a-z0-9-]*$","title":"Name"},"description":{"type":"string","maxLength":1024,"title":"Description","default":""},"body":{"type":"string","title":"Body","description":"Markdown the role reads when the skill applies.","default":""},"enabled":{"type":"boolean","title":"Enabled","default":true},"learned":{"type":"boolean","title":"Learned","default":false}},"type":"object","required":["name"],"title":"AgentSkill","description":"A SKILL.md-shaped skill a role carries."},"SuccessEnvelope_AgentRoleListResponse_":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"data":{"anyOf":[{"$ref":"#/components/schemas/AgentRoleListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentRoleListResponse]"},"ErrorResponse":{"title":"ErrorResponse","type":"object","description":"Envelope returned by every non-2xx response. Branch on `code` (stable) rather than `message` (human-readable, may change).","required":["error","message","code"],"properties":{"error":{"type":"string","description":"Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`."},"message":{"type":"string","description":"Human-readable explanation, safe to show to end users."},"code":{"type":"string","description":"Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`)."},"request_id":{"type":"string","description":"Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied."},"errors":{"type":"object","additionalProperties":{"type":"string"},"description":"Field-level validation messages keyed by field name. Present on 400/422 validation failures only."}}}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}