{"openapi":"3.1.0","info":{"title":"Agents — DayZero API","version":"1.0.0","description":"Agents endpoints."},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/agents/engines/dropbox":{"get":{"tags":["agents"],"summary":"Team Dropbox status (superuser)","description":"Whether the staff team Dropbox is set up and connected, the account and team, and the OAuth redirect URI to register in the Dropbox App Console. Superusers only.","operationId":"agents_dropbox_status","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxStatusOut_"}}}},"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_dropbox_status_api_v1_agents_engines_dropbox_get"},"delete":{"tags":["agents"],"summary":"Disconnect the team Dropbox (superuser)","description":"Revoke DayZero's token at Dropbox and forget it. Folder mappings and the app key stay. Superusers only.","operationId":"agents_dropbox_disconnect","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxStatusOut_"}}}},"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_dropbox_disconnect_api_v1_agents_engines_dropbox_delete"}},"/api/v1/agents/engines/dropbox/app":{"put":{"tags":["agents"],"summary":"Set the Dropbox app key and secret (superuser)","description":"Store the Dropbox app's key and secret (encrypted). A different app key forgets the current sign-in. Superusers only.","operationId":"agents_dropbox_set_app","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamDropboxAppCredentialsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxStatusOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_dropbox_set_app_api_v1_agents_engines_dropbox_app_put"}},"/api/v1/agents/engines/dropbox/connect":{"post":{"tags":["agents"],"summary":"Start connecting the team Dropbox (superuser)","description":"Returns the Dropbox consent URL to open in this browser and sets the browser-binding cookie the callback checks. `400 DROPBOX_001` until an app key and secret are set. Superusers only.","operationId":"agents_dropbox_connect","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxConnectOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_dropbox_connect_api_v1_agents_engines_dropbox_connect_post"}},"/api/v1/agents/engines/dropbox/browse":{"get":{"tags":["agents"],"summary":"Browse the team Dropbox (superuser)","description":"One folder's children, folders first; `path` empty is the root of the team space. `400 DROPBOX_002` when Dropbox is not connected. Superusers only.","operationId":"agents_dropbox_browse","parameters":[{"name":"path","in":"query","required":false,"schema":{"type":"string","maxLength":1024,"description":"Folder path; empty = root","default":"","title":"Path"},"description":"Folder path; empty = root"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxBrowseOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_dropbox_browse_api_v1_agents_engines_dropbox_browse_get"}},"/api/v1/agents/engines/dropbox/folders":{"get":{"tags":["agents"],"summary":"Team Dropbox folder mappings (superuser)","description":"Every Dropbox folder staff runs may use: shared folders first, then each business's. Superusers only.","operationId":"agents_dropbox_folders","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxFolderListOut_"}}}},"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_dropbox_folders_api_v1_agents_engines_dropbox_folders_get"},"post":{"tags":["agents"],"summary":"Map a Dropbox folder (superuser)","description":"Map a Dropbox folder to a business, or share it with every staff run (no `business_id`). The folder must exist. `409` when it is already mapped there. Superusers only.","operationId":"agents_dropbox_add_folder","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamDropboxFolderCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxFolderOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_dropbox_add_folder_api_v1_agents_engines_dropbox_folders_post"}},"/api/v1/agents/engines/dropbox/folders/{folder_id}":{"delete":{"tags":["agents"],"summary":"Remove a Dropbox folder mapping (superuser)","description":"Stop staff runs using this folder. Nothing in Dropbox changes.","operationId":"agents_dropbox_remove_folder","parameters":[{"name":"folder_id","in":"path","required":true,"schema":{"type":"string","title":"Folder Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamDropboxFolderDeleted_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_dropbox_remove_folder_api_v1_agents_engines_dropbox_folders__folder_id__delete"}},"/api/v1/agents/engines/dropbox/oauth/callback":{"get":{"tags":["agents"],"summary":"Team Dropbox OAuth callback","description":"Handle the redirect from Dropbox's consent page.","operationId":"agents_dropbox_oauth_callback","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Authorization code","title":"Code"},"description":"Authorization code"},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Single-use OAuth state nonce","title":"State"},"description":"Single-use OAuth state nonce"},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Set when the person declines","title":"Error"},"description":"Set when the person declines"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"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_dropbox_oauth_callback_api_v1_agents_engines_dropbox_oauth_callback_get"}},"/api/v1/agents/engines":{"get":{"tags":["agents"],"summary":"Engine status (superuser)","description":"Which engines the agents worker can run, whether each is signed in, and whether a worker is online. Superusers only.","operationId":"agents_engines","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_EnginesStatusResponse_"}}}},"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_engines_api_v1_agents_engines_get"}},"/api/v1/agents/engines/spend":{"get":{"tags":["agents"],"summary":"Agent spend across every business (superuser)","description":"Runs, tokens and cost per business and role for one month (default: this month), over every business that ran an agent. Superusers only.","operationId":"agents_engines_spend","parameters":[{"name":"month","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM; default this month","title":"Month"},"description":"YYYY-MM; default this month"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentSpendResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_engines_spend_api_v1_agents_engines_spend_get"}},"/api/v1/agents/engines/activity":{"get":{"tags":["agents"],"summary":"Agent runs across every business (superuser)","description":"What agents are doing on every business, newest first: open runs (queued, running, waiting) by default, or every run with `status=all`. Each run carries its business name and live `activity` line. Superusers only.","operationId":"agents_engines_activity","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","description":"open (default) or all","default":"open","title":"Status"},"description":"open (default) or all"},{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"One business's runs","title":"Business Id"},"description":"One business's runs"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"next_cursor from the last page","title":"Cursor"},"description":"next_cursor from the last page"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"description":"Page size (max 200)","default":50,"title":"Limit"},"description":"Page size (max 200)"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentActivityResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_engines_activity_api_v1_agents_engines_activity_get"}},"/api/v1/agents/engines/runs/{run_id}/events":{"get":{"tags":["agents"],"summary":"Read any business's run transcript (superuser)","description":"Transcript events of a run on any business after `after_seq`, in order. Pass `last_seq` back as `after_seq`. Superusers only.","operationId":"agents_engines_run_events","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"after_seq","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Return events with seq above this","default":0,"title":"After Seq"},"description":"Return events with seq above this"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":2000,"minimum":1,"default":500,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRunEventsResponse_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_engines_run_events_api_v1_agents_engines_runs__run_id__events_get"}},"/api/v1/agents/engines/mcp-usage":{"get":{"tags":["agents"],"summary":"External MCP servers and agents' use of them (superuser)","description":"Every external MCP server connected on any business: health, whether agents may use it, its tool count and agents' calls in the last 30 days. Superusers only.","operationId":"agents_engines_mcp_usage","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentMcpUsageResponse_"}}}},"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_engines_mcp_usage_api_v1_agents_engines_mcp_usage_get"}},"/api/v1/agents/engines/{engine}/sign-in":{"post":{"tags":["agents"],"summary":"Sign an engine in from the worker (superuser)","description":"Start `claude setup-token` or `codex login --device-auth` on the agents worker. Poll `/engines` for the URL and code to show. `503 AGENT_008` when no worker is online, `409 AGENT_011` while a sign-in is already running, `404 AGENT_013` for an engine without a firm account.","operationId":"agents_engine_sign_in","parameters":[{"name":"engine","in":"path","required":true,"schema":{"type":"string","title":"Engine"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_EngineAccountOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"example":{"error":"service_unavailable","message":"The service is temporarily unavailable. Please try again later.","code":"GEN_004","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_engine_sign_in_api_v1_agents_engines__engine__sign_in_post"}},"/api/v1/agents/engines/{engine}/sign-in/code":{"post":{"tags":["agents"],"summary":"Paste the code the browser showed (superuser)","description":"Claude Code: hand the one-time code from the browser to the sign-in running on the worker. `409 AGENT_011` unless a sign-in is pending and waiting for a code.","operationId":"agents_engine_sign_in_code","parameters":[{"name":"engine","in":"path","required":true,"schema":{"type":"string","title":"Engine"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineSignInCodeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_EngineAccountOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"example":{"error":"service_unavailable","message":"The service is temporarily unavailable. Please try again later.","code":"GEN_004","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_engine_sign_in_code_api_v1_agents_engines__engine__sign_in_code_post"}},"/api/v1/agents/engines/{engine}/sign-in/cancel":{"post":{"tags":["agents"],"summary":"Cancel an engine sign-in (superuser)","description":"Stop the sign-in running on the worker. The row goes back to `connected` when an older credential is still stored, else `revoked`. `409 AGENT_011` when nothing is pending.","operationId":"agents_engine_sign_in_cancel","parameters":[{"name":"engine","in":"path","required":true,"schema":{"type":"string","title":"Engine"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_EngineAccountOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_engine_sign_in_cancel_api_v1_agents_engines__engine__sign_in_cancel_post"}},"/api/v1/agents/engines/{engine}/credential":{"put":{"tags":["agents"],"summary":"Paste an engine credential (superuser)","description":"Store a token made on a laptop: the `sk-ant-oat01-…` token from `claude setup-token`, or the text of `~/.codex/auth.json`; or with `kind = api_key` an Anthropic / OpenAI API key. The row is `connected` at once; its first use (or `POST /engines/{engine}/test`) proves it. `400 AGENT_012` when the shape is wrong.","operationId":"agents_engine_set_credential","parameters":[{"name":"engine","in":"path","required":true,"schema":{"type":"string","title":"Engine"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngineCredentialRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_EngineAccountOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_engine_set_credential_api_v1_agents_engines__engine__credential_put"},"delete":{"tags":["agents"],"summary":"Disconnect an engine account (superuser)","description":"Forget the stored credential; the row becomes `revoked` and every role on the engine stops until someone reconnects it (the worker's environment token is only used when there is no row at all).","operationId":"agents_engine_delete_credential","parameters":[{"name":"engine","in":"path","required":true,"schema":{"type":"string","title":"Engine"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_EngineAccountOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_engine_delete_credential_api_v1_agents_engines__engine__credential_delete"}},"/api/v1/agents/engines/{engine}/test":{"post":{"tags":["agents"],"summary":"Test an engine's credential (superuser)","description":"An API key is checked against the provider's API (no tokens spent); a rejected key marks the account `error`. A subscription token gets a local check (format, expiry, last successful run on the worker) and says so in `method`.","operationId":"agents_engine_test","parameters":[{"name":"engine","in":"path","required":true,"schema":{"type":"string","title":"Engine"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_EngineTestResult_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_engine_test_api_v1_agents_engines__engine__test_post"}},"/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"},"post":{"tags":["agents"],"summary":"Create an agent role","description":"Add an agent to the team. The claude_code and codex engines run on the firm's own subscriptions and are for DayZero staff only (AGENT_003). Business admins only.","operationId":"agents_create_role","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRoleCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRoleOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_create_role_api_v1_agents_roles_post"}},"/api/v1/agents/tool-groups":{"get":{"tags":["agents"],"summary":"List tool groups and connected servers for a role's tool access","description":"The groups a role can be given (group:<key>, one per DayZero tool mount) and this business's connected MCP servers (server:<slug>), with tool counts and who each server lets in.","operationId":"agents_list_tool_groups","parameters":[{"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_AgentToolGroupsResponse_"}}}},"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_tool_groups_api_v1_agents_tool_groups_get"}},"/api/v1/agents/roles/{role_id}":{"get":{"tags":["agents"],"summary":"Get an agent role","description":"One role with its roll-ups.","operationId":"agents_get_role","parameters":[{"name":"role_id","in":"path","required":true,"schema":{"type":"string","title":"Role Id"}},{"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_AgentRoleOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_get_role_api_v1_agents_roles__role_id__get"},"patch":{"tags":["agents"],"summary":"Update an agent role","description":"Change what was sent; a null title, model or allowed_tools clears it. Business admins only.","operationId":"agents_update_role","parameters":[{"name":"role_id","in":"path","required":true,"schema":{"type":"string","title":"Role Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRoleUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRoleOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_update_role_api_v1_agents_roles__role_id__patch"},"delete":{"tags":["agents"],"summary":"Delete an agent role","description":"Remove the role; its runs, transcripts and cards go with it. Business admins only.","operationId":"agents_delete_role","parameters":[{"name":"role_id","in":"path","required":true,"schema":{"type":"string","title":"Role Id"}},{"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":{"204":{"description":"Successful Response"},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_delete_role_api_v1_agents_roles__role_id__delete"}},"/api/v1/agents/vibes":{"get":{"tags":["agents"],"summary":"List teammate vibes","description":"The personalities a role can talk in, with a sample line each. A vibe changes tone only: documents, ledger text and proposed changes stay plain and numbers stay exact.","operationId":"agents_list_vibes","parameters":[{"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_AgentVibeListResponse_"}}}},"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_vibes_api_v1_agents_vibes_get"}},"/api/v1/agents/roles/{role_id}/run":{"post":{"tags":["agents"],"summary":"Hand a job to a role","description":"Start a run of this role. Refused when the role is disabled or paused (AGENT_004) or over its monthly spend cap (AGENT_006).","operationId":"agents_run_role","parameters":[{"name":"role_id","in":"path","required":true,"schema":{"type":"string","title":"Role Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRoleRunRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRunOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"example":{"error":"service_unavailable","message":"The service is temporarily unavailable. Please try again later.","code":"GEN_004","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_run_role_api_v1_agents_roles__role_id__run_post"}},"/api/v1/agents/roles/{role_id}/permission-grants":{"get":{"tags":["agents"],"summary":"List a role's always-allowed tools","description":"The role-wide \"allow always\" answers DayZero staff gave on permission cards: every run of the role uses the tool (a shell tool: that exact command) without asking. Business admins only.","operationId":"agents_list_permission_grants","parameters":[{"name":"role_id","in":"path","required":true,"schema":{"type":"string","title":"Role Id"}},{"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_AgentPermissionGrantListResponse_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_permission_grants_api_v1_agents_roles__role_id__permission_grants_get"}},"/api/v1/agents/roles/{role_id}/permission-grants/{grant_id}":{"delete":{"tags":["agents"],"summary":"Revoke a role's always-allowed tool","description":"Forget one role-wide grant; the next run that wants the tool opens a permission card again. Answers the grants that are left. Business admins only.","operationId":"agents_revoke_permission_grant","parameters":[{"name":"role_id","in":"path","required":true,"schema":{"type":"string","title":"Role Id"}},{"name":"grant_id","in":"path","required":true,"schema":{"type":"string","title":"Grant Id"}},{"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_AgentPermissionGrantListResponse_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_revoke_permission_grant_api_v1_agents_roles__role_id__permission_grants__grant_id__delete"}},"/api/v1/agents/team/pause":{"post":{"tags":["agents"],"summary":"Pause the team","description":"Every role stops taking new runs; runs in flight finish. Business admins only.","operationId":"agents_pause_team","parameters":[{"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_AgentTeamPauseResponse_"}}}},"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_pause_team_api_v1_agents_team_pause_post"}},"/api/v1/agents/team/resume":{"post":{"tags":["agents"],"summary":"Resume the team","description":"Every role takes new runs again. Business admins only.","operationId":"agents_resume_team","parameters":[{"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_AgentTeamPauseResponse_"}}}},"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_resume_team_api_v1_agents_team_resume_post"}},"/api/v1/agents/runs":{"get":{"tags":["agents"],"summary":"List agent runs","description":"Runs on this business, newest first, with cursor paging.","operationId":"agents_list_runs","parameters":[{"name":"role_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"One role's runs","title":"Role Id"},"description":"One role's runs"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"queued, running, needs_input, completed, failed, cancelled or a comma-separated list","title":"Status"},"description":"queued, running, needs_input, completed, failed, cancelled or a comma-separated list"},{"name":"conversation_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Runs started from one Regent thread","title":"Conversation Id"},"description":"Runs started from one Regent thread"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"next_cursor from the last page","title":"Cursor"},"description":"next_cursor from the last page"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"description":"Page size (max 200)","default":50,"title":"Limit"},"description":"Page size (max 200)"},{"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_AgentRunListResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_runs_api_v1_agents_runs_get"},"post":{"tags":["agents"],"summary":"Start an agent run","description":"Hand a job to a role. Refused when the role is disabled or paused (AGENT_004) or over its monthly spend cap (AGENT_006).","operationId":"agents_create_run","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRunOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"example":{"error":"service_unavailable","message":"The service is temporarily unavailable. Please try again later.","code":"GEN_004","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_create_run_api_v1_agents_runs_post"}},"/api/v1/agents/runs/{run_id}":{"get":{"tags":["agents"],"summary":"Get an agent run","description":"One run with its status, result and open-card count.","operationId":"agents_get_run","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"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_AgentRunOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_get_run_api_v1_agents_runs__run_id__get"}},"/api/v1/agents/runs/{run_id}/stop":{"post":{"tags":["agents"],"summary":"Stop an agent run","description":"Ask the run to stop; it ends `cancelled`. `409` when it is not open.","operationId":"agents_stop_run","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"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_AgentRunOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_stop_run_api_v1_agents_runs__run_id__stop_post"}},"/api/v1/agents/runs/{run_id}/answer":{"post":{"tags":["agents"],"summary":"Answer a run's question","description":"Answer the question a run parked on (`needs_input` with no card) and let it continue. `409` when the run is not waiting.","operationId":"agents_answer_run","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunAnswer"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRunOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_answer_run_api_v1_agents_runs__run_id__answer_post"}},"/api/v1/agents/runs/{run_id}/steer":{"post":{"tags":["agents"],"summary":"Adjust a running agent run","description":"Give a run new instructions mid-task. The turn in flight is interrupted and the next one starts with the note; work already done stays done, and a gated write the note asks for is still filed as a proposed change. A run waiting on a question takes the note as its answer; a queued run reads it on its first turn. Appends a `steer` event. `409` (AGENT_005) when the run is not queued, running or waiting.","operationId":"agents_steer_run","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentRunSteer"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentRunOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_steer_run_api_v1_agents_runs__run_id__steer_post"}},"/api/v1/agents/runs/{run_id}/events":{"get":{"tags":["agents"],"summary":"Read a run's transcript","description":"Transcript events after `after`, in order. Pass `last_seq` back as `after`.","operationId":"agents_list_run_events","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"after","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Return events with seq above this","default":0,"title":"After"},"description":"Return events with seq above this"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":2000,"minimum":1,"default":500,"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_AgentRunEventsResponse_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_run_events_api_v1_agents_runs__run_id__events_get"}},"/api/v1/agents/runs/{run_id}/stream":{"get":{"tags":["agents"],"summary":"Stream a run's transcript (SSE)","description":"Server-Sent Events: replays events after `after`, then relays new ones as `event: <type>` frames with a `: heartbeat` comment every 15 s. Closes after run.completed, run.failed or run.cancelled.","operationId":"agents_stream_run_events","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"after","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Resume after this seq","default":0,"title":"After"},"description":"Resume after this seq"},{"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":{}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_stream_run_events_api_v1_agents_runs__run_id__stream_get"}},"/api/v1/agents/channel/posts":{"get":{"tags":["agents"],"summary":"Read the Team chat","description":"The business's shared room, oldest to newest: people's messages, one post per job (its runs inline) and Regent's routing lines. Without a cursor the newest page; `before` pages older (`next_cursor`), `after` returns up to 100 newer posts. `role_id` keeps one teammate's work.","operationId":"agents_list_channel_posts","parameters":[{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Post id: the page older than it","title":"Before"},"description":"Post id: the page older than it"},{"name":"after","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Post id: only posts newer than it","title":"After"},"description":"Post id: only posts newer than it"},{"name":"role_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"One teammate's work","title":"Role Id"},"description":"One teammate's work"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Page size (max 50)","default":30,"title":"Limit"},"description":"Page size (max 50)"},{"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_ChannelPostListResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_channel_posts_api_v1_agents_channel_posts_get"},"post":{"tags":["agents"],"summary":"Post to the Team chat","description":"Post a message. Each mentioned teammate (up to 3) gets a job with the message as its brief, run as you. With no mention Regent picks a teammate, says it can't, or stays out of a conversation between people. Refused for a disabled or paused teammate (AGENT_004).","operationId":"agents_create_channel_post","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelPostCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ChannelPostResult_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"example":{"error":"service_unavailable","message":"The service is temporarily unavailable. Please try again later.","code":"GEN_004","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_create_channel_post_api_v1_agents_channel_posts_post"}},"/api/v1/agents/channel/posts/{post_id}":{"get":{"tags":["agents"],"summary":"Get one Team chat post","description":"One post with its runs, e.g. after a live hint. `404` (AGENT_027) when it is not on this business.","operationId":"agents_get_channel_post","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","title":"Post Id"}},{"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_ChannelPostOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_get_channel_post_api_v1_agents_channel_posts__post_id__get"},"patch":{"tags":["agents"],"summary":"Edit your Team chat message","description":"Replace the text of a message you wrote (1 to 4000 characters); the post shows `edited_at`. Someone else's message is `403`, a job or Regent post or a deleted message `400`.","operationId":"agents_edit_channel_post","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","title":"Post Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelPostUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ChannelPostOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_edit_channel_post_api_v1_agents_channel_posts__post_id__patch"},"delete":{"tags":["agents"],"summary":"Delete your Team chat message","description":"Withdraw a message you wrote: its text is cleared and `deleted_at` set; the post stays so replies keep their place. Needs write permission, not delete. Someone else's message is `403`.","operationId":"agents_delete_channel_post","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","title":"Post Id"}},{"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_ChannelPostOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_delete_channel_post_api_v1_agents_channel_posts__post_id__delete"}},"/api/v1/agents/channel/stream":{"get":{"tags":["agents"],"summary":"Stream Team chat hints (SSE)","description":"Server-Sent Events: `data: {\"type\": \"post\", \"post_id\"}` when a post is added and `data: {\"type\": \"run\", \"run_id\", \"post_id\", \"event\"}` when a job's run moves on, with a `: heartbeat` comment every 15 s. Re-read the posts the hint names; the stream carries no content.","operationId":"agents_stream_channel","parameters":[{"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":{}}}},"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_stream_channel_api_v1_agents_channel_stream_get"}},"/api/v1/agents/cards":{"get":{"tags":["agents"],"summary":"List agent cards","description":"What runs are waiting on a person for. Default: pending cards.","operationId":"agents_list_cards","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"pending, answered, denied, expired, cancelled or all","default":"pending","title":"Status"},"description":"pending, answered, denied, expired, cancelled or all"},{"name":"run_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"One run's cards","title":"Run Id"},"description":"One run's cards"},{"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_AgentCardListResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_cards_api_v1_agents_cards_get"}},"/api/v1/agents/cards/{card_id}/answer":{"post":{"tags":["agents"],"summary":"Answer an agent card","description":"Allow or deny a permission, answer a question, confirm a sign-in or hand over a secret. The run continues. `409` when already answered.","operationId":"agents_answer_card","parameters":[{"name":"card_id","in":"path","required":true,"schema":{"type":"string","title":"Card Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentCardAnswerRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_AgentCardOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_answer_card_api_v1_agents_cards__card_id__answer_post"}},"/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"}},"/api/v1/agents/spend":{"get":{"tags":["agents"],"summary":"Agent spend by role","description":"Runs and cost per role for one month (default: this month).","operationId":"agents_spend","parameters":[{"name":"month","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM; default this month","title":"Month"},"description":"YYYY-MM; default this month"},{"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":"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_AgentSpendResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_spend_api_v1_agents_spend_get"}},"/api/v1/agents/channel/read":{"put":{"tags":["agents"],"summary":"Mark the Team chat read","description":"Remember the newest post you have seen. The pointer only moves forward; `GET /channel/posts` returns it as `last_read_post_id` and `GET /channel/unread` counts what came after it. Any business reader.","operationId":"agents_mark_channel_read","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelReadRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ChannelReadOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_mark_channel_read_api_v1_agents_channel_read_put"}},"/api/v1/agents/channel/unread":{"get":{"tags":["agents"],"summary":"Count unread Team chat posts","description":"Posts after the caller's last read, not counting their own messages or deleted ones. Capped at 999.","operationId":"agents_channel_unread","parameters":[{"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_ChannelUnreadResponse_"}}}},"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_channel_unread_api_v1_agents_channel_unread_get"}},"/api/v1/agents/channel/posts/{post_id}/reactions":{"post":{"tags":["agents"],"summary":"React to a Team chat post","description":"Put one of the six reactions (👍 ✅ 👀 🎉 ❤️ 😂) on a post. A repeat is a no-op. Returns the post with its reactions; `mine` marks yours.","operationId":"agents_add_channel_reaction","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","title":"Post Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelReactionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ChannelPostOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_add_channel_reaction_api_v1_agents_channel_posts__post_id__reactions_post"}},"/api/v1/agents/channel/posts/{post_id}/reactions/{emoji}":{"delete":{"tags":["agents"],"summary":"Remove your reaction from a Team chat post","description":"Take your `emoji` off the post (missing is a no-op). Needs write permission.","operationId":"agents_remove_channel_reaction","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","title":"Post Id"}},{"name":"emoji","in":"path","required":true,"schema":{"type":"string","title":"Emoji"}},{"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_ChannelPostOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_remove_channel_reaction_api_v1_agents_channel_posts__post_id__reactions__emoji__delete"}},"/api/v1/agents/firm/overview":{"get":{"tags":["agents"],"summary":"Every client's team (firm roll-up)","description":"One row per business and role across every business the caller can see: status, open runs, what needs a person, cost this month, the last and the next scheduled job; plus a total per business. Members of an advisory firm (and DayZero staff) only.","operationId":"agents_firm_overview","parameters":[{"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_AgentFirmOverviewResponse_"}}}},"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_firm_overview_api_v1_agents_firm_overview_get"}},"/api/v1/agents/library":{"get":{"tags":["agents"],"summary":"List the agent role library","description":"The firm's role templates (Data Ops, Bookkeeper, Controller, AP Desk, Cash Analyst): instructions, skills and scope to start a role from.","operationId":"agents_library_list","parameters":[{"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_RoleLibraryResponse_"}}}},"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_library_list_api_v1_agents_library_get"}},"/api/v1/agents/procedures":{"get":{"tags":["agents"],"summary":"List procedures","description":"Every SOP this business has turned into a procedure draft, newest first.","operationId":"agents_procedures_list","parameters":[{"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_list_ProcedureOut__"}}}},"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_procedures_list_api_v1_agents_procedures_get"},"post":{"tags":["agents"],"summary":"Generate a procedure draft from SOP text","description":"Reads the SOP with the planner model and returns a draft of jobs, roles, schedules and params for review. Nothing is installed.","operationId":"agents_procedures_generate","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcedureGenerateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ProcedureOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_procedures_generate_api_v1_agents_procedures_post"}},"/api/v1/agents/procedures/{procedure_id}":{"get":{"tags":["agents"],"summary":"Get a procedure","description":"One procedure with its current draft and what its last install created.","operationId":"agents_procedures_get","parameters":[{"name":"procedure_id","in":"path","required":true,"schema":{"type":"string","title":"Procedure Id"}},{"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_ProcedureOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_procedures_get_api_v1_agents_procedures__procedure_id__get"},"patch":{"tags":["agents"],"summary":"Replace a procedure's draft","description":"Save the reviewed draft (edited jobs, roles, schedules); bumps the version.","operationId":"agents_procedures_update","parameters":[{"name":"procedure_id","in":"path","required":true,"schema":{"type":"string","title":"Procedure Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcedureUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ProcedureOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_procedures_update_api_v1_agents_procedures__procedure_id__patch"}},"/api/v1/agents/procedures/{procedure_id}/install":{"post":{"tags":["agents"],"summary":"Install a procedure","description":"Create or update the agent roles the draft names (library template plus the draft's additions) and one scheduled workflow per scheduled job, each a single agent_run node. Refused with AGENT_009 when the draft is invalid.","operationId":"agents_procedures_install","parameters":[{"name":"procedure_id","in":"path","required":true,"schema":{"type":"string","title":"Procedure Id"}},{"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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_ProcedureInstallResult_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_procedures_install_api_v1_agents_procedures__procedure_id__install_post"}},"/api/v1/agents/sops":{"get":{"tags":["agents"],"summary":"List SOPs","description":"The business's own SOPs and, when it belongs to an advisory firm, the firm's shared library (scope=firm; written by firm owners and admins).","operationId":"agents_sops_list","parameters":[{"name":"scope","in":"query","required":false,"schema":{"enum":["business","firm","all"],"type":"string","description":"business, firm or all","default":"all","title":"Scope"},"description":"business, firm or all"},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","description":"Include archived SOPs","default":false,"title":"Include Archived"},"description":"Include archived SOPs"},{"name":"archived_only","in":"query","required":false,"schema":{"type":"boolean","description":"Only archived SOPs","default":false,"title":"Archived Only"},"description":"Only archived SOPs"},{"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_SopListResponse_"}}}},"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_sops_list_api_v1_agents_sops_get"},"post":{"tags":["agents"],"summary":"Create an SOP","description":"Write an SOP in the app; an empty body starts from the template.","operationId":"agents_sops_create","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SopCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopDetailOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_sops_create_api_v1_agents_sops_post"}},"/api/v1/agents/sops/upload":{"post":{"tags":["agents"],"summary":"Upload an SOP","description":"A .md, .txt or .docx file (up to 10 MB; at most 400,000 characters of text) becomes a draft SOP (``source = upload``).","operationId":"agents_sops_upload","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_agents_sops_upload_api_v1_agents_sops_upload_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopUploadResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_sops_upload_api_v1_agents_sops_upload_post"}},"/api/v1/agents/sops/format":{"post":{"tags":["agents"],"summary":"Auto-structure notes as an SOP","description":"Turn plain-English checklist notes or extracted Word text into structured SOP markdown with YAML front matter and `## J-NN` job sections. A rule-based pass (headings and bullets become jobs), not a model.","operationId":"agents_sops_format","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SopFormatRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopFormatResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_sops_format_api_v1_agents_sops_format_post"}},"/api/v1/agents/sops/suggestions":{"get":{"tags":["agents"],"summary":"Suggested SOPs","description":"SOPs worth writing for this business, ranked, from what it has connected (bank and card feeds, Shopify, Stripe, QuickBooks, payroll), its bill and invoice volume, open periods, and the SOPs and roles it already has. Each names a starter template and an owner role; already_have marks one a draft or live SOP covers.","operationId":"agents_sops_suggestions","parameters":[{"name":"include_existing","in":"query","required":false,"schema":{"type":"boolean","description":"Also return suggestions an SOP already covers","default":false,"title":"Include Existing"},"description":"Also return suggestions an SOP already covers"},{"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_SopSuggestionListResponse_"}}}},"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_sops_suggestions_api_v1_agents_sops_suggestions_get"}},"/api/v1/agents/sops/generations/{generation_id}":{"get":{"tags":["agents"],"summary":"Get a team generation","description":"Poll a team generation started by generate or refresh until its status is succeeded (the team's procedure is included) or failed (with the reason).","operationId":"agents_sops_generation_get","parameters":[{"name":"generation_id","in":"path","required":true,"schema":{"type":"string","title":"Generation Id"}},{"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_SopGenerationOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_generation_get_api_v1_agents_sops_generations__generation_id__get"}},"/api/v1/agents/sops/{sop_id}":{"get":{"tags":["agents"],"summary":"Get an SOP","description":"The document, its parsed jobs and the format problems to fix.","operationId":"agents_sops_get","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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_SopDetailOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_get_api_v1_agents_sops__sop_id__get"},"patch":{"tags":["agents"],"summary":"Update an SOP","description":"Edit the document or its header; the front matter always follows the header. A save that changes nothing makes no new version. Send expected_updated_at to be refused with 409 AGENT_015 when the SOP changed since it was loaded. Retiring pauses its teams' schedules.","operationId":"agents_sops_update","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SopUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopDetailOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_sops_update_api_v1_agents_sops__sop_id__patch"},"delete":{"tags":["agents"],"summary":"Archive an SOP","description":"Hide the SOP from the library; procedures built from it keep working.","operationId":"agents_sops_archive","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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":{"204":{"description":"Successful Response"},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_archive_api_v1_agents_sops__sop_id__delete"}},"/api/v1/agents/sops/{sop_id}/duplicate":{"post":{"tags":["agents"],"summary":"Duplicate an SOP","description":"Create an editable business copy of any accessible SOP (including Firm library templates).","operationId":"agents_sops_duplicate","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SopDuplicateRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopDetailOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_duplicate_api_v1_agents_sops__sop_id__duplicate_post"}},"/api/v1/agents/sops/{sop_id}/unarchive":{"post":{"tags":["agents"],"summary":"Unarchive an SOP","description":"Put an archived SOP back in the library.","operationId":"agents_sops_unarchive","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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_SopDetailOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_unarchive_api_v1_agents_sops__sop_id__unarchive_post"}},"/api/v1/agents/sops/{sop_id}/revisions":{"get":{"tags":["agents"],"summary":"List an SOP's revisions","description":"Every saved version, newest first (the first is the current text). No document text.","operationId":"agents_sops_revisions_list","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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_SopRevisionListResponse_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_revisions_list_api_v1_agents_sops__sop_id__revisions_get"}},"/api/v1/agents/sops/{sop_id}/revisions/{revision_id}":{"get":{"tags":["agents"],"summary":"Get an SOP revision","description":"One saved version with its full text (for compare and restore).","operationId":"agents_sops_revision_get","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"name":"revision_id","in":"path","required":true,"schema":{"type":"string","title":"Revision Id"}},{"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_SopRevisionDetailOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_revision_get_api_v1_agents_sops__sop_id__revisions__revision_id__get"}},"/api/v1/agents/sops/{sop_id}/restore":{"post":{"tags":["agents"],"summary":"Restore a previous SOP revision","description":"Make a saved revision's text current again as a new version; the SOP keeps its status. 409 AGENT_015 when expected_updated_at is stale.","operationId":"agents_sops_restore","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SopRestoreRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopDetailOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_sops_restore_api_v1_agents_sops__sop_id__restore_post"}},"/api/v1/agents/sops/{sop_id}/generate":{"post":{"tags":["agents"],"summary":"Build or update the team for an SOP","description":"Start reading a live SOP with the planner model; poll GET /sops/generations/{id} for the procedure draft (jobs, roles, schedules) to review. A business has one team per SOP: when it exists its draft is replaced (409 AGENT_017 if a person edited it, unless discard_edits). 400 AGENT_016 for a draft, retired or archived SOP, AGENT_019 when the SOP has format problems. For a firm SOP the caller must be a firm owner or admin.","operationId":"agents_sops_generate","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SopGenerateRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopGenerationOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_sops_generate_api_v1_agents_sops__sop_id__generate_post"}},"/api/v1/agents/sops/{sop_id}/teams/resume":{"post":{"tags":["agents"],"summary":"Resume the teams of an SOP","description":"Turn back on the schedules that retiring the SOP paused.","operationId":"agents_sops_teams_resume","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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_SopTeamsResumeOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_sops_teams_resume_api_v1_agents_sops__sop_id__teams_resume_post"}},"/api/v1/agents/procedures/{procedure_id}/refresh":{"post":{"tags":["agents"],"summary":"Update a team from its SOP","description":"Start regenerating the team's draft from the linked SOP's current text (poll GET /sops/generations/{id}). The team stays behind until the new draft is installed. AGENT_014 when the procedure is unlinked, 409 AGENT_017 when a person edited the draft (send discard_edits).","operationId":"agents_sops_procedure_refresh","parameters":[{"name":"procedure_id","in":"path","required":true,"schema":{"type":"string","title":"Procedure Id"}},{"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"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SopRefreshRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_SopGenerationOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_sops_procedure_refresh_api_v1_agents_procedures__procedure_id__refresh_post"}},"/api/v1/agents/mail/inbox":{"get":{"tags":["agents"],"summary":"Agents Mail Inbox","operationId":"agents_mail_inbox","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"title":"Cursor"}},{"name":"folder","in":"query","required":false,"schema":{"enum":["all","received","drafts","sent","attention","removed"],"type":"string","default":"all","title":"Folder"}},{"name":"search","in":"query","required":false,"schema":{"type":"string","maxLength":200,"default":"","title":"Search"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"enum":["bills","receipts","payments","reports","documents","questions","updates","general"],"type":"string"},{"type":"null"}],"title":"Category"}},{"name":"sort","in":"query","required":false,"schema":{"enum":["newest","type"],"type":"string","default":"newest","title":"Sort"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_inbox_api_v1_agents_mail_inbox_get"}},"/api/v1/agents/mail/inbox/{kind}/{item_id}/category":{"put":{"tags":["agents"],"summary":"Agents Mail Category","operationId":"agents_mail_category","parameters":[{"name":"kind","in":"path","required":true,"schema":{"enum":["email","conversation"],"type":"string","title":"Kind"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailCategoryUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_category_api_v1_agents_mail_inbox__kind___item_id__category_put"}},"/api/v1/agents/mail/emails/{email_id}/conversation":{"post":{"tags":["agents"],"summary":"Agents Mail Open Email","operationId":"agents_mail_open_email","parameters":[{"name":"email_id","in":"path","required":true,"schema":{"type":"string","title":"Email Id"}},{"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"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/MailReplyStart"},{"type":"null"}],"title":"Payload"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_open_email_api_v1_agents_mail_emails__email_id__conversation_post"}},"/api/v1/agents/mail/emails/{email_id}/restore":{"post":{"tags":["agents"],"summary":"Agents Mail Restore Email","operationId":"agents_mail_restore_email","parameters":[{"name":"email_id","in":"path","required":true,"schema":{"type":"string","title":"Email Id"}},{"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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_restore_email_api_v1_agents_mail_emails__email_id__restore_post"}},"/api/v1/agents/mail/threads/{thread_id}/suggested-reply":{"post":{"tags":["agents"],"summary":"Agents Mail Suggest Reply","operationId":"agents_mail_suggest_reply","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_suggest_reply_api_v1_agents_mail_threads__thread_id__suggested_reply_post"}},"/api/v1/agents/mail/drafts":{"post":{"tags":["agents"],"summary":"Agents Mail Compose","operationId":"agents_mail_compose","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailCompose"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_compose_api_v1_agents_mail_drafts_post"}},"/api/v1/agents/mail":{"get":{"tags":["agents"],"summary":"Agents Mail Settings","operationId":"agents_mail_settings","parameters":[{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_settings_api_v1_agents_mail_get"},"put":{"tags":["agents"],"summary":"Agents Mail Configure","operationId":"agents_mail_configure","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailboxUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_configure_api_v1_agents_mail_put"}},"/api/v1/agents/mail/grants":{"post":{"tags":["agents"],"summary":"Agents Mail Grant","operationId":"agents_mail_grant","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailGrantCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_grant_api_v1_agents_mail_grants_post"}},"/api/v1/agents/mail/grants/{grant_id}":{"delete":{"tags":["agents"],"summary":"Agents Mail Revoke","operationId":"agents_mail_revoke","parameters":[{"name":"grant_id","in":"path","required":true,"schema":{"type":"string","title":"Grant Id"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_revoke_api_v1_agents_mail_grants__grant_id__delete"}},"/api/v1/agents/mail/threads":{"get":{"tags":["agents"],"summary":"Agents Mail Threads","operationId":"agents_mail_threads","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_threads_api_v1_agents_mail_threads_get"}},"/api/v1/agents/mail/threads/{thread_id}":{"get":{"tags":["agents"],"summary":"Agents Mail Thread","operationId":"agents_mail_thread","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Before"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_thread_api_v1_agents_mail_threads__thread_id__get"}},"/api/v1/agents/mail/threads/{thread_id}/drafts":{"post":{"tags":["agents"],"summary":"Agents Mail Draft","operationId":"agents_mail_draft","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailDraftUpdate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_draft_api_v1_agents_mail_threads__thread_id__drafts_post"}},"/api/v1/agents/mail/client/threads":{"get":{"tags":["agents"],"summary":"Agents Mail Client Threads","operationId":"agents_mail_client_threads","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_client_threads_api_v1_agents_mail_client_threads_get"}},"/api/v1/agents/mail/client/threads/{thread_id}":{"get":{"tags":["agents"],"summary":"Agents Mail Client Thread","operationId":"agents_mail_client_thread","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Before"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_client_thread_api_v1_agents_mail_client_threads__thread_id__get"}},"/api/v1/agents/mail/client/threads/{thread_id}/reply":{"post":{"tags":["agents"],"summary":"Agents Mail Client Reply","description":"Clients may answer only conversations addressed to their own signed-in email.","operationId":"agents_mail_client_reply","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailDraftUpdate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_client_reply_api_v1_agents_mail_client_threads__thread_id__reply_post"}},"/api/v1/agents/mail/messages/{message_id}/attachments/{index}":{"get":{"tags":["agents"],"summary":"Agents Mail Attachment","operationId":"agents_mail_attachment","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","title":"Index"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_attachment_api_v1_agents_mail_messages__message_id__attachments__index__get"}},"/api/v1/agents/mail/client/threads/{thread_id}/messages/{message_id}/attachments/{index}":{"get":{"tags":["agents"],"summary":"Agents Mail Client Attachment","operationId":"agents_mail_client_attachment","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","title":"Index"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_client_attachment_api_v1_agents_mail_client_threads__thread_id__messages__message_id__attachments__index__get"}},"/api/v1/agents/mail/messages/{message_id}/send":{"post":{"tags":["agents"],"summary":"Agents Mail Send","operationId":"agents_mail_send","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailDecision"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_send_api_v1_agents_mail_messages__message_id__send_post"}},"/api/v1/agents/mail/threads/{thread_id}/start":{"post":{"tags":["agents"],"summary":"Agents Mail Start","operationId":"agents_mail_start","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_start_api_v1_agents_mail_threads__thread_id__start_post"}},"/api/v1/agents/mail/threads/{thread_id}/takeover":{"put":{"tags":["agents"],"summary":"Agents Mail Takeover","operationId":"agents_mail_takeover","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailTakeover"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_takeover_api_v1_agents_mail_threads__thread_id__takeover_put"}},"/api/v1/agents/mail/senders":{"get":{"tags":["agents"],"summary":"Agents Mail Senders","description":"Everyone who has emailed the business, waiting decisions first.","operationId":"agents_mail_senders","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["allowed","pending","blocked"],"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"search","in":"query","required":false,"schema":{"type":"string","maxLength":200,"default":"","title":"Search"}},{"name":"contact_type","in":"query","required":false,"schema":{"anyOf":[{"enum":["vendor","contractor","employee","customer","team","other"],"type":"string"},{"type":"null"}],"title":"Contact Type"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":100000,"minimum":0,"default":0,"title":"Offset"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_senders_api_v1_agents_mail_senders_get"}},"/api/v1/agents/mail/senders/{sender_id}":{"get":{"tags":["agents"],"summary":"Agents Mail Sender","description":"One sender: who they are, what they sent, and what Regent sent them.","operationId":"agents_mail_sender","parameters":[{"name":"sender_id","in":"path","required":true,"schema":{"type":"string","title":"Sender Id"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_sender_api_v1_agents_mail_senders__sender_id__get"},"patch":{"tags":["agents"],"summary":"Agents Mail Sender Update","operationId":"agents_mail_sender_update","parameters":[{"name":"sender_id","in":"path","required":true,"schema":{"type":"string","title":"Sender Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailSenderUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_sender_update_api_v1_agents_mail_senders__sender_id__patch"}},"/api/v1/agents/mail/senders/{sender_id}/status":{"put":{"tags":["agents"],"summary":"Agents Mail Sender Status","description":"Allow (and read their held mail), block, or reset a sender.","operationId":"agents_mail_sender_status","parameters":[{"name":"sender_id","in":"path","required":true,"schema":{"type":"string","title":"Sender Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailSenderDecision"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_sender_status_api_v1_agents_mail_senders__sender_id__status_put"}},"/api/v1/agents/mail/senders/{sender_id}/link":{"post":{"tags":["agents"],"summary":"Agents Mail Sender Link","description":"Make the sender a vendor, contractor, employee or customer (and allow them).","operationId":"agents_mail_sender_link","parameters":[{"name":"sender_id","in":"path","required":true,"schema":{"type":"string","title":"Sender Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MailSenderLink"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_sender_link_api_v1_agents_mail_senders__sender_id__link_post"}},"/api/v1/agents/mail/sent":{"get":{"tags":["agents"],"summary":"Agents Mail Sent","description":"Email Regent sent for the business, with delivery and open status.","operationId":"agents_mail_sent","parameters":[{"name":"recipient","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}],"title":"Recipient"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":24},{"type":"null"}],"title":"Kind"}},{"name":"ref_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Ref Id"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","maximum":100000,"minimum":0,"default":0,"title":"Offset"}},{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_mail_sent_api_v1_agents_mail_sent_get"}},"/api/v1/agents/routines/today":{"get":{"tags":["agents"],"summary":"Agents Routine Today","operationId":"agents_routine_today","parameters":[{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_routine_today_api_v1_agents_routines_today_get"}},"/api/v1/agents/sops/{sop_id}/improvements":{"post":{"tags":["agents"],"summary":"Agents Routine Improvement","operationId":"agents_routine_improvement","parameters":[{"name":"sop_id","in":"path","required":true,"schema":{"type":"string","title":"Sop Id"}},{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnFromRun"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_routine_improvement_api_v1_agents_sops__sop_id__improvements_post"}},"/api/v1/agents/routines/opportunities":{"get":{"tags":["agents"],"summary":"Agents Routine Opportunities","operationId":"agents_routine_opportunities","parameters":[{"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_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_routine_opportunities_api_v1_agents_routines_opportunities_get"}},"/api/v1/agents/routines/dismiss":{"post":{"tags":["agents"],"summary":"Agents Routine Dismiss","operationId":"agents_routine_dismiss","parameters":[{"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"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissPattern"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_routine_dismiss_api_v1_agents_routines_dismiss_post"}},"/api/v1/agents/runs/{run_id}/routine":{"post":{"tags":["agents"],"summary":"Agents Routine From Run","operationId":"agents_routine_from_run","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_routine_from_run_api_v1_agents_runs__run_id__routine_post"}},"/api/v1/agents/runs/{run_id}/trial":{"post":{"tags":["agents"],"summary":"Agents Routine Trial","operationId":"agents_routine_trial","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_routine_trial_api_v1_agents_runs__run_id__trial_post"}},"/api/v1/agents/runs/{run_id}/verify":{"post":{"tags":["agents"],"summary":"Agents Routine Verify","operationId":"agents_routine_verify","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"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":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_dict_str__Any__"}}}},"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"}}}},"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":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"unauthorized","message":"Authentication required","code":"AUTH_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"error":"forbidden","message":"You don't have permission to access this resource","code":"AUTH_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"}}}}},"x-fastapi-operation-id":"agents_routine_verify_api_v1_agents_runs__run_id__verify_post"}},"/api/v1/agents/staff/logins/scope":{"get":{"tags":["agents"],"summary":"A business's login scope (superuser)","description":"The business, the firm whose logins and vaults its runs also use, and its roles for the role picker. Superusers only.","operationId":"agents_staff_logins_scope","parameters":[{"name":"business_id","in":"query","required":true,"schema":{"type":"string","description":"The business","title":"Business Id"},"description":"The business"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_StaffLoginScopeOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_staff_logins_scope_api_v1_agents_staff_logins_scope_get"}},"/api/v1/agents/staff/logins":{"get":{"tags":["agents"],"summary":"List saved logins (superuser)","description":"The logins browser roles may fill for one business or one firm, plus read-only rows from its own 1Password connection and from team vaults mapped to it (source=1password). Never a password or two-factor key. Superusers only.","operationId":"agents_staff_logins_list","parameters":[{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_LoginListResponse_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_staff_logins_list_api_v1_agents_staff_logins_get"},"post":{"tags":["agents"],"summary":"Save a login (superuser)","description":"Save a username and password (and optionally a two-factor setup key) for one exact host. The same owner, host and username (any case) replaces the saved one. AGENT_022 for an address that is not a website, AGENT_023 for a two-factor key that cannot be read. Superusers only.","operationId":"agents_staff_logins_create","parameters":[{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_LoginOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_staff_logins_create_api_v1_agents_staff_logins_post"}},"/api/v1/agents/staff/logins/{login_id}":{"patch":{"tags":["agents"],"summary":"Update a saved login (superuser)","description":"Change what was sent. A new password replaces the old one; an empty totp removes the two-factor key; a null role_ids lets every role use it. 1Password rows are changed in 1Password. Superusers only.","operationId":"agents_staff_logins_update","parameters":[{"name":"login_id","in":"path","required":true,"schema":{"type":"string","title":"Login Id"}},{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_LoginOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict - Resource already exists or is in an incompatible state","content":{"application/json":{"example":{"error":"conflict","message":"Resource already exists","code":"CONFLICT_001","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_staff_logins_update_api_v1_agents_staff_logins__login_id__patch"},"delete":{"tags":["agents"],"summary":"Delete a saved login (superuser)","description":"Remove a saved login of the named owner.","operationId":"agents_staff_logins_delete","parameters":[{"name":"login_id","in":"path","required":true,"schema":{"type":"string","title":"Login Id"}},{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_staff_logins_delete_api_v1_agents_staff_logins__login_id__delete"}},"/api/v1/agents/staff/vault":{"get":{"tags":["agents"],"summary":"Get a business's or firm's 1Password (superuser)","description":"Whether the owner has its own vault connected, its vaults and item count. Superusers only.","operationId":"agents_staff_vault_get","parameters":[{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_VaultStatusOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_staff_vault_get_api_v1_agents_staff_vault_get"},"put":{"tags":["agents"],"summary":"Connect a business's or firm's 1Password (superuser)","description":"Store a 1Password service account token for one owner after reading its vaults with it. AGENT_024 when 1Password does not accept the token. Replaces an earlier token. Prefer the team vault. Superusers only.","operationId":"agents_staff_vault_connect","parameters":[{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VaultConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_VaultStatusOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_staff_vault_connect_api_v1_agents_staff_vault_put"},"delete":{"tags":["agents"],"summary":"Disconnect a business's or firm's 1Password (superuser)","description":"Forget the token and the index. AGENT_025 when none is connected. Superusers only.","operationId":"agents_staff_vault_disconnect","parameters":[{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_VaultStatusOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_staff_vault_disconnect_api_v1_agents_staff_vault_delete"}},"/api/v1/agents/staff/vault/refresh":{"post":{"tags":["agents"],"summary":"Refresh a business's or firm's 1Password index (superuser)","description":"Read the vault again. A failure answers status=error with last_error rather than an error response. AGENT_025 when no vault is connected. Superusers only.","operationId":"agents_staff_vault_refresh","parameters":[{"name":"business_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The business whose logins these are","title":"Business Id"},"description":"The business whose logins these are"},{"name":"firm_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"The advisory firm whose logins these are","title":"Firm Id"},"description":"The advisory firm whose logins these are"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_VaultStatusOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_staff_vault_refresh_api_v1_agents_staff_vault_refresh_post"}},"/api/v1/agents/staff/browser-sessions":{"get":{"tags":["agents"],"summary":"List a business's roles' browser sign-ins (superuser)","description":"The roles on the business that keep a browser sign-in between runs, and the sites (cookie domains) they are signed in to. Superusers only.","operationId":"agents_staff_browser_sessions","parameters":[{"name":"business_id","in":"query","required":true,"schema":{"type":"string","description":"The business","title":"Business Id"},"description":"The business"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_BrowserSessionListResponse_"}}}},"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_staff_browser_sessions_api_v1_agents_staff_browser_sessions_get"}},"/api/v1/agents/staff/browser-sessions/{role_id}":{"delete":{"tags":["agents"],"summary":"Sign a role out of every site (superuser)","description":"Forget the role's saved cookies and storage; its next run starts signed out. Superusers only.","operationId":"agents_staff_browser_session_delete","parameters":[{"name":"role_id","in":"path","required":true,"schema":{"type":"string","title":"Role Id"}},{"name":"business_id","in":"query","required":true,"schema":{"type":"string","description":"The business","title":"Business Id"},"description":"The business"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_staff_browser_session_delete_api_v1_agents_staff_browser_sessions__role_id__delete"}},"/api/v1/agents/staff/team-vault":{"get":{"tags":["agents"],"summary":"Get the team 1Password (superuser)","description":"DayZero's 1Password service account: whether it is connected, each vault it reads with its item count and the business or firm it is mapped to. Superusers only.","operationId":"agents_staff_team_vault_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamVaultStatusOut_"}}}},"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_staff_team_vault_get_api_v1_agents_staff_team_vault_get"},"put":{"tags":["agents"],"summary":"Connect the team 1Password (superuser)","description":"Store DayZero's 1Password service account token after reading its vaults with it. AGENT_024 when 1Password does not accept the token. Replaces an earlier token; vault mappings are kept. Superusers only.","operationId":"agents_staff_team_vault_connect","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamVaultConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamVaultStatusOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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_staff_team_vault_connect_api_v1_agents_staff_team_vault_put"},"delete":{"tags":["agents"],"summary":"Disconnect the team 1Password (superuser)","description":"Forget the token and the index; vault mappings stay for a reconnect. AGENT_025 when it is not connected. Superusers only.","operationId":"agents_staff_team_vault_disconnect","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamVaultStatusOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_staff_team_vault_disconnect_api_v1_agents_staff_team_vault_delete"}},"/api/v1/agents/staff/team-vault/refresh":{"post":{"tags":["agents"],"summary":"Refresh the team 1Password index (superuser)","description":"Read the vaults again. A failure answers status=error with last_error. AGENT_025 when the team vault is not connected. Superusers only.","operationId":"agents_staff_team_vault_refresh","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamVaultStatusOut_"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_staff_team_vault_refresh_api_v1_agents_staff_team_vault_refresh_post"}},"/api/v1/agents/staff/team-vault/vaults/{vault_id}/mapping":{"put":{"tags":["agents"],"summary":"Map a team vault to a client (superuser)","description":"Give one vault to one business or one firm (replacing its client): browser runs for that business, or the firm's businesses, use its logins. Superusers only.","operationId":"agents_staff_team_vault_map","parameters":[{"name":"vault_id","in":"path","required":true,"schema":{"type":"string","title":"Vault Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamVaultMapRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamVaultStatusOut_"}}}},"400":{"description":"Bad Request - Invalid input","content":{"application/json":{"example":{"error":"validation_error","message":"Validation failed: due_date: Input should be a valid date","errors":{"due_date":"Input should be a valid date"},"code":"GEN_002","request_id":"3f0e7c2a-9b4d-4e1a-8c6f-2d5b7a1e9c30"},"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"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"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"error":"not_found","message":"Resource not found","code":"NOT_FOUND_001","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_staff_team_vault_map_api_v1_agents_staff_team_vault_vaults__vault_id__mapping_put"},"delete":{"tags":["agents"],"summary":"Unmap a team vault (superuser)","description":"No client uses the vault's logins any more. Superusers only.","operationId":"agents_staff_team_vault_unmap","parameters":[{"name":"vault_id","in":"path","required":true,"schema":{"type":"string","title":"Vault Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessEnvelope_TeamVaultStatusOut_"}}}},"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_staff_team_vault_unmap_api_v1_agents_staff_team_vault_vaults__vault_id__mapping_delete"}}},"components":{"schemas":{"AgentActivityResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentActivityRun"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items","total"],"title":"AgentActivityResponse"},"AgentActivityRun":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name","default":""},"requester_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Requester User Id"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"},"origin":{"type":"string","enum":["chat","regent","team","schedule","workflow","procedure","api","channel","handoff"],"title":"Origin"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"brief":{"type":"string","title":"Brief"},"done_when":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Done When"},"status":{"type":"string","enum":["queued","running","needs_input","completed","failed","cancelled"],"title":"Status"},"outcome":{"anyOf":[{"type":"string","enum":["ok","error","stalled","expired","refused","interrupted","stopped","budget"]},{"type":"null"}],"title":"Outcome"},"outcome_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome Detail"},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"verification":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Verification"},"engine":{"type":"string","enum":["native","claude_code","codex"],"title":"Engine"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"account_label":{"type":"string","title":"Account Label","default":""},"cost_usd":{"type":"string","title":"Cost Usd","default":"0"},"max_cost_usd":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Max Cost Usd"},"tokens_prompt":{"type":"integer","title":"Tokens Prompt","default":0},"tokens_completion":{"type":"integer","title":"Tokens Completion","default":0},"tool_calls":{"type":"integer","title":"Tool Calls","default":0},"pending_change_ids":{"items":{"type":"string"},"type":"array","title":"Pending Change Ids"},"executions":{"type":"integer","title":"Executions","default":0},"question":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Question"},"period_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Id"},"checklist_item_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checklist Item Key"},"workflow_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Run Id"},"parent_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Run Id"},"open_cards":{"type":"integer","title":"Open Cards","default":0},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"last_event_seq":{"type":"integer","title":"Last Event Seq","default":0},"chat_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Message Id"},"chat_message_persisted":{"type":"boolean","title":"Chat Message Persisted","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"activity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Activity","description":"What an open run is doing now: its latest progress line, tool call or proposal, or the question it waits on. Null once closed."},"activity_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Activity At"},"channel_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Post Id","description":"The Team chat post that shows this run (follow-ups share their root's)."},"handoff_from_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Handoff From Run Id","description":"The run a teammate handed this job from (origin handoff)."},"business_name":{"type":"string","title":"Business Name","default":""}},"type":"object","required":["id","business_id","role_id","origin","brief","status","engine","created_at","updated_at"],"title":"AgentActivityRun","description":"A run on any business, for the staff activity view."},"AgentCardAnswerRequest":{"properties":{"decision":{"type":"string","enum":["allow","allow_always","deny","answer"],"title":"Decision"},"answer":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"string"},{"type":"null"}],"title":"Answer"},"note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Note"},"scope":{"type":"string","enum":["run","role"],"title":"Scope","description":"allow_always only: run (default) remembers the answer for this run; role remembers it for every run of the role (DayZero staff only). A shell command is only ever remembered as that exact command.","default":"run"}},"type":"object","required":["decision"],"title":"AgentCardAnswerRequest"},"AgentCardListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentCardOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"AgentCardListResponse"},"AgentCardOut":{"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}},"type":"object","required":["id","business_id","run_id","kind","title","status","created_at"],"title":"AgentCardOut"},"AgentFirmOverviewBusiness":{"properties":{"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"roles":{"type":"integer","title":"Roles","default":0},"open_runs":{"type":"integer","title":"Open Runs","default":0},"needs_you":{"type":"integer","title":"Needs You","default":0},"cost_usd_month":{"type":"string","title":"Cost Usd Month","default":"0"},"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"}},"type":"object","required":["business_id"],"title":"AgentFirmOverviewBusiness","description":"Per-business totals; a client with no team still has a row (``roles`` 0)."},"AgentFirmOverviewResponse":{"properties":{"month":{"type":"string","title":"Month","description":"YYYY-MM the costs cover (this month)."},"businesses":{"items":{"$ref":"#/components/schemas/AgentFirmOverviewBusiness"},"type":"array","title":"Businesses"},"items":{"items":{"$ref":"#/components/schemas/AgentFirmOverviewRow"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total","default":0}},"type":"object","required":["month"],"title":"AgentFirmOverviewResponse"},"AgentFirmOverviewRow":{"properties":{"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"status":{"type":"string","enum":["idle","running","needs_you","paused","disabled"],"title":"Status","default":"idle"},"enabled":{"type":"boolean","title":"Enabled","default":true},"paused":{"type":"boolean","title":"Paused","default":false},"open_runs":{"type":"integer","title":"Open Runs","default":0},"needs_you":{"type":"integer","title":"Needs You","default":0},"cost_usd_month":{"type":"string","title":"Cost Usd Month","default":"0"},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"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"}},"type":"object","required":["business_id","role_id","role_name"],"title":"AgentFirmOverviewRow","description":"One business × role row of the firm view."},"AgentMcpUsageResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentMcpUsageRow"},"type":"array","title":"Items"}},"type":"object","title":"AgentMcpUsageResponse"},"AgentMcpUsageRow":{"properties":{"connection_id":{"type":"string","title":"Connection Id"},"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"server_host":{"type":"string","title":"Server Host"},"enabled":{"type":"boolean","title":"Enabled"},"healthy":{"type":"boolean","title":"Healthy"},"agents_enabled":{"type":"boolean","title":"Agents Enabled"},"tool_count":{"type":"integer","title":"Tool Count","default":0},"agent_calls_30d":{"type":"integer","title":"Agent Calls 30D","default":0},"agent_last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Agent Last Used At"},"agent_last_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Last Role"}},"type":"object","required":["connection_id","business_id","name","slug","server_host","enabled","healthy","agents_enabled"],"title":"AgentMcpUsageRow","description":"One external MCP connection on any business and its agents' use of it."},"AgentPermissionGrantListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentPermissionGrantOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"AgentPermissionGrantListResponse"},"AgentPermissionGrantOut":{"properties":{"id":{"type":"string","title":"Id"},"scope":{"type":"string","enum":["run","role"],"title":"Scope"},"tool":{"type":"string","title":"Tool"},"command":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Command"},"granted_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Granted By User Id"},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"card_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Card Id"},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"}},"type":"object","required":["id","scope","tool"],"title":"AgentPermissionGrantOut","description":"One remembered \"allow always\" answer."},"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."},"AgentPersonaUpdate":{"properties":{"color":{"anyOf":[{"type":"string","enum":["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"]},{"type":"null"}],"title":"Color"},"body":{"anyOf":[{"type":"string","enum":["cursor","blob","circle","squircle","capsule","drop","shield","hexagon","diamond","star","jujube"]},{"type":"null"}],"title":"Body"},"vibe":{"anyOf":[{"type":"string","enum":["steady","upbeat","witty","blunt"]},{"type":"null"}],"title":"Vibe"},"greeting":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Greeting"}},"type":"object","title":"AgentPersonaUpdate","description":"A partial persona: fields sent are set, a null clears one (back to the default)."},"AgentResultCheck":{"properties":{"tool":{"type":"string","maxLength":128,"minLength":1,"title":"Tool"},"arguments":{"additionalProperties":true,"type":"object","title":"Arguments"},"path":{"items":{"type":"string"},"type":"array","maxItems":10,"minItems":1,"title":"Path"},"operator":{"type":"string","enum":["eq","lte","gte"],"title":"Operator","default":"eq"},"expected":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"title":"Expected"}},"type":"object","required":["tool","path","expected"],"title":"AgentResultCheck","description":"A deterministic re-read, never an instruction for a model to grade itself."},"AgentRoleCreate":{"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},"library_key":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Library Key"},"persona":{"anyOf":[{"$ref":"#/components/schemas/AgentPersonaUpdate"},{"type":"null"}],"description":"Face and vibe; what is left out gets the first color and body no other role on the team has, and the steady vibe."}},"type":"object","required":["name"],"title":"AgentRoleCreate"},"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"},"AgentRoleRunRequest":{"properties":{"brief":{"type":"string","maxLength":20000,"minLength":1,"title":"Brief"},"title":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Title"},"done_when":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Done When"},"conversation_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Conversation Id"},"origin":{"type":"string","enum":["chat","regent","team","schedule","workflow","procedure","api","channel","handoff"],"title":"Origin","default":"api"},"period_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Period Id"},"checklist_item_key":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Checklist Item Key"},"workflow_run_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Workflow Run Id"},"max_cost_usd":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Max Cost Usd","description":"Stop the run before a turn once it has cost this much (USD)."},"parent_run_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Parent Run Id","description":"An earlier run of this role this one follows up (bot chat)."}},"type":"object","required":["brief"],"title":"AgentRoleRunRequest","description":"``AgentRunCreate`` without ``role_id`` (the role is in the path)."},"AgentRoleUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":80,"minLength":1},{"type":"null"}],"title":"Name"},"title":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Title"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instructions"},"skills":{"anyOf":[{"items":{"$ref":"#/components/schemas/AgentSkill"},"type":"array"},{"type":"null"}],"title":"Skills"},"engine":{"anyOf":[{"type":"string","enum":["native","claude_code","codex"]},{"type":"null"}],"title":"Engine"},"model":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Model"},"scope":{"anyOf":[{"type":"string","enum":["read","changes"]},{"type":"null"}],"title":"Scope"},"allowed_tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Tools"},"params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Params"},"spend_cap_usd_month":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Spend Cap Usd Month"},"max_cost_usd_run":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Max Cost Usd Run"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"},"paused":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Paused"},"browser":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Browser"},"persona":{"anyOf":[{"$ref":"#/components/schemas/AgentPersonaUpdate"},{"type":"null"}],"description":"Merged into the stored persona: fields sent are set, a null clears one."}},"type":"object","title":"AgentRoleUpdate"},"AgentRunAnswer":{"properties":{"text":{"type":"string","maxLength":20000,"minLength":1,"title":"Text"}},"type":"object","required":["text"],"title":"AgentRunAnswer","description":"Answer the question a run parked on (``status = needs_input``, no card)."},"AgentRunCreate":{"properties":{"role_id":{"type":"string","title":"Role Id"},"brief":{"type":"string","maxLength":20000,"minLength":1,"title":"Brief"},"title":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Title"},"done_when":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Done When"},"result_checks":{"items":{"$ref":"#/components/schemas/AgentResultCheck"},"type":"array","maxItems":10,"title":"Result Checks"},"conversation_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Conversation Id","description":"Regent thread the run reports back into."},"origin":{"type":"string","enum":["chat","regent","team","schedule","workflow","procedure","api","channel","handoff"],"title":"Origin","default":"api"},"period_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Period Id"},"checklist_item_key":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Checklist Item Key"},"workflow_run_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Workflow Run Id"},"max_cost_usd":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Max Cost Usd","description":"Stop the run before a turn once it has cost this much (USD); default the role's max_cost_usd_run."},"parent_run_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Parent Run Id","description":"An earlier run of the same role this one follows up (bot chat); its brief and result go into the prompt."}},"type":"object","required":["role_id","brief"],"title":"AgentRunCreate"},"AgentRunEventOut":{"properties":{"id":{"type":"string","title":"Id"},"run_id":{"type":"string","title":"Run Id"},"seq":{"type":"integer","title":"Seq"},"type":{"anyOf":[{"type":"string","enum":["run.queued","run.started","turn.started","text.delta","text.final","thinking.delta","tool.started","tool.finished","card.opened","card.answered","proposal.filed","run.needs_input","run.resumed","run.completed","run.failed","run.cancelled","usage","screenshot","log","steer","handoff"]},{"type":"string"}],"title":"Type"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","run_id","seq","type","created_at"],"title":"AgentRunEventOut"},"AgentRunEventsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentRunEventOut"},"type":"array","title":"Items"},"last_seq":{"type":"integer","title":"Last Seq"}},"type":"object","required":["items","last_seq"],"title":"AgentRunEventsResponse"},"AgentRunListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentRunOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items","total"],"title":"AgentRunListResponse"},"AgentRunOut":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name","default":""},"requester_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Requester User Id"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"},"origin":{"type":"string","enum":["chat","regent","team","schedule","workflow","procedure","api","channel","handoff"],"title":"Origin"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"brief":{"type":"string","title":"Brief"},"done_when":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Done When"},"status":{"type":"string","enum":["queued","running","needs_input","completed","failed","cancelled"],"title":"Status"},"outcome":{"anyOf":[{"type":"string","enum":["ok","error","stalled","expired","refused","interrupted","stopped","budget"]},{"type":"null"}],"title":"Outcome"},"outcome_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome Detail"},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"verification":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Verification"},"engine":{"type":"string","enum":["native","claude_code","codex"],"title":"Engine"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"account_label":{"type":"string","title":"Account Label","default":""},"cost_usd":{"type":"string","title":"Cost Usd","default":"0"},"max_cost_usd":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Max Cost Usd"},"tokens_prompt":{"type":"integer","title":"Tokens Prompt","default":0},"tokens_completion":{"type":"integer","title":"Tokens Completion","default":0},"tool_calls":{"type":"integer","title":"Tool Calls","default":0},"pending_change_ids":{"items":{"type":"string"},"type":"array","title":"Pending Change Ids"},"executions":{"type":"integer","title":"Executions","default":0},"question":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Question"},"period_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period Id"},"checklist_item_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checklist Item Key"},"workflow_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Run Id"},"parent_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Run Id"},"open_cards":{"type":"integer","title":"Open Cards","default":0},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"last_event_seq":{"type":"integer","title":"Last Event Seq","default":0},"chat_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chat Message Id"},"chat_message_persisted":{"type":"boolean","title":"Chat Message Persisted","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"activity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Activity","description":"What an open run is doing now: its latest progress line, tool call or proposal, or the question it waits on. Null once closed."},"activity_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Activity At"},"channel_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel Post Id","description":"The Team chat post that shows this run (follow-ups share their root's)."},"handoff_from_run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Handoff From Run Id","description":"The run a teammate handed this job from (origin handoff)."}},"type":"object","required":["id","business_id","role_id","origin","brief","status","engine","created_at","updated_at"],"title":"AgentRunOut"},"AgentRunSteer":{"properties":{"text":{"type":"string","maxLength":4000,"minLength":1,"title":"Text"}},"type":"object","required":["text"],"title":"AgentRunSteer","description":"Adjust a run mid-task: extra instruction for the job in flight."},"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."},"AgentSpendResponse":{"properties":{"month":{"type":"string","title":"Month","description":"YYYY-MM"},"total_usd":{"type":"string","title":"Total Usd","default":"0"},"rows":{"items":{"$ref":"#/components/schemas/AgentSpendRow"},"type":"array","title":"Rows"}},"type":"object","required":["month"],"title":"AgentSpendResponse"},"AgentSpendRow":{"properties":{"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name","default":""},"role_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role Id"},"role_name":{"type":"string","title":"Role Name","default":""},"engine":{"anyOf":[{"type":"string","enum":["native","claude_code","codex"]},{"type":"null"}],"title":"Engine"},"runs":{"type":"integer","title":"Runs","default":0},"cost_usd":{"type":"string","title":"Cost Usd","default":"0"},"cost_estimated":{"type":"boolean","title":"Cost Estimated","description":"The cost is DayZero's estimate, not a bill: Claude Code reports a notional cost and Codex's is priced from its token counts.","default":false},"tokens_prompt":{"type":"integer","title":"Tokens Prompt","default":0},"tokens_completion":{"type":"integer","title":"Tokens Completion","default":0},"cap_usd_month":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cap Usd Month"}},"type":"object","required":["business_id"],"title":"AgentSpendRow"},"AgentTeamPauseResponse":{"properties":{"paused":{"type":"boolean","title":"Paused"},"roles":{"type":"integer","title":"Roles","description":"How many roles the change touched."}},"type":"object","required":["paused","roles"],"title":"AgentTeamPauseResponse"},"AgentToolGroup":{"properties":{"key":{"type":"string","title":"Key","description":"Mount short name; the token is group:<key>."},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description","default":""},"tool_count":{"type":"integer","title":"Tool Count","default":0}},"type":"object","required":["key","label"],"title":"AgentToolGroup","description":"One ``/mcp/<mount>`` domain a role can be given as ``group:<key>``."},"AgentToolGroupsResponse":{"properties":{"groups":{"items":{"$ref":"#/components/schemas/AgentToolGroup"},"type":"array","title":"Groups"},"servers":{"items":{"$ref":"#/components/schemas/AgentToolServer"},"type":"array","title":"Servers"}},"type":"object","title":"AgentToolGroupsResponse"},"AgentToolServer":{"properties":{"slug":{"type":"string","title":"Slug"},"name":{"type":"string","title":"Name"},"tool_count":{"type":"integer","title":"Tool Count","description":"Tools not blocked by an admin.","default":0},"agents_enabled":{"type":"boolean","title":"Agents Enabled","default":true},"agent_role_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Agent Role Ids","description":"Roles the connection lets in; null = every role."}},"type":"object","required":["slug","name"],"title":"AgentToolServer","description":"A connected MCP server a role can be given as ``server:<slug>``."},"AgentVibeListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentVibeOut"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"AgentVibeListResponse"},"AgentVibeOut":{"properties":{"key":{"type":"string","enum":["steady","upbeat","witty","blunt"],"title":"Key"},"label":{"type":"string","title":"Label"},"description":{"type":"string","title":"Description"},"sample":{"type":"string","title":"Sample","description":"How a report sounds in this vibe."}},"type":"object","required":["key","label","description","sample"],"title":"AgentVibeOut"},"Body_agents_sops_upload_api_v1_agents_sops_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File","description":"The SOP document"}},"type":"object","required":["file"],"title":"Body_agents_sops_upload_api_v1_agents_sops_upload_post"},"BrowserSessionListResponse":{"properties":{"sessions":{"items":{"$ref":"#/components/schemas/BrowserSessionOut"},"type":"array","title":"Sessions"}},"type":"object","required":["sessions"],"title":"BrowserSessionListResponse"},"BrowserSessionOut":{"properties":{"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name"},"hosts":{"items":{"type":"string"},"type":"array","title":"Hosts","description":"Cookie domains."},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["role_id","role_name","updated_at"],"title":"BrowserSessionOut","description":"A role's saved browser sign-ins on this business."},"ChannelHandoffFrom":{"properties":{"run_id":{"type":"string","title":"Run Id"},"role_name":{"type":"string","title":"Role Name"}},"type":"object","required":["run_id","role_name"],"title":"ChannelHandoffFrom","description":"The run (and teammate) that handed a job over."},"ChannelPostAuthor":{"properties":{"user_id":{"type":"string","title":"User Id"},"name":{"type":"string","title":"Name"}},"type":"object","required":["user_id","name"],"title":"ChannelPostAuthor"},"ChannelPostCreate":{"properties":{"text":{"type":"string","maxLength":4000,"minLength":1,"title":"Text"},"mention_role_ids":{"items":{"type":"string"},"type":"array","maxItems":3,"title":"Mention Role Ids","description":"Teammates to hand the message to; none lets Regent pick one."}},"type":"object","required":["text"],"title":"ChannelPostCreate"},"ChannelPostListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ChannelPostOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Pass as `before` for the older page; null when there is none."},"last_read_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Read Post Id","description":"The newest post the caller has marked read; null when none."}},"type":"object","required":["items"],"title":"ChannelPostListResponse"},"ChannelPostOut":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","enum":["person","job","regent"],"title":"Kind"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"},"mentions":{"items":{"type":"string"},"type":"array","title":"Mentions","description":"Role ids the person @mentioned."},"reply_to_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reply To Post Id"},"author":{"anyOf":[{"$ref":"#/components/schemas/ChannelPostAuthor"},{"type":"null"}]},"role":{"anyOf":[{"$ref":"#/components/schemas/ChannelPostRole"},{"type":"null"}],"description":"job: the teammate doing it; regent: the teammate it was routed to."},"origin":{"anyOf":[{"type":"string","enum":["chat","regent","team","schedule","workflow","procedure","api","channel","handoff"]},{"type":"null"}],"title":"Origin","description":"job: how the root run was started."},"runs":{"items":{"$ref":"#/components/schemas/AgentRunOut"},"type":"array","title":"Runs","description":"job: the root run first, then its follow-ups oldest first."},"proposals":{"items":{"$ref":"#/components/schemas/ChannelProposalOut"},"type":"array","title":"Proposals","description":"job: proposed changes its runs filed, newest first (max 20)."},"handoff_from":{"anyOf":[{"$ref":"#/components/schemas/ChannelHandoffFrom"},{"type":"null"}],"description":"job: the run and teammate that handed this work over."},"edited_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Edited At","description":"person: when the author last changed the text."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"person: the author withdrew it; `text` is null, the row stays."},"reactions":{"items":{"$ref":"#/components/schemas/ChannelReactionOut"},"type":"array","title":"Reactions","description":"Emoji on the post, in picker order."}},"type":"object","required":["id","kind","created_at"],"title":"ChannelPostOut","description":"One line of the business's Team chat."},"ChannelPostResult":{"properties":{"post":{"$ref":"#/components/schemas/ChannelPostOut"},"jobs":{"items":{"$ref":"#/components/schemas/ChannelPostOut"},"type":"array","title":"Jobs"},"regent":{"anyOf":[{"$ref":"#/components/schemas/ChannelPostOut"},{"type":"null"}]},"pending_answer":{"type":"boolean","title":"Pending Answer","description":"Regent is answering in the background; its reply arrives as a `regent` post replying to `post` (watch the stream).","default":false}},"type":"object","required":["post"],"title":"ChannelPostResult"},"ChannelPostRole":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"persona":{"$ref":"#/components/schemas/AgentPersona"}},"type":"object","required":["id","name","persona"],"title":"ChannelPostRole"},"ChannelPostUpdate":{"properties":{"text":{"type":"string","maxLength":4000,"minLength":1,"title":"Text"}},"type":"object","required":["text"],"title":"ChannelPostUpdate"},"ChannelProposalOut":{"properties":{"id":{"type":"string","title":"Id"},"summary":{"type":"string","title":"Summary"},"status":{"type":"string","title":"Status"},"tier":{"type":"integer","title":"Tier","default":2},"tool_name":{"type":"string","title":"Tool Name"},"impact_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Impact Cents"},"destructive":{"type":"boolean","title":"Destructive","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","summary","status","tool_name","created_at"],"title":"ChannelProposalOut","description":"A proposed change one of a job's runs filed."},"ChannelReactionOut":{"properties":{"emoji":{"type":"string","title":"Emoji"},"count":{"type":"integer","title":"Count"},"mine":{"type":"boolean","title":"Mine","default":false}},"type":"object","required":["emoji","count"],"title":"ChannelReactionOut","description":"One emoji under a post: how many people, and whether the caller is one."},"ChannelReactionRequest":{"properties":{"emoji":{"type":"string","enum":["👍","✅","👀","🎉","❤️","😂"],"title":"Emoji"}},"type":"object","required":["emoji"],"title":"ChannelReactionRequest"},"ChannelReadOut":{"properties":{"last_read_post_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Read Post Id"}},"type":"object","title":"ChannelReadOut"},"ChannelReadRequest":{"properties":{"post_id":{"type":"string","title":"Post Id","description":"The newest post the caller has seen."}},"type":"object","required":["post_id"],"title":"ChannelReadRequest"},"ChannelUnreadResponse":{"properties":{"count":{"type":"integer","title":"Count","description":"Posts after the caller's last read, not counting their own."}},"type":"object","required":["count"],"title":"ChannelUnreadResponse"},"DismissPattern":{"properties":{"role_id":{"type":"string","title":"Role Id"},"key":{"type":"string","pattern":"^[a-f0-9]{24}$","title":"Key"}},"type":"object","required":["role_id","key"],"title":"DismissPattern"},"EngineAccountOut":{"properties":{"engine":{"type":"string","enum":["native","claude_code","codex"],"title":"Engine"},"status":{"type":"string","enum":["none","pending","connected","error","revoked"],"title":"Status","default":"none"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"source":{"anyOf":[{"type":"string","enum":["worker","pasted","env"]},{"type":"null"}],"title":"Source"},"credential_kind":{"anyOf":[{"type":"string","enum":["token","api_key"]},{"type":"null"}],"title":"Credential Kind"},"connected_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected By User Id"},"connected_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected By Name"},"connected_by_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected By Email"},"connected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Connected At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"},"last_refreshed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Refreshed At"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"},"sign_in":{"anyOf":[{"$ref":"#/components/schemas/EngineSignInState"},{"type":"null"}]},"credential_source":{"type":"string","enum":["account","environment","none"],"title":"Credential Source","description":"What the engine's runs use now.\n\n``account``: the stored, connected row. ``environment``: the worker's\nenvironment token (only when there is no row at all). ``none``:\nnothing usable; a disconnected, failed or pending row blocks runs\nuntil someone reconnects.","readOnly":true}},"type":"object","required":["engine","credential_source"],"title":"EngineAccountOut","description":"The firm's stored sign-in for a CLI engine (never the credential itself)."},"EngineCredentialRequest":{"properties":{"credential":{"type":"string","maxLength":200000,"minLength":8,"title":"Credential","description":"Claude Code: the sk-ant-oat01-… token from `claude setup-token`, or with `kind = api_key` an Anthropic API key (sk-ant-api…). Codex: the full text of ~/.codex/auth.json after `codex login`, or with `kind = api_key` an OpenAI API key (sk-…)."},"label":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Label"},"kind":{"anyOf":[{"type":"string","enum":["token","api_key"]},{"type":"null"}],"title":"Kind","description":"`api_key` for a provider API key (recommended for automated work); omitted or `token` for a subscription sign-in."}},"type":"object","required":["credential"],"title":"EngineCredentialRequest","description":"Paste fallback: a token or auth file produced on a laptop, or an API key."},"EngineSignInCodeRequest":{"properties":{"code":{"type":"string","maxLength":4096,"minLength":1,"title":"Code"}},"type":"object","required":["code"],"title":"EngineSignInCodeRequest"},"EngineSignInState":{"properties":{"verification_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verification Url","description":"Open this in a browser and sign in to the firm account."},"user_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Code","description":"Codex: the one-time code to enter on that page."},"awaiting_code":{"type":"boolean","title":"Awaiting Code","description":"Claude Code: the browser showed a code instead of redirecting; paste it with POST /engines/{engine}/sign-in/code.","default":false},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"}},"type":"object","title":"EngineSignInState","description":"What a person must do to finish a sign-in running on the worker."},"EngineStatus":{"properties":{"engine":{"type":"string","enum":["native","claude_code","codex"],"title":"Engine"},"label":{"type":"string","title":"Label"},"available":{"type":"boolean","title":"Available","description":"The engine's CLI is installed on the worker (native: always)."},"signed_in":{"type":"boolean","title":"Signed In","description":"A firm account or key is configured for it."},"account_label":{"type":"string","title":"Account Label","default":""},"default_model":{"type":"string","title":"Default Model"},"models":{"items":{"type":"string"},"type":"array","title":"Models"},"staff_only":{"type":"boolean","title":"Staff Only","default":false},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"token_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Token Expires At"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"account":{"anyOf":[{"$ref":"#/components/schemas/EngineAccountOut"},{"type":"null"}]}},"type":"object","required":["engine","label","available","signed_in","default_model"],"title":"EngineStatus"},"EngineTestResult":{"properties":{"engine":{"type":"string","enum":["native","claude_code","codex"],"title":"Engine"},"state":{"type":"string","enum":["ok","failed","unverified","not_connected"],"title":"State"},"method":{"type":"string","enum":["provider_api","local_check","none"],"title":"Method","description":"`provider_api`: the provider's API was asked with the key. `local_check`: the token's format, expiry and last successful run were checked here; the worker proves it on the next run."},"message":{"type":"string","title":"Message"},"worker_online":{"type":"boolean","title":"Worker Online"},"checked_at":{"type":"string","format":"date-time","title":"Checked At"},"account":{"$ref":"#/components/schemas/EngineAccountOut"}},"type":"object","required":["engine","state","method","message","worker_online","checked_at","account"],"title":"EngineTestResult","description":"What ``POST /engines/{engine}/test`` found out about the credential."},"EnginesStatusResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/EngineStatus"},"type":"array","title":"Items"},"worker_online":{"type":"boolean","title":"Worker Online"},"worker_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Worker Detail"},"default_model":{"type":"string","title":"Default Model"},"workers":{"items":{"$ref":"#/components/schemas/WorkerStatus"},"type":"array","title":"Workers"}},"type":"object","required":["items","worker_online","default_model"],"title":"EnginesStatusResponse"},"LearnFromRun":{"properties":{"run_id":{"type":"string","title":"Run Id"}},"type":"object","required":["run_id"],"title":"LearnFromRun"},"LoginCreate":{"properties":{"scope":{"type":"string","enum":["business","firm"],"title":"Scope","default":"business"},"host":{"type":"string","maxLength":2048,"minLength":1,"title":"Host","description":"Host or URL of the sign-in page; stored as its exact host."},"username":{"type":"string","maxLength":512,"title":"Username","default":""},"password":{"type":"string","maxLength":1024,"minLength":1,"title":"Password"},"totp":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Totp","description":"Two-factor setup key (base32) or otpauth:// link."},"label":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Label"},"role_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Role Ids","description":"Roles that may use it; null = every role."}},"type":"object","required":["host","password"],"title":"LoginCreate","description":"Save a login; the same scope, host and username replaces the old one."},"LoginListResponse":{"properties":{"logins":{"items":{"$ref":"#/components/schemas/LoginOut"},"type":"array","title":"Logins"}},"type":"object","required":["logins"],"title":"LoginListResponse"},"LoginOut":{"properties":{"id":{"type":"string","title":"Id"},"scope":{"type":"string","enum":["business","firm"],"title":"Scope"},"host":{"type":"string","title":"Host","description":"Exact host the login is filled on."},"username":{"type":"string","title":"Username","default":""},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"has_totp":{"type":"boolean","title":"Has Totp","default":false},"role_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Role Ids","description":"Roles that may use it; null = every role."},"source":{"type":"string","enum":["settings","card","1password"],"title":"Source"},"read_only":{"type":"boolean","title":"Read Only","description":"True for 1Password rows (edit them in 1Password).","default":false},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"last_used_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Used At"}},"type":"object","required":["id","scope","host","source"],"title":"LoginOut","description":"A saved login, or a read-only row from the 1Password index."},"LoginUpdate":{"properties":{"username":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}],"title":"Username"},"password":{"anyOf":[{"type":"string","maxLength":1024,"minLength":1},{"type":"null"}],"title":"Password"},"totp":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Totp","description":"New two-factor key; an empty string removes it."},"label":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Label"},"role_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Role Ids"}},"type":"object","title":"LoginUpdate"},"MailCategoryUpdate":{"properties":{"category":{"anyOf":[{"type":"string","enum":["bills","receipts","payments","reports","documents","questions","updates","general"]},{"type":"null"}],"title":"Category"}},"type":"object","title":"MailCategoryUpdate"},"MailCompose":{"properties":{"to":{"type":"string","format":"email","title":"To"},"subject":{"type":"string","maxLength":998,"minLength":1,"title":"Subject"},"body":{"type":"string","maxLength":20000,"minLength":1,"title":"Body"}},"type":"object","required":["to","subject","body"],"title":"MailCompose"},"MailDecision":{"properties":{"content_hash":{"type":"string","maxLength":64,"minLength":64,"title":"Content Hash"}},"type":"object","required":["content_hash"],"title":"MailDecision"},"MailDraftUpdate":{"properties":{"body":{"type":"string","maxLength":20000,"minLength":1,"title":"Body"},"message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Id"}},"type":"object","required":["body"],"title":"MailDraftUpdate"},"MailGrantCreate":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"procedure_id":{"type":"string","title":"Procedure Id"},"job_id":{"type":"string","maxLength":40,"minLength":1,"title":"Job Id"},"response_mode":{"type":"string","enum":["draft","review","automatic"],"title":"Response Mode","default":"review"},"confirm_start":{"type":"boolean","title":"Confirm Start","default":false},"allowed_tools":{"items":{"type":"string"},"type":"array","maxItems":50,"minItems":1,"title":"Allowed Tools"},"browser_hosts":{"items":{"type":"string"},"type":"array","maxItems":30,"title":"Browser Hosts"}},"type":"object","required":["email","procedure_id","job_id","allowed_tools"],"title":"MailGrantCreate"},"MailReplyStart":{"properties":{"suggest_draft":{"type":"boolean","title":"Suggest Draft","default":false}},"type":"object","title":"MailReplyStart"},"MailSenderDecision":{"properties":{"status":{"type":"string","enum":["allowed","pending","blocked"],"title":"Status"},"whole_domain":{"type":"boolean","title":"Whole Domain","default":false}},"type":"object","required":["status"],"title":"MailSenderDecision"},"MailSenderLink":{"properties":{"contact_type":{"type":"string","enum":["vendor","contractor","employee","customer","team","other"],"title":"Contact Type"},"record_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Record Id"},"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"}},"type":"object","required":["contact_type"],"title":"MailSenderLink"},"MailSenderUpdate":{"properties":{"display_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Display Name"},"company":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Company"},"notes":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Notes"}},"type":"object","title":"MailSenderUpdate"},"MailTakeover":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"MailTakeover"},"MailboxUpdate":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"display_name":{"type":"string","maxLength":120,"minLength":1,"title":"Display Name"},"reminder_days":{"type":"integer","maximum":30.0,"minimum":1.0,"title":"Reminder Days","default":3},"max_reminders":{"type":"integer","maximum":5.0,"minimum":0.0,"title":"Max Reminders","default":0},"acknowledge_receipts":{"type":"boolean","title":"Acknowledge Receipts","default":false},"remove_promotions":{"type":"boolean","title":"Remove Promotions","default":false}},"type":"object","required":["enabled","display_name"],"title":"MailboxUpdate"},"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},"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"},"ProcedureDraft":{"properties":{"jobs":{"items":{"$ref":"#/components/schemas/ProcedureJob"},"type":"array","title":"Jobs"},"roles":{"items":{"$ref":"#/components/schemas/ProcedureRole"},"type":"array","title":"Roles"},"schedules":{"items":{"$ref":"#/components/schemas/ProcedureSchedule"},"type":"array","title":"Schedules"},"params":{"additionalProperties":true,"type":"object","title":"Params"},"notes":{"items":{"type":"string"},"type":"array","title":"Notes"}},"type":"object","title":"ProcedureDraft"},"ProcedureGenerateRequest":{"properties":{"source_text":{"type":"string","maxLength":400000,"minLength":20,"title":"Source Text"},"source_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Source Name"}},"type":"object","required":["source_text"],"title":"ProcedureGenerateRequest"},"ProcedureInstallResult":{"properties":{"procedure":{"$ref":"#/components/schemas/ProcedureOut"},"roles_created":{"items":{"type":"string"},"type":"array","title":"Roles Created"},"roles_updated":{"items":{"type":"string"},"type":"array","title":"Roles Updated"},"schedules_created":{"items":{"type":"string"},"type":"array","title":"Schedules Created"}},"type":"object","required":["procedure"],"title":"ProcedureInstallResult"},"ProcedureJob":{"properties":{"id":{"type":"string","maxLength":40,"minLength":1,"title":"Id","description":"Stable key, e.g. B4."},"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"role_key":{"type":"string","title":"Role Key","description":"Role-library key or the name of a role in this draft."},"cadence":{"type":"string","enum":["monthly_close","weekly","daily","on_event","once"],"title":"Cadence","default":"monthly_close"},"due_business_day":{"anyOf":[{"type":"integer","maximum":23.0,"minimum":1.0},{"type":"null"}],"title":"Due Business Day"},"level":{"type":"string","enum":["auto","gate","human"],"title":"Level","description":"auto: read-only work; gate: proposes changes; human: a person does it.","default":"gate"},"inputs":{"items":{"type":"string"},"type":"array","title":"Inputs"},"depends_on":{"items":{"type":"string"},"type":"array","maxItems":50,"title":"Depends On"},"outputs":{"items":{"type":"string"},"type":"array","title":"Outputs"},"done_when":{"type":"string","title":"Done When","default":""},"steps":{"items":{"type":"string"},"type":"array","title":"Steps"},"tools":{"items":{"type":"string"},"type":"array","title":"Tools"},"human_does":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Human Does"},"result_checks":{"items":{"$ref":"#/components/schemas/AgentResultCheck"},"type":"array","maxItems":10,"title":"Result Checks"},"checklist_item_key":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Checklist Item Key"}},"type":"object","required":["id","title","role_key"],"title":"ProcedureJob","description":"One job the SOP describes, mapped onto a role."},"ProcedureOut":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"type":"string","title":"Business Id"},"source_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Name"},"draft":{"$ref":"#/components/schemas/ProcedureDraft"},"version":{"type":"integer","title":"Version"},"installed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Installed At"},"installed":{"additionalProperties":true,"type":"object","title":"Installed"},"sop_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sop Id"},"sop_commit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sop Commit"},"sop_status":{"type":"string","enum":["in_sync","behind","unlinked"],"title":"Sop Status","default":"unlinked"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","business_id","draft","version","created_at","updated_at"],"title":"ProcedureOut"},"ProcedureRole":{"properties":{"key":{"type":"string","maxLength":64,"minLength":1,"title":"Key"},"name":{"type":"string","maxLength":80,"minLength":1,"title":"Name"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"instructions":{"type":"string","title":"Instructions","default":""},"scope":{"type":"string","enum":["read","changes"],"title":"Scope","default":"read"},"skills":{"items":{"$ref":"#/components/schemas/AgentSkill"},"type":"array","title":"Skills"},"library_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Library Key"},"browser":{"type":"boolean","title":"Browser","default":false}},"type":"object","required":["key","name"],"title":"ProcedureRole"},"ProcedureSchedule":{"properties":{"job_id":{"type":"string","title":"Job Id"},"cadence":{"type":"string","enum":["monthly_close","weekly","daily","on_event","once"],"title":"Cadence"},"due_business_day":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Due Business Day"},"cron":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cron"},"event":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event","description":"For on_event: plaid.sync.completed, stripe.payout.landed, ..."}},"type":"object","required":["job_id","cadence"],"title":"ProcedureSchedule"},"ProcedureUpdateRequest":{"properties":{"draft":{"$ref":"#/components/schemas/ProcedureDraft"}},"type":"object","required":["draft"],"title":"ProcedureUpdateRequest"},"RoleLibraryEntry":{"properties":{"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name"},"title":{"type":"string","title":"Title"},"summary":{"type":"string","title":"Summary"},"scope":{"type":"string","enum":["read","changes"],"title":"Scope"},"instructions":{"type":"string","title":"Instructions"},"skills":{"items":{"$ref":"#/components/schemas/AgentSkill"},"type":"array","title":"Skills"}},"type":"object","required":["key","name","title","summary","scope","instructions"],"title":"RoleLibraryEntry"},"RoleLibraryResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/RoleLibraryEntry"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"RoleLibraryResponse"},"SopCreateRequest":{"properties":{"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"slug":{"anyOf":[{"type":"string","maxLength":80,"pattern":"^[a-z0-9][a-z0-9-]*$"},{"type":"null"}],"title":"Slug"},"body_md":{"type":"string","maxLength":400000,"title":"Body Md","description":"Full markdown; empty starts from the template.","default":""},"status":{"type":"string","enum":["draft","live","retired"],"title":"Status","default":"draft"},"scope":{"type":"string","enum":["business","firm"],"title":"Scope","default":"business"}},"type":"object","required":["title"],"title":"SopCreateRequest"},"SopDetailOut":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"},"advisory_firm_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Advisory Firm Id"},"scope":{"type":"string","enum":["business","firm"],"title":"Scope"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner"},"effective":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective"},"status":{"type":"string","enum":["draft","live","retired"],"title":"Status"},"source":{"type":"string","enum":["manual","upload","template"],"title":"Source"},"editable":{"type":"boolean","title":"Editable","description":"Whether the caller may change this SOP: a business's own SOPs, or a firm SOP for the firm's owners and admins.","default":true},"jobs":{"items":{"$ref":"#/components/schemas/SopJobSummary"},"type":"array","title":"Jobs"},"procedure_count":{"type":"integer","title":"Procedure Count","default":0},"behind_count":{"type":"integer","title":"Behind Count","default":0},"paused_count":{"type":"integer","title":"Paused Count","default":0},"revision_count":{"type":"integer","title":"Revision Count","default":0},"created_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By User Id"},"archived":{"type":"boolean","title":"Archived","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"body_md":{"type":"string","title":"Body Md"},"front_matter":{"additionalProperties":true,"type":"object","title":"Front Matter"},"problems":{"items":{"type":"string"},"type":"array","title":"Problems","description":"Format problems a person should fix before generating a team."}},"type":"object","required":["id","scope","slug","title","status","source","created_at","updated_at","body_md"],"title":"SopDetailOut"},"SopDuplicateRequest":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Title"},"target_business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Business Id","description":"Target business to adopt or copy this SOP into (defaults to caller business)."}},"type":"object","title":"SopDuplicateRequest"},"SopFormatRequest":{"properties":{"title":{"type":"string","maxLength":200,"title":"Title","default":""},"body_md":{"type":"string","maxLength":400000,"minLength":1,"title":"Body Md"}},"type":"object","required":["body_md"],"title":"SopFormatRequest"},"SopFormatResponse":{"properties":{"body_md":{"type":"string","title":"Body Md"},"jobs":{"items":{"$ref":"#/components/schemas/SopJobSummary"},"type":"array","title":"Jobs"}},"type":"object","required":["body_md"],"title":"SopFormatResponse"},"SopGenerateRequest":{"properties":{"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"For a firm SOP: the client business to build the team in (default: the caller's)."},"discard_edits":{"type":"boolean","title":"Discard Edits","description":"Replace a team draft a person edited since it was generated (else 409 AGENT_017).","default":false}},"type":"object","title":"SopGenerateRequest","description":"Build (or update) the team for this SOP: jobs, roles, schedules."},"SopGenerationOut":{"properties":{"id":{"type":"string","title":"Id"},"sop_id":{"type":"string","title":"Sop Id"},"business_id":{"type":"string","title":"Business Id"},"procedure_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Procedure Id"},"mode":{"type":"string","enum":["create","update"],"title":"Mode"},"status":{"type":"string","enum":["running","succeeded","failed"],"title":"Status"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"sop_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sop Version"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"finished_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Finished At"},"procedure":{"anyOf":[{"$ref":"#/components/schemas/ProcedureOut"},{"type":"null"}]}},"type":"object","required":["id","sop_id","business_id","mode","status","created_at"],"title":"SopGenerationOut","description":"One team-generation job; poll until ``status`` is not ``running``."},"SopJobSummary":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner"},"level":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Level"},"when":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"When"}},"type":"object","required":["id","title"],"title":"SopJobSummary","description":"One ``## J-NN`` heading as parsed from the document."},"SopListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SopOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"SopListResponse"},"SopOut":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"},"advisory_firm_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Advisory Firm Id"},"scope":{"type":"string","enum":["business","firm"],"title":"Scope"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"owner":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner"},"effective":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective"},"status":{"type":"string","enum":["draft","live","retired"],"title":"Status"},"source":{"type":"string","enum":["manual","upload","template"],"title":"Source"},"editable":{"type":"boolean","title":"Editable","description":"Whether the caller may change this SOP: a business's own SOPs, or a firm SOP for the firm's owners and admins.","default":true},"jobs":{"items":{"$ref":"#/components/schemas/SopJobSummary"},"type":"array","title":"Jobs"},"procedure_count":{"type":"integer","title":"Procedure Count","default":0},"behind_count":{"type":"integer","title":"Behind Count","default":0},"paused_count":{"type":"integer","title":"Paused Count","default":0},"revision_count":{"type":"integer","title":"Revision Count","default":0},"created_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By User Id"},"archived":{"type":"boolean","title":"Archived","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","scope","slug","title","status","source","created_at","updated_at"],"title":"SopOut"},"SopRefreshRequest":{"properties":{"discard_edits":{"type":"boolean","title":"Discard Edits","description":"Replace a team draft a person edited since it was generated (else 409 AGENT_017).","default":false}},"type":"object","title":"SopRefreshRequest"},"SopRestoreRequest":{"properties":{"revision_id":{"type":"string","maxLength":64,"minLength":1,"title":"Revision Id"},"expected_updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expected Updated At","description":"The SOP's updated_at when the page loaded; 409 AGENT_015 when it changed since."}},"type":"object","required":["revision_id"],"title":"SopRestoreRequest"},"SopRevisionDetailOut":{"properties":{"id":{"type":"string","title":"Id"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"change_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Change Note"},"author_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author User Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"jobs_count":{"type":"integer","title":"Jobs Count","default":0},"current":{"type":"boolean","title":"Current","description":"This revision is the SOP's current text.","default":false},"body_md":{"type":"string","title":"Body Md"}},"type":"object","required":["id","created_at","body_md"],"title":"SopRevisionDetailOut"},"SopRevisionListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SopRevisionOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"SopRevisionListResponse"},"SopRevisionOut":{"properties":{"id":{"type":"string","title":"Id"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"change_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Change Note"},"author_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author User Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"jobs_count":{"type":"integer","title":"Jobs Count","default":0},"current":{"type":"boolean","title":"Current","description":"This revision is the SOP's current text.","default":false}},"type":"object","required":["id","created_at"],"title":"SopRevisionOut","description":"One saved version of an SOP (no text; see ``SopRevisionDetailOut``)."},"SopSuggestionListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SopSuggestionOut"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"SopSuggestionListResponse"},"SopSuggestionOut":{"properties":{"key":{"type":"string","title":"Key"},"title":{"type":"string","title":"Title"},"why":{"type":"string","title":"Why","description":"One line: the business signal behind it."},"template_key":{"type":"string","enum":["client_service","month_end_close","weekly_ap","daily_bank_feed","ar_collections","blank"],"title":"Template Key"},"owner_role":{"type":"string","title":"Owner Role","description":"Suggested owner role, as an SOP Owner line names it."},"owner_role_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Role Name","description":"The team role that fits the owner, when there is one."},"already_have":{"type":"boolean","title":"Already Have","description":"A draft or live SOP already covers it.","default":false},"sop_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sop Id","description":"That SOP, when already_have."}},"type":"object","required":["key","title","why","template_key","owner_role"],"title":"SopSuggestionOut","description":"An SOP worth writing for this business, from what it has connected and does."},"SopTeamsResumeOut":{"properties":{"resumed_procedures":{"type":"integer","title":"Resumed Procedures","default":0},"resumed_schedules":{"type":"integer","title":"Resumed Schedules","default":0}},"type":"object","title":"SopTeamsResumeOut"},"SopUpdateRequest":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Title"},"body_md":{"anyOf":[{"type":"string","maxLength":400000},{"type":"null"}],"title":"Body Md"},"status":{"anyOf":[{"type":"string","enum":["draft","live","retired"]},{"type":"null"}],"title":"Status"},"version":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Version","description":"Used when higher than the stored version; otherwise version_bump applies."},"owner":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Owner"},"effective":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Effective"},"change_note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Change Note"},"version_bump":{"anyOf":[{"type":"string","enum":["patch","minor","major","none"]},{"type":"null"}],"title":"Version Bump"},"expected_updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expected Updated At","description":"The SOP's updated_at when the editor opened; 409 AGENT_015 when it changed since. Omit to overwrite."}},"type":"object","title":"SopUpdateRequest","description":"Only the fields sent change; the document's front matter follows them.\n\n``body_md`` front matter counts as sent values for title, version, owner,\neffective and status. A save that changes nothing is a no-op (no new\nversion, no revision)."},"SopUploadResponse":{"properties":{"sop":{"$ref":"#/components/schemas/SopDetailOut"}},"type":"object","required":["sop"],"title":"SopUploadResponse"},"StaffLoginRoleOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"browser":{"type":"boolean","title":"Browser","default":false},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["id","name"],"title":"StaffLoginRoleOut","description":"A role on the business, for the Logins tab's role picker."},"StaffLoginScopeOut":{"properties":{"business_id":{"type":"string","title":"Business Id"},"business_name":{"type":"string","title":"Business Name"},"firm_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Firm Id","description":"The firm whose logins and vaults it also uses."},"firm_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Firm Name"},"roles":{"items":{"$ref":"#/components/schemas/StaffLoginRoleOut"},"type":"array","title":"Roles"}},"type":"object","required":["business_id","business_name"],"title":"StaffLoginScopeOut","description":"Whose logins a business's browser roles see: the business and its firm."},"SuccessEnvelope_AgentActivityResponse_":{"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/AgentActivityResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentActivityResponse]"},"SuccessEnvelope_AgentCardListResponse_":{"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/AgentCardListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentCardListResponse]"},"SuccessEnvelope_AgentCardOut_":{"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/AgentCardOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentCardOut]"},"SuccessEnvelope_AgentFirmOverviewResponse_":{"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/AgentFirmOverviewResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentFirmOverviewResponse]"},"SuccessEnvelope_AgentMcpUsageResponse_":{"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/AgentMcpUsageResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentMcpUsageResponse]"},"SuccessEnvelope_AgentPermissionGrantListResponse_":{"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/AgentPermissionGrantListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentPermissionGrantListResponse]"},"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]"},"SuccessEnvelope_AgentRoleOut_":{"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/AgentRoleOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentRoleOut]"},"SuccessEnvelope_AgentRunEventsResponse_":{"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/AgentRunEventsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentRunEventsResponse]"},"SuccessEnvelope_AgentRunListResponse_":{"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/AgentRunListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentRunListResponse]"},"SuccessEnvelope_AgentRunOut_":{"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/AgentRunOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentRunOut]"},"SuccessEnvelope_AgentSpendResponse_":{"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/AgentSpendResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentSpendResponse]"},"SuccessEnvelope_AgentTeamPauseResponse_":{"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/AgentTeamPauseResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentTeamPauseResponse]"},"SuccessEnvelope_AgentToolGroupsResponse_":{"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/AgentToolGroupsResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentToolGroupsResponse]"},"SuccessEnvelope_AgentVibeListResponse_":{"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/AgentVibeListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[AgentVibeListResponse]"},"SuccessEnvelope_BrowserSessionListResponse_":{"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/BrowserSessionListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[BrowserSessionListResponse]"},"SuccessEnvelope_ChannelPostListResponse_":{"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/ChannelPostListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ChannelPostListResponse]"},"SuccessEnvelope_ChannelPostOut_":{"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/ChannelPostOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ChannelPostOut]"},"SuccessEnvelope_ChannelPostResult_":{"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/ChannelPostResult"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ChannelPostResult]"},"SuccessEnvelope_ChannelReadOut_":{"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/ChannelReadOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ChannelReadOut]"},"SuccessEnvelope_ChannelUnreadResponse_":{"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/ChannelUnreadResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ChannelUnreadResponse]"},"SuccessEnvelope_EngineAccountOut_":{"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/EngineAccountOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[EngineAccountOut]"},"SuccessEnvelope_EngineTestResult_":{"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/EngineTestResult"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[EngineTestResult]"},"SuccessEnvelope_EnginesStatusResponse_":{"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/EnginesStatusResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[EnginesStatusResponse]"},"SuccessEnvelope_LoginListResponse_":{"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/LoginListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[LoginListResponse]"},"SuccessEnvelope_LoginOut_":{"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/LoginOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[LoginOut]"},"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]"},"SuccessEnvelope_ProcedureInstallResult_":{"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/ProcedureInstallResult"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ProcedureInstallResult]"},"SuccessEnvelope_ProcedureOut_":{"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/ProcedureOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[ProcedureOut]"},"SuccessEnvelope_RoleLibraryResponse_":{"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/RoleLibraryResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[RoleLibraryResponse]"},"SuccessEnvelope_SopDetailOut_":{"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/SopDetailOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopDetailOut]"},"SuccessEnvelope_SopFormatResponse_":{"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/SopFormatResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopFormatResponse]"},"SuccessEnvelope_SopGenerationOut_":{"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/SopGenerationOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopGenerationOut]"},"SuccessEnvelope_SopListResponse_":{"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/SopListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopListResponse]"},"SuccessEnvelope_SopRevisionDetailOut_":{"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/SopRevisionDetailOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopRevisionDetailOut]"},"SuccessEnvelope_SopRevisionListResponse_":{"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/SopRevisionListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopRevisionListResponse]"},"SuccessEnvelope_SopSuggestionListResponse_":{"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/SopSuggestionListResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopSuggestionListResponse]"},"SuccessEnvelope_SopTeamsResumeOut_":{"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/SopTeamsResumeOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopTeamsResumeOut]"},"SuccessEnvelope_SopUploadResponse_":{"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/SopUploadResponse"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[SopUploadResponse]"},"SuccessEnvelope_StaffLoginScopeOut_":{"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/StaffLoginScopeOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[StaffLoginScopeOut]"},"SuccessEnvelope_TeamDropboxBrowseOut_":{"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/TeamDropboxBrowseOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TeamDropboxBrowseOut]"},"SuccessEnvelope_TeamDropboxConnectOut_":{"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/TeamDropboxConnectOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TeamDropboxConnectOut]"},"SuccessEnvelope_TeamDropboxFolderDeleted_":{"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/TeamDropboxFolderDeleted"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TeamDropboxFolderDeleted]"},"SuccessEnvelope_TeamDropboxFolderListOut_":{"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/TeamDropboxFolderListOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TeamDropboxFolderListOut]"},"SuccessEnvelope_TeamDropboxFolderOut_":{"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/TeamDropboxFolderOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TeamDropboxFolderOut]"},"SuccessEnvelope_TeamDropboxStatusOut_":{"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/TeamDropboxStatusOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TeamDropboxStatusOut]"},"SuccessEnvelope_TeamVaultStatusOut_":{"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/TeamVaultStatusOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[TeamVaultStatusOut]"},"SuccessEnvelope_VaultStatusOut_":{"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/VaultStatusOut"},{"type":"null"}]}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[VaultStatusOut]"},"SuccessEnvelope_dict_str__Any__":{"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":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Data"}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[dict[str, Any]]"},"SuccessEnvelope_list_ProcedureOut__":{"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":[{"items":{"$ref":"#/components/schemas/ProcedureOut"},"type":"array"},{"type":"null"}],"title":"Data"}},"additionalProperties":true,"type":"object","title":"SuccessEnvelope[list[ProcedureOut]]"},"TeamDropboxAppCredentialsRequest":{"properties":{"app_key":{"type":"string","maxLength":200,"minLength":1,"title":"App Key"},"app_secret":{"type":"string","maxLength":200,"minLength":1,"title":"App Secret"}},"type":"object","required":["app_key","app_secret"],"title":"TeamDropboxAppCredentialsRequest"},"TeamDropboxBrowseOut":{"properties":{"path":{"type":"string","title":"Path"},"entries":{"items":{"$ref":"#/components/schemas/TeamDropboxEntryOut"},"type":"array","title":"Entries"},"truncated":{"type":"boolean","title":"Truncated","default":false}},"type":"object","required":["path","entries"],"title":"TeamDropboxBrowseOut","description":"One folder's children; the root of the team space is ``path = \"\"``."},"TeamDropboxConnectOut":{"properties":{"authorize_url":{"type":"string","title":"Authorize Url","description":"Open this to approve DayZero in Dropbox"},"redirect_uri":{"type":"string","title":"Redirect Uri"}},"type":"object","required":["authorize_url","redirect_uri"],"title":"TeamDropboxConnectOut"},"TeamDropboxEntryOut":{"properties":{"name":{"type":"string","title":"Name"},"path_display":{"type":"string","title":"Path Display"},"path_lower":{"type":"string","title":"Path Lower"},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"is_folder":{"type":"boolean","title":"Is Folder"}},"type":"object","required":["name","path_display","path_lower","is_folder"],"title":"TeamDropboxEntryOut"},"TeamDropboxFolderCreate":{"properties":{"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"The client business; omit for a shared folder"},"path":{"type":"string","maxLength":1024,"minLength":1,"title":"Path"},"label":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Label"}},"type":"object","required":["path"],"title":"TeamDropboxFolderCreate"},"TeamDropboxFolderDeleted":{"properties":{"id":{"type":"string","title":"Id"},"deleted":{"type":"boolean","title":"Deleted","default":true}},"type":"object","required":["id"],"title":"TeamDropboxFolderDeleted"},"TeamDropboxFolderListOut":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TeamDropboxFolderOut"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"TeamDropboxFolderListOut"},"TeamDropboxFolderOut":{"properties":{"id":{"type":"string","title":"Id"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"path_display":{"type":"string","title":"Path Display"},"path_lower":{"type":"string","title":"Path Lower"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"shared":{"type":"boolean","title":"Shared"},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["id","path_display","path_lower","shared"],"title":"TeamDropboxFolderOut"},"TeamDropboxStatusOut":{"properties":{"configured":{"type":"boolean","title":"Configured","description":"An app key and secret are set (entered here or in settings)"},"app_key_source":{"anyOf":[{"type":"string","enum":["admin","settings"]},{"type":"null"}],"title":"App Key Source"},"app_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Key","description":"The Dropbox app key"},"app_secret_last4":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Secret Last4","description":"Last four characters of the saved app secret (it is write-only)"},"redirect_uri":{"type":"string","title":"Redirect Uri","description":"Paste this into the Dropbox App Console's OAuth 2 redirect URIs"},"status":{"type":"string","enum":["disconnected","connected","error"],"title":"Status","default":"disconnected"},"connected":{"type":"boolean","title":"Connected","default":false},"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"team_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Name"},"root_namespace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Root Namespace Id"},"connected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Connected At"},"connected_by_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Connected By User Id"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"},"shared_folders":{"type":"integer","title":"Shared Folders","default":0},"mapped_businesses":{"type":"integer","title":"Mapped Businesses","default":0}},"type":"object","required":["configured","redirect_uri"],"title":"TeamDropboxStatusOut","description":"The team Dropbox connection as Admin > AI engines > Dropbox shows it."},"TeamVaultConnectRequest":{"properties":{"token":{"type":"string","maxLength":8192,"minLength":1,"title":"Token","description":"1Password service account token (ops_…)."}},"type":"object","required":["token"],"title":"TeamVaultConnectRequest"},"TeamVaultMapRequest":{"properties":{"business_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Business Id"},"firm_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Firm Id"}},"type":"object","title":"TeamVaultMapRequest","description":"Give a vault to one business or one firm (exactly one of the two)."},"TeamVaultMappingOut":{"properties":{"vault_id":{"type":"string","title":"Vault Id"},"scope":{"type":"string","enum":["business","firm"],"title":"Scope"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"},"firm_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Firm Id"},"name":{"type":"string","title":"Name","description":"The business's or firm's name.","default":""}},"type":"object","required":["vault_id","scope"],"title":"TeamVaultMappingOut","description":"Who one team vault is given to: a business or a firm."},"TeamVaultOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"items":{"type":"integer","title":"Items","description":"Logins in the index from this vault.","default":0},"mapping":{"anyOf":[{"$ref":"#/components/schemas/TeamVaultMappingOut"},{"type":"null"}]}},"type":"object","required":["id","title"],"title":"TeamVaultOut","description":"One vault the team's service account reads, and who it is mapped to."},"TeamVaultStatusOut":{"properties":{"provider":{"type":"string","const":"1password","title":"Provider","default":"1password"},"connected":{"type":"boolean","title":"Connected","default":false},"status":{"anyOf":[{"type":"string","enum":["connected","error"]},{"type":"null"}],"title":"Status"},"vaults":{"items":{"$ref":"#/components/schemas/TeamVaultOut"},"type":"array","title":"Vaults"},"items":{"type":"integer","title":"Items","description":"Login items in the index.","default":0},"refreshed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Refreshed At"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"}},"type":"object","title":"TeamVaultStatusOut","description":"DayZero's 1Password service account (never the token)."},"VaultConnectRequest":{"properties":{"scope":{"type":"string","enum":["business","firm"],"title":"Scope","default":"business"},"token":{"type":"string","maxLength":8192,"minLength":1,"title":"Token","description":"1Password service account token (ops_…)."},"role_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Role Ids","description":"Roles that may use the vault; null = every role."}},"type":"object","required":["token"],"title":"VaultConnectRequest"},"VaultStatusOut":{"properties":{"scope":{"type":"string","enum":["business","firm"],"title":"Scope"},"provider":{"type":"string","const":"1password","title":"Provider","default":"1password"},"connected":{"type":"boolean","title":"Connected","default":false},"status":{"anyOf":[{"type":"string","enum":["connected","error"]},{"type":"null"}],"title":"Status"},"vaults":{"items":{"type":"string"},"type":"array","title":"Vaults","description":"Vault titles."},"items":{"type":"integer","title":"Items","description":"Login items in the index.","default":0},"refreshed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Refreshed At"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"},"role_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Role Ids"}},"type":"object","required":["scope"],"title":"VaultStatusOut","description":"The 1Password connection for one scope (never the token)."},"WorkerStatus":{"properties":{"profile":{"type":"string","enum":["agents","browser"],"title":"Profile"},"host":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host"},"at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"At","description":"Last heartbeat."},"online":{"type":"boolean","title":"Online","default":false},"browser_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Browser Version","description":"Chromium version (browser worker only)."}},"type":"object","required":["profile"],"title":"WorkerStatus","description":"One agents worker profile's last heartbeat."},"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":[]}]}