{"openapi":"3.1.0","info":{"title":"GET /api/v1/agents/needs-you","version":"1.0.0","description":"What agents need from you"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/agents/needs-you":{"get":{"tags":["agents"],"summary":"What agents need from you","description":"Pending proposed changes, open cards, parked questions and recent failed runs for this business, or every business you can see with `all=true`.","operationId":"agents_needs_you","parameters":[{"name":"all","in":"query","required":false,"schema":{"type":"boolean","description":"Every business the caller can see","default":false,"title":"All"},"description":"Every business the caller can see"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"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_NeedsYouResponse_"}}}},"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_needs_you_api_v1_agents_needs_you_get"}}},"components":{"schemas":{"NeedsYouCard":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"run_id":{"type":"string","title":"Run Id"},"run_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Title"},"role_name":{"type":"string","title":"Role Name","default":""},"kind":{"type":"string","enum":["permission","question","sign_in","secret"],"title":"Kind"},"title":{"type":"string","title":"Title"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"status":{"type":"string","enum":["pending","answered","denied","expired","cancelled"],"title":"Status"},"answer":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Answer"},"answered_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Answered By User Id"},"answered_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Answered At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"can_answer":{"type":"boolean","title":"Can Answer","description":"Whether the caller may answer it: a question, sign-in or secret needs write permission; a permission card the requester or an admin.","default":true},"business_name":{"type":"string","title":"Business Name","default":""},"requester_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Requester User Id"},"channel_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Post Id"}},"type":"object","required":["id","business_id","run_id","kind","title","status","created_at"],"title":"NeedsYouCard","description":"A pending card plus who asked for the run, so a client can tell a\npermission card's requester from everyone else (``can_answer`` is true\nfor every reader here; the answer endpoint enforces the rule)."},"NeedsYouFailedRun":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"title":{"type":"string","title":"Title"},"brief":{"type":"string","title":"Brief"},"done_when":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Done When"},"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name","default":""},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"outcome_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome Detail"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"channel_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Post Id"}},"type":"object","required":["id","business_id","title","brief","role_id"],"title":"NeedsYouFailedRun","description":"A run that failed in the last seven days, with what a retry needs."},"NeedsYouPendingChange":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"summary":{"type":"string","title":"Summary"},"tool_name":{"type":"string","title":"Tool Name"},"tier":{"type":"integer","title":"Tier","default":2},"tier_reasons":{"items":{"type":"string"},"type":"array","title":"Tier Reasons"},"impact_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Impact Cents"},"destructive":{"type":"boolean","title":"Destructive","default":false},"agent_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Run Id"},"agent_role_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Role Id"},"agent_role_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Role Name"},"channel_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Post Id"},"proposed_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposed By Name"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["id","business_id","summary","tool_name","created_at"],"title":"NeedsYouPendingChange","description":"A proposed change waiting for a decision, with the job that filed it."},"NeedsYouQuestion":{"properties":{"run_id":{"type":"string","title":"Run Id"},"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"title":{"type":"string","title":"Title"},"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name","default":""},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"},"options":{"items":{"type":"string"},"type":"array","title":"Options"},"channel_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Post Id"},"asked_at":{"type":"string","format":"date-time","title":"Asked At"}},"type":"object","required":["run_id","business_id","title","role_id","asked_at"],"title":"NeedsYouQuestion","description":"A run parked on a question with no card; ``POST /runs/{id}/answer`` resumes it."},"NeedsYouResponse":{"properties":{"proposed_changes":{"type":"integer","title":"Proposed Changes","default":0},"cards":{"type":"integer","title":"Cards","default":0},"sign_ins":{"type":"integer","title":"Sign Ins","default":0},"questions":{"type":"integer","title":"Questions","default":0},"failed_runs":{"type":"integer","title":"Failed Runs","default":0},"total":{"type":"integer","title":"Total","default":0},"replenishment_proposals":{"type":"integer","title":"Replenishment Proposals","default":0},"items":{"items":{"$ref":"#/components/schemas/NeedsYouRow"},"type":"array","title":"Items"},"pending_changes":{"items":{"$ref":"#/components/schemas/NeedsYouPendingChange"},"type":"array","title":"Pending Changes"},"card_items":{"items":{"$ref":"#/components/schemas/NeedsYouCard"},"type":"array","title":"Card Items"},"sign_in_items":{"items":{"$ref":"#/components/schemas/NeedsYouCard"},"type":"array","title":"Sign In Items"},"question_items":{"items":{"$ref":"#/components/schemas/NeedsYouQuestion"},"type":"array","title":"Question Items"},"failed_run_items":{"items":{"$ref":"#/components/schemas/NeedsYouFailedRun"},"type":"array","title":"Failed Run Items"}},"type":"object","title":"NeedsYouResponse"},"NeedsYouRow":{"properties":{"kind":{"type":"string","enum":["proposed_change","card","question","failed_run","sign_in"],"title":"Kind"},"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"title":{"type":"string","title":"Title"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"role_name":{"type":"string","title":"Role Name","default":""},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"action_url":{"type":"string","title":"Action Url"}},"type":"object","required":["kind","id","business_id","title","created_at","action_url"],"title":"NeedsYouRow"},"SuccessEnvelope_NeedsYouResponse_":{"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/NeedsYouResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[NeedsYouResponse]"},"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":[]}]}