openapi: 3.0.3 info: title: Crios Orchestrator API description: | HTTP API served by the Crios Go orchestrator (cmd/orchestrator). Routes are registered with gorilla/mux. Paths in this document are relative to the default server, which already ends in `/api/v1`; path items served elsewhere carry their own `servers` override. There are three planes. **Authenticated API: `/api/v1/*`.** Almost every endpoint, including the session WebSocket (`/api/v1/ws`), WebRTC (`/api/v1/webrtc/ice-servers`, `/api/v1/sessions/{id}/webrtc/offer`), organization switching (`POST /api/v1/auth/switch-org`), the workflow engine (`/api/v1/workflows/*`) and the git provider proxies `/api/v1/repos/*` (GitHub; limited to the repositories of GitHub projects the caller can access), `/api/v1/gitlab/{path}` (one catch-all route; limited to the GitLab projects behind projects the caller can access) and `/api/v1/gitea/*` (limited to the built-in repositories of projects the caller can access). **Public routes under `/api/v1`.** Registered on the root router ahead of the authenticated subrouter, so they take no bearer token; each relies on its own credential: - webhook receivers `/api/v1/webhooks/{github,jira,slack}`, `/api/v1/webhooks/slack/interactions` and their per-organization `.../{orgID}` variants: the provider's HMAC signature over the raw body; they fail closed with 503 when the secret is not configured; - OAuth callbacks `/api/v1/integrations/oauth/callback`, `/api/v1/mcp/oauth/callback` and `/api/v1/workflows/oauth2/callback`: a single-use server-side state row; - `/api/v1/integrations/gmail/callback` and `/api/v1/connectors/github/app/{created,installed}`: an HMAC-signed, short-lived `state`; - `/api/v1/spectate/{token}/*`: the session share token; - `POST /api/v1/auth/refresh` (back-compat twin of `/auth/refresh`): the refresh token. **Root routes outside `/api/v1`.** - `/auth/*`: login, logout, register, token refresh, MFA steps, password reset, email verification, invitation lookup and accept, login-page config and OIDC SSO (`/auth/oidc/login`, `/auth/oidc/callback`). Public and rate-limited per client IP. - `/healthz` and `/readyz`: public probes. Their `/api/v1` twins require a token. - Workflow public routes: `POST /workflows/resume/{token}` (the single-use resume token); `GET` and `POST /workflows/form/{executionID}/{signal}` (a parked form node's page; the open wait is the credential and one submission consumes it); `GET /workflows/artifacts/{id}` and `PUT /workflows/artifacts` (a short-lived HMAC signature in the query). - Workflow webhook ingress `/hooks/{path}`: each route applies its trigger's auth policy (none, HMAC, API key or bearer, or an app trigger's own signature check). There is no test listener: the `/hooks-test/{path}` mount was removed (it answers 404). **Workflow availability.** Every workflow route — `/api/v1/workflows/…` (including the execution WebSocket), `/hooks/…` and the public `/workflows/…` routes — answers `503` with `{"error": "workflow engine unavailable", "code": "workflow_unavailable", "reason": "…"}` and `Retry-After: 30` while the workflow engine cannot serve: when it is disabled on the deployment, or while its database is not yet connected after the orchestrator started (that case clears by itself). Prometheus metrics are served only on a separate internal listener, not on this API. ## Authentication Send `Authorization: Bearer ` with either the access JWT from `/auth/login` (renewed through `/auth/refresh`) or a personal API token (`crios_pat_…`), whose scopes limit what it may call. Public routes are annotated with `security: []`. A request may carry `X-Crios-Require-Connected-App: 1` to be served only as an app connected through the Crios MCP server (an OAuth token, or a personal access token or browser token whose `X-Crios-MCP-Gateway` header carries the orchestrator's own secret). The auth middleware checks it on every `/api/v1` route, right after authentication and before any handler: any value but exactly `1` answers 400 `invalid_require_connected_app`, and a request it does not take as a connected app's answers 403 `connected_app_not_recognised` with nothing run (parameter `RequireConnectedApp`, responses `RequireConnectedAppInvalid` and `ConnectedAppNotRecognised`). Without the header nothing changes. The MCP server sends it on the writes of `skill_create` and `skill_update`. ## Authorization Every `/api/v1/*` request passes the auth middleware, the suspended-user check, the membership check, personal-API-token scope enforcement and the object-level access checks for sessions and projects. A token whose organization no longer counts the user as a member answers 401 `{"error": "you are no longer a member of this organization", "code": "org_membership_revoked"}`, within about 30 seconds of the removal (the check is cached per instance), so removing a member cuts their access before their token expires. The creator of a session in a project keeps access to it only while still a member of that project's organization. Mutating methods (POST, PUT, PATCH, DELETE) answer 403 for viewer-role users, except an allow-list of read-shaped POSTs (knowledge and memory queries, workflow and agent validation, the builder's option pickers, artifact download URLs) and per-account self-service writes (profile, password, avatar, API tokens, two-factor setup, organization switching, accepting an invitation, the caller's own connected accounts and Telegram links). `/api/v1/admin/*` requires the instance-admin flag (browser session tokens only; personal API tokens and sandbox tokens never qualify). MCP server writes (`/mcp-servers`) need the org owner/admin role, while a person's own MCP connections (`/mcp/connections`) are self-service (viewers and sandbox tokens excepted). `/api/v1/organizations/{id}/*` requires `{id}` to be the caller's active organization, and most of it needs org owner/admin. Workflow routes are project-scoped: reads need viewer access to the owning project and writes need editor access. Each operation states its own requirement. ## Limits - Request bodies are capped at 32 MiB; multipart uploads are exempt and enforce their own per-file caps. - Rate limits are token buckets: `/auth/*` 10 requests per minute (except `GET /auth/config`, which has the general limit); session creation 20 per minute; `/api/v1/admin/*` 2 per second (burst 100); token refresh 5 per second (burst 60); everything else about 17 per second (burst 200). A refused request answers 429 `{"error": "rate limit exceeded", "retry_after": 1}`. - A call with a personal access token, an OAuth token or a connected app draws from its user's buckets in that organization, from any address. Every other call draws from its client IP's: a browser session, a sandbox token, and the routes limited before the caller is authenticated, `/auth/*` and token refresh among them. - Changing your password, resending the verification email, the TOTP routes that check a code (enable, disable, new backup codes) and switching organizations share the `/auth/*` limit of 10 a minute. Only a user's own browser session may use them, and its calls draw from its client IP's bucket, the one `/auth/*` uses at that address. An API token (a personal access token or an OAuth token) gets 403 on all of them before any limit, except a full-access one on switch-org that isn't bound to a project: that call counts against its user's bucket before the handler refuses it. - License gate: on an enforce-mode deployment whose license no longer allows new work, POST, PUT and PATCH answer 402 with `{error, code, state, reason, renew_url}` (`code` is `license_expired`, `license_missing` or `license_invalid`). Reads and DELETE always pass, and license installation, read-shaped queries and account self-service stay open. version: 1.4.71 servers: - url: https://api.crios.ai/api/v1 description: Production - url: http://localhost:8080/api/v1 description: Local development security: - bearerAuth: [] tags: - name: Auth description: Login, registration, token refresh, MFA/TOTP, OIDC (root /auth subrouter) - name: Sessions description: Coding session lifecycle, events, control - name: Multi-Agent description: Session decomposition, subsessions, workers - name: Projects description: Project CRUD, sessions, memory, snapshots - name: Organizations description: Organization read, members, invitations, groups, settings, usage console and export (mostly org owner/admin) - name: PDF Signing description: PAdES signatures with an organization's signing identities (ch. 43). Every route answers 404 unless the licence has pdf-signing and the organization has the signing.pdf flag. PAT scope signing. - name: Users description: Current-user profile and preferences (language, theme, list layouts), avatar, TOTP self-service, pins, email verification and personal API tokens - name: Sandboxes description: Sandbox lifecycle (exec and checkpoints are not implemented and answer 501) - name: Playbooks description: | Reusable instruction templates and suggestion queue, from before the Team Playbook, which replaced their page. No suggestion is captured since then; those captured before stay. A playbook that belongs to a project (scope `project` or `session_type`) follows that project's access rules: listing or reading it takes view access to the project, and creating, editing, reverting or deleting it takes edit access. Without any access to the project the answer is 404, the same as for a missing playbook; view access alone on a write is 403. Organization-wide playbooks are open to every member of the organization. - name: Knowledge description: | Knowledge base entries and folders. An entry that belongs to a project follows that project's access rules: listing, reading or searching it takes view access to the project, and creating, editing or deleting it takes edit access. Without any access to the project the answer is 404, the same as for a missing entry; view access alone on a write is 403. The folder routes and `POST /knowledge/query` apply the same rule to the `project_id` they name. Organization-wide entries are open to every member of the organization. - name: Review description: Self-review, security check, PR review, diff stats, auto-fix - name: Preview description: Live preview lifecycle and framework detection - name: LLM description: LLM gateway chat and routing snapshot - name: Costs description: Cost and usage reporting - name: Attachments description: Session file attachments - name: Intake description: External intake inbox (Jira/GitHub/Slack tickets) - name: Integrations description: Slack/Jira agent-facing proxies and channel links - name: MCP description: The organization's MCP server registry, a person's own MCP connections (connector-catalog services and custom servers) with their access levels, and the proxy - name: Connectors description: Per-organization connector configuration (GitHub App or device flow, GitLab, Slack, Jira; org owner/admin), the connector catalog, and member repo browsing - name: Authenticator description: Shared TOTP authenticator keys for an organization (owner/admin). The setup key is stored in Vault and is never returned; a code is computed when asked. - name: Webhooks description: Inbound webhook receivers (GitHub/Jira/Slack) - name: Spectate description: Public read-only session spectator endpoints - name: WebRTC description: WebRTC signaling for live browser stream - name: Admin description: Instance-admin operations (/api/v1/admin). Requires the instance-admin flag on a browser session token; personal API tokens and sandbox tokens never qualify. - name: Health description: Health and readiness probes - name: Git description: Git provider proxies (GitHub/GitLab/Gitea) - name: Licensing description: License status for the deployment (powers the grace banner and renew modal) - name: Publishing description: Publish a project to a custom domain (managed build, deploy, DNS and TLS pipeline) - name: Workflows description: Workflow definitions (CRUD, version history, diff and restore, activation, draft fixtures, validation, tag vocabulary). Access is project-scoped; reads need viewer access to the owning project and writes need editor access (project owners hold manage, org owners and admins hold manage on every project of their org, org-role viewers are read-only). Unknown and inaccessible resources both answer 404. Handler errors carry the envelope {error, code} (schema WorkflowApiError). - name: Workflow Executions description: Start runs, list and inspect executions, read the step journal, cancel and retry, listen live, and read LLM usage - name: Workflow Approvals description: Approval requests raised by running workflows, and their decisions - name: Workflow Dead Letters description: The dead-letter queue of failed executions (list, delete, redrive) - name: Workflow Budgets description: Operational spend caps, editable without a new version - name: Workflow Agents description: Stored agents (definitions, versions, activation, archive, chat runs, stats, cards) - name: Workflow Generation description: Prompt-to-workflow, prompt-to-agent and single-field generation - name: Workflow Node Types description: The node-type registry (descriptors, parameter schemas, dynamic option resolvers) - name: Workflow Templates description: The organization template gallery and template instantiation - name: Workflow Credentials description: Project connections (workflow credentials) that nodes bind, and their OAuth2 connect flows. Never returns secret material. Errors carry a stable code (schema WorkflowApiError). - name: Workflow Connector Catalog description: The deployment-wide connector catalog, per-type usage counts and application OAuth clients. Writes, usage and the OAuth clients require an instance admin who is also owner or admin of the active organization. - name: Workflow Telegram description: Telegram bots that workflow nodes send through, the chats they have seen and the links between Crios users and a bot. Separate from the Session/Chat Telegram connector. - name: Workflow Data Stores description: Managed data stores. Each store is a table in the project's own database (never the control plane) plus a minted postgres connection that database nodes bind. - name: Workflow Memory description: Browse, edit, lock and purge what agents and memory nodes have stored, and prepare the memory tables behind a bound connection. - name: Workflow Variables description: Workflow variables (vars in expressions) with per-project overrides. Stored outside the definition, so an edit never creates a version. - name: Workflow Triggers description: Trigger health and the public webhook ingress (/hooks). - name: Workflow Waits description: Resolving parked executions through named signals, single-use resume tokens and hosted form pages. - name: Workflow Artifacts description: Short-lived HMAC-signed URLs that read and upload workflow artifact bytes. - name: Session Data description: Per-session database connections, browsing and read-only queries (workspace Data tab), and the project database - name: Discussion description: Project discussion channel (messages, live stream, agents, decisions, read state) - name: Tasks description: Project tasks, the lightweight work items of the discussion channel - name: Collectors description: Project document sources (RSS, HTTP JSON APIs, database change capture), the source scout, and the per-project signal pipeline controls - name: License Watch description: Open-source license compliance for a project's dependency manifests (inventory, policy, findings) - name: Skills description: Skill packages (prompt, agent profile, workflow, tool, connector, code, composite), their lifecycle, and per-project attachment - name: LLM Providers description: Per-organization LLM stack, org admin only (providers, model catalog and sync status, routing table) - name: Integrations Hub description: Personal third-party accounts (Google, X, Instagram, Jira, Slack, Facebook, TikTok, Discord) with OAuth connect (one product, or several of a family in one sign-in), access levels, account management, activity log and the unified invoke endpoint components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT parameters: SessionId: name: id in: path required: true description: Session ID schema: { type: string, format: uuid } ProjectId: name: id in: path required: true description: Project ID schema: { type: string, format: uuid } OrgId: name: id in: path required: true description: Organization ID schema: { type: string, format: uuid } SigningIdentityId: name: sid in: path required: true description: Signing identity ID schema: { type: string, format: uuid } RequireConnectedApp: name: X-Crios-Require-Connected-App in: header required: false description: | `1` asks the orchestrator to serve the request only as an app connected through the Crios MCP server: an OAuth token, or a personal access token or browser token whose `X-Crios-MCP-Gateway` header carries the orchestrator's own secret. Checked by the auth middleware on every `/api/v1` route, on the API-token and the JWT path alike, after authentication (an unauthenticated request is still 401) and before any handler. Any other value (empty, `true`, `0`, surrounding spaces, the header twice) answers 400 `invalid_require_connected_app`; with `1`, a request the orchestrator does not take as a connected app's (a gateway header that is missing or does not match, an orchestrator with no secret of its own, a sandbox token whatever its header) answers 403 `connected_app_not_recognised`, and nothing runs. Absent, nothing changes. The MCP server sends it on `skill_create`'s `POST /skills` and `skill_update`'s `PATCH /skills/{id}`, so a gateway secret that changed after its `GET /users/me/token` check refuses the write instead of letting it through as a plain script's. An orchestrator from before this header ignores it. schema: { type: string, enum: ['1'] } responses: RequireConnectedAppInvalid: description: '`X-Crios-Require-Connected-App` carries something other than exactly `1` (code invalid_require_connected_app). Nothing ran' content: application/json: schema: type: object properties: error: { type: string, enum: ['invalid X-Crios-Require-Connected-App header'] } code: { type: string, enum: [invalid_require_connected_app] } example: { error: 'invalid X-Crios-Require-Connected-App header', code: invalid_require_connected_app } ConnectedAppNotRecognised: description: '`X-Crios-Require-Connected-App: 1`, and the orchestrator did not take the request as coming from the Crios MCP server (code connected_app_not_recognised): the two `CRIOS_MCP_GATEWAY_SECRET` values differ, or the token is a sandbox token. Answered before any handler; nothing ran and no audit row was written' content: application/json: schema: type: object properties: error: { type: string, enum: ['Crios did not recognise this request as coming from its MCP server'] } code: { type: string, enum: [connected_app_not_recognised] } example: { error: 'Crios did not recognise this request as coming from its MCP server', code: connected_app_not_recognised } BadRequest: description: Invalid request body or parameters content: application/json: schema: { $ref: '#/components/schemas/Error' } Unauthorized: description: Missing or invalid credentials, or the user is no longer a member of the token's organization (code org_membership_revoked) content: application/json: schema: { $ref: '#/components/schemas/Error' } Forbidden: description: Authenticated but not permitted (viewer/non-admin) content: application/json: schema: { $ref: '#/components/schemas/Error' } NotFound: description: Resource not found (or not owned by caller) content: application/json: schema: { $ref: '#/components/schemas/Error' } SigningNotFound: description: Signing is not enabled here (no signing service, the licence lacks pdf-signing, or the organization lacks signing.pdf), or no such identity in this organization (code not_found) content: application/json: schema: { $ref: '#/components/schemas/SigningError' } SigningBadRequest: description: A malformed body, or one the signing service refuses (invalid_name, unknown_provider, unknown_algorithm, cannot_generate, immutable, invalid_subject, bad_certificate, bad_policy, bad_url, …) content: application/json: schema: { $ref: '#/components/schemas/SigningError' } SigningUnavailable: description: The signing service is unavailable (code signing_unavailable); a key holder that could not be reached while answering is reported the same way content: application/json: schema: { $ref: '#/components/schemas/SigningError' } schemas: SigningSignOptions: type: object description: The options part of POST /projects/{id}/signing/sign (ch. 43 §8.5, §6.8). required: [identity_id] properties: identity_id: { type: string, format: uuid } level: { type: string, enum: [B-B, B-T, B-LT, B-LTA], description: 'Default: the identity''s.' } reason: { type: string } location: { type: string } contact_info: { type: string } field_name: { type: string, description: 'An existing empty signature field (signed at its own rectangle and page), or the name of a new one.' } page: { type: integer, minimum: 1, description: 'The page of a new field. Default 1.' } appearance: { $ref: '#/components/schemas/SigningAppearance' } certification: { type: boolean, description: 'A certification (DocMDP) signature with P=2 unless certification_permissions says otherwise.' } certification_permissions: { type: integer, enum: [1, 2, 3], description: '1 no changes, 2 form filling and signing, 3 also annotations. Implies certification.' } tsa_url: { type: string, format: uri, description: 'An RFC 3161 timestamp authority for this signature, in place of the identity''s default.' } tsa_policy_oid: { type: string, description: 'The reqPolicy that TSA requires.' } display_name: { type: string, description: 'A name for the document, recorded with the attempt (a file name you choose).' } idempotency_key: { type: string, description: 'As the Idempotency-Key header, which wins when both are sent.' } SigningAppearance: type: object description: A visible signature. Lengths are in points (1/72 inch). properties: rect: { type: array, items: { type: number }, minItems: 4, maxItems: 4, description: '[llx, lly, urx, ury] in the page''s default user space (before /Rotate). Wins over position.' } position: { type: string, enum: [top-left, top-center, top-right, center, bottom-left, bottom-center, bottom-right], description: 'As the page is displayed. Default bottom-right.' } width: { type: number, description: 'Default 200.' } height: { type: number, description: 'Default 60.' } margin: { type: number, description: 'From the visible edges. Default 36.' } template: { type: string, maxLength: 1024, description: 'One line per newline, with {{signer}}, {{date}}, {{reason}} and {{location}}; a line whose placeholders are all empty is left out. Text in Latin (Turkish included), Simplified Chinese (GB 2312), Japanese (JIS X 0208) and Korean (KS X 1001 Hangul) is drawn; Devanagari is refused until text shaping exists.' } no_text: { type: boolean, description: 'Draw the image alone.' } no_border: { type: boolean } SigningError: type: object description: A refusal from the signing routes. `code` is stable; `error` is the service's message. properties: code: { type: string, description: 'e.g. name_taken, certificate_refused, sign_refused, sign_failed, already_signed, in_progress, no_grant, signing_unavailable' } error: { type: string } rule: { type: string, description: 'The rule that refused it: for certificate_refused one of key_mismatch, revoked, expired, key_usage, algorithm, chain; for sign_refused the policy rule (levels, reasons, max_document_bytes, per_minute, per_day, require_visible, require_timestamp, allow_certification, status, …)' } log_id: { type: string, description: 'The signing-log row of a refused or failed signature' } SigningAuditFact: type: object description: An audit row the orchestrator wrote for this request (ch. 43 §8.7), echoed in the answer of some identity actions. Facts only. properties: action: { type: string, example: signing.certificate.install } target_type: { type: string, enum: [signing_identity, signing_identity_grant, signer_agent, signing_trust_anchor, organization, workflow_credential] } target_id: { type: string } project_id: { type: string } before: { type: object, nullable: true, additionalProperties: true } after: { type: object, nullable: true, additionalProperties: true } SigningProviderForm: type: object description: A key holder's credential form (ch. 43 §8.2), declared by the signing service. required: [provider, settings_schema, secrets_schema] properties: provider: { type: string, enum: [alikms, awskms, azurekv, gcpkms, softkey], description: 'softkey is a development key holder, listed only where development identities are allowed' } settings_schema: { type: object, additionalProperties: true, description: 'JSON Schema of `settings`: where the key is (a versioned key name, an ARN, a key URL, an instance endpoint) and optional endpoints' } secrets_schema: { type: object, additionalProperties: true, description: 'JSON Schema of `secrets`: the credential. Every property carries `x-secret: true`; secrets are write-only and never returned' } dev: { type: boolean, description: 'A development provider' } SigningPolicy: type: object description: What an identity allows (ch. 43 §8.3). A zero or absent value allows. properties: levels: { type: array, items: { type: string, enum: [B-B, B-T, B-LT, B-LTA] }, description: 'Levels it signs at. Empty: all' } max_document_bytes: { type: integer, format: int64, description: "Largest document. 0: the service's limit" } per_minute: { type: integer, description: 'Signatures per minute. 0: no limit of its own' } per_day: { type: integer, description: 'Signatures per day. 0: no limit of its own' } allow_certification: { type: boolean, description: 'Permits certification (DocMDP) signatures' } reasons: { type: array, items: { type: string }, description: 'When set, a /Reason must be one of these' } require_visible: { type: boolean, description: 'Refuses an invisible signature' } require_timestamp: { type: boolean, description: 'Refuses a signature below B-T' } SigningDefaults: type: object description: What a signature uses when the call does not say. properties: level: { type: string, enum: [B-B, B-T, B-LT, B-LTA] } tsa_url: { type: string, format: uri, description: 'RFC 3161 timestamp authority, needed for B-T and above' } reason: { type: string } location: { type: string } contact_info: { type: string } SigningCertificateInfo: type: object description: The installed certificate. Audit rows name it by serial, issuer key hash and fingerprint; only this answer, for the organization's admins, carries the subject. properties: subject: { type: string } serial: { type: string, description: Hex } issuer_key_hash: { type: string, description: 'The issuer''s key identifier, hex' } fingerprint_sha256: { type: string, description: Hex } not_before: { type: string, format: date-time } not_after: { type: string, format: date-time } chain_length: { type: integer, description: 'Certificates in the chain after the leaf' } SigningIdentity: type: object description: A signing identity (ch. 43 §8.1) — one key in a key holder and its certificate. Never carries a credential. properties: id: { type: string, format: uuid } organization_id: { type: string, format: uuid } name: { type: string, maxLength: 100 } provider: { type: string, enum: [alikms, awskms, azurekv, gcpkms, softkey] } key_ref: { type: string, description: 'The key as its key holder names it: an ARN, a key version resource name, a versioned key URL' } algorithm: { type: string, example: ECDSA-P256-SHA256, description: 'RSA-PSS-SHA256/384/512, RSA-PKCS1-SHA256/384/512, ECDSA-P256-SHA256, ECDSA-P384-SHA384, ECDSA-P521-SHA512' } settings: { type: object, additionalProperties: true, description: 'The provider settings (no secret)' } has_credential: { type: boolean, description: 'A credential is stored (it is never returned)' } status: { type: string, enum: [pending_certificate, active, unavailable, expired, revoked, disabled] } status_reason: { type: string, description: 'Why it left active: certificate_expired, certificate_revoked, key_not_found, credential_rejected, or an admin''s reason' } protection: { type: string, enum: [software, hsm, external, unknown], description: 'Where the key lives, as the key holder reports it — not a certification' } certificate: { $ref: '#/components/schemas/SigningCertificateInfo' } defaults: { $ref: '#/components/schemas/SigningDefaults' } policy: { $ref: '#/components/schemas/SigningPolicy' } created_by: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } SigningIdentityInput: type: object description: Creates (POST) or edits (PATCH) an identity. `secrets` are write-only. properties: name: { type: string, minLength: 1, maxLength: 100, description: 'Required on create' } provider: { type: string, enum: [alikms, awskms, azurekv, gcpkms, softkey], description: 'Create only; required' } key_ref: { type: string, description: 'Create only. Usually left out: the key holder names the key from `settings`' } algorithm: { type: string, description: 'Create only. One the key supports; default the key''s first' } settings: { type: object, additionalProperties: true, description: 'Per the provider''s settings_schema' } secrets: { type: object, additionalProperties: { type: string }, description: 'Per the provider''s secrets_schema. Stored at the signing service''s Vault path, never returned; on PATCH, replaces the stored credential' } generate_key: { type: boolean, description: 'Create only: the service generates a development key (softkey only)' } defaults: { $ref: '#/components/schemas/SigningDefaults' } policy: { $ref: '#/components/schemas/SigningPolicy' } SigningIdentityResult: type: object properties: identity: { $ref: '#/components/schemas/SigningIdentity' } audit: { type: array, items: { $ref: '#/components/schemas/SigningAuditFact' } } SigningSwitchInput: type: object properties: reason: { type: string, description: 'Recorded in the audit row and as the status reason' } SigningCSRInput: type: object required: [subject] properties: subject: type: object required: [common_name] properties: common_name: { type: string } organization: { type: string } organizational_unit: { type: string } country: { type: string, minLength: 2, maxLength: 2 } locality: { type: string } province: { type: string } serial_number: { type: string } dns_names: { type: array, items: { type: string } } email_addresses: { type: array, items: { type: string, format: email } } SigningCSRResult: type: object properties: csr_pem: { type: string, description: 'PKCS#10, PEM' } attestation: { type: string, format: byte, description: 'The key holder''s key attestation, when it gives one' } audit: { type: array, items: { $ref: '#/components/schemas/SigningAuditFact' } } SigningCertificateInput: type: object required: [certificate_pem] properties: certificate_pem: { type: string, description: 'The leaf certificate, PEM' } chain_pem: { type: string, description: 'Its chain, PEM, each certificate issued by the next' } SigningCertificateResult: type: object properties: identity: { $ref: '#/components/schemas/SigningIdentity' } warnings: { type: array, items: { type: string }, description: 'What did not refuse the install, such as a certificate without an OCSP or CRL pointer' } audit: { type: array, items: { $ref: '#/components/schemas/SigningAuditFact' } } SigningTestResult: type: object properties: ok: { type: boolean } stage: { type: string, enum: [open, algorithm, probe, sign, verify, tsa], description: 'Where a failed test stopped' } error: { type: string, enum: [credential, key_not_found, rate_limited, device_removed, unavailable, policy_denied, pending, invalid_request, other], description: 'The key holder''s error kind' } audit: { type: array, items: { $ref: '#/components/schemas/SigningAuditFact' } } SigningGrant: type: object properties: identity_id: { type: string, format: uuid } project_id: { type: string, format: uuid } credential_id: { type: string, format: uuid, description: 'The project''s minted signing_identity connection' } granted_by: { type: string } created_at: { type: string, format: date-time } SigningLogEntry: type: object description: A signing-log row (ch. 43 §8.4). Hash-chained per organization. properties: id: { type: string, format: uuid } organization_id: { type: string, format: uuid } seq: { type: integer, format: int64, description: 'Position in the organization''s chain' } kind: { type: string, enum: [started, succeeded, failed, abandoned] } closes: { type: string, format: uuid, description: 'An outcome row: the started row it closes' } retry_of: { type: string, format: uuid } project_id: { type: string, format: uuid } identity_id: { type: string, format: uuid } actor: { type: object, additionalProperties: true, description: 'Who asked: the user, the token, the workflow run and node' } operation: { type: string, enum: [sign, augment] } input_sha256: { type: string } output_sha256: { type: string } size: { type: integer, format: int64 } level: { type: string, enum: [B-B, B-T, B-LT, B-LTA] } signature_algorithm: { type: string } cert_serial: { type: string } key_id: { type: string } key_version: { type: string } tsa: { type: string } provider_request_id: { type: string, description: 'The key holder''s request id, to find the call in the cloud''s own audit trail' } idempotency_key: { type: string } signature_produced: { type: boolean, nullable: true } error_stage: { type: string, description: 'policy (a refusal before the key holder), preflight, certificate, hsm, tsa, revocation, embed, self_check' } error_kind: { type: string } created_at: { type: string, format: date-time } row_hash: { type: string } SigningLogVerifyResult: type: object properties: rows: { type: integer, format: int64, description: Rows checked } ok: { type: boolean } broken_at: { type: string, format: uuid, description: 'The first row that does not follow' } why: { type: string, description: 'e.g. "row_hash does not match the row"' } SigningAuditEntry: type: object properties: id: { type: string } actor_user_id: { type: string, description: 'Empty for an event no person started' } action: { type: string, example: signing.identity.create, description: 'One of the signing.* actions of ch. 43 §8.7' } target_type: { type: string } target_id: { type: string } before: { type: object, nullable: true, additionalProperties: true } after: { type: object, nullable: true, additionalProperties: true } created_at: { type: string, format: date-time } SigningTrustAnchor: type: object properties: id: { type: string, format: uuid } certificate_pem: { type: string } fingerprint_sha256: { type: string } not_after: { type: string, format: date-time } added_by: { type: string } created_at: { type: string, format: date-time } SigningAugmentOptions: type: object description: The options part of POST /projects/{id}/signing/augment. required: [level] properties: level: { type: string, enum: [B-T, B-LT, B-LTA], description: 'The level to reach; B-LTA on a B-LTA file renews its archive timestamp' } tsa_url: { type: string, format: uri, description: 'The RFC 3161 timestamp authority to use' } tsa_policy_oid: { type: string, description: 'The reqPolicy that TSA requires' } SigningVerifyOptions: type: object description: The options part of POST /projects/{id}/signing/verify. properties: use_eu_trusted_lists: { type: boolean, description: 'Also trust paths to CAs on the EU trusted lists' } at: { type: string, format: date-time, description: 'Validation time, within 10 minutes of the service''s clock (a caller journaling its own clock); never a way to validate as of another day' } SigningVerifyReport: type: object description: The validation report (ETSI EN 319 102-1), per signature and document timestamp. properties: pdf_version: { type: string } revisions: { type: integer } validation_time: { type: string, format: date-time } trusted_lists_consulted: { type: boolean } qualified_status: { type: string, enum: [not_assessed], description: 'Crios never assesses or claims qualified status' } items: type: array items: type: object properties: field: { type: string } kind: { type: string, description: 'signature or document timestamp' } sub_filter: { type: string } revision: { type: integer } indication: { type: string, enum: [TOTAL_PASSED, TOTAL_FAILED, INDETERMINATE, PASSED, FAILED] } sub_indication: { type: string } level: { type: string, enum: [B-B, B-T, B-LT, B-LTA] } signer: { type: object, properties: { subject: { type: string }, issuer: { type: string }, serial: { type: string } } } trust_anchor: type: object properties: source: { type: string } trusted_via: { type: string, description: 'The organization''s anchor, or an EU trusted list' } subject: { type: string } territory: { type: string } provider: { type: string } service: { type: string } service_type: { type: string } claimed_time: { type: string, format: date-time } proven_time: { type: string, format: date-time } coverage: { type: object, properties: { whole_document: { type: boolean }, revision: { type: integer }, of: { type: integer } } } certification: { type: object, properties: { permissions: { type: integer, enum: [1, 2, 3] } } } field_locks: { type: array, items: { type: object, properties: { action: { type: string }, fields: { type: array, items: { type: string } } } } } findings: { type: array, items: { $ref: '#/components/schemas/SigningFinding' } } warnings: { type: array, items: { $ref: '#/components/schemas/SigningFinding' } } archive_renewal_due: { type: string, format: date-time } warnings: { type: array, items: { $ref: '#/components/schemas/SigningFinding' } } SigningFinding: type: object properties: code: { type: string } message: { type: string } revision: { type: integer } Error: type: object properties: error: { type: string } User: type: object description: | A user account. `organization_id` is the active organization and `role` is the user's role there; for multi-org accounts the per-organization memberships are authoritative. List and admin endpoints return a subset of these fields. The caller's own profile is `CurrentUser`. properties: id: { type: string, format: uuid } email: { type: string, format: email } name: { type: string, description: Display name } first_name: { type: string } last_name: { type: string } organization_id: { type: string, format: uuid } role: { type: string, enum: [owner, admin, member, viewer] } is_instance_admin: { type: boolean, description: Grants the cross-organization /admin surface } has_completed_onboarding: { type: boolean } language: type: string enum: ['', en, zh-CN, hi, de, fr, ja, es, pt-BR, tr, ko] description: UI language; empty when never chosen totp_enabled: { type: boolean } email_verified_at: { type: string, format: date-time, nullable: true } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } last_login_at: { type: string, format: date-time, nullable: true } suspended_at: { type: string, format: date-time, nullable: true } Organization: type: object properties: id: { type: string, format: uuid } name: { type: string } slug: { type: string } plan: { type: string } settings: { type: object, additionalProperties: true } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } Project: type: object properties: id: { type: string, format: uuid } organization_id: { type: string, format: uuid } name: { type: string } description: { type: string } repository_url: { type: string } repository_kind: { type: string, description: 'github, gitlab or gitea; empty when the host is not recognized' } default_branch: { type: string } settings: { type: object, additionalProperties: true, description: 'Project settings (for example theme, model_routing, publishing)' } visibility: { type: string, enum: [organization, private], description: organization lets every org member use the project as an editor } owner_user_id: { type: string, format: uuid, description: Omitted when the project has no owner } access: { type: string, enum: [manage, editor, viewer], description: "The caller's effective access (list, get, create and update responses)" } org_agents_consent: allOf: [{ $ref: '#/components/schemas/OrgAgentsConsent' }] description: "GET /projects/{id} only: the caller's own Team Playbook consent in the project, while the organization has the Team Playbook on or while that consent counts; omitted otherwise" publishing_eligibility: { type: string, enum: [eligible, excluded, unknown], description: 'excluded: the project type cannot be published (CLI, mobile or library); unknown: not recorded' } discussion_bot_enabled: { type: boolean } discussion_bot_knowledge: { type: array, items: { type: string, format: uuid } } discussion_bot_prompt: { type: string } sandbox_cpu_limit: { type: integer, description: Omitted when unset } sandbox_memory_limit: { type: string, description: Omitted when unset } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } deleted_at: { type: string, format: date-time, description: Present only on soft-deleted projects } OrgAgentsConsent: type: object description: | A person's own Team Playbook consent in a private project (migrations 225 and 228): whether the Team Playbook may learn from the sessions there that they wrote in. Each person who can open the project decides for their own words alone, and no one gives or withdraws anyone else's. A session is read only when everyone who wrote in it has a consent that counts. properties: effective: { type: boolean, description: "Whether the caller's own consent counts now. A consent counts only while its person can open the project" } at: { type: string, format: date-time, nullable: true, description: "When the caller gave it, kept while it doesn't count (their access may come back); null when they have none" } opted_in: { type: integer, minimum: 0, description: "How many people's consents count in the project: a count, never who" } OrgAgentsError: type: object description: | The error body of the Team Playbook routes. The handlers answer `{"error", "code"}`. Some answer `{"code"}` alone: `org_agents_disabled`, `run_in_progress`, `agent_discarded`, `agent_enabled`, the enable blockers, and the runs list's 400 and 404. The middleware in front answers `{"error"}` alone. Its role and active-organization refusals are sent as `text/plain`, with a JSON body. properties: error: { type: string, description: 'For people. Absent from the answers that carry `code` alone' } code: type: string description: The value a client branches on enum: [org_agents_disabled, org_agents_unavailable, org_agents_off, run_in_progress, invalid_request, not_found, agent_discarded, agent_enabled, edited_after_drafting, evidence_project_private, review_required, status_changed, has_dependents, reason_required, reason_too_long, invalid_scope, invalid_schedule, notice_version_changed, scope_changed, internal] OrgAgentsListCounts: type: object description: 'How many playbooks each filter of the list covers. They count the whole organization and ignore `q` and `status`. `all` is the sum of the other four' required: [all, review, enabled, off, discarded] properties: all: { type: integer, minimum: 0 } review: { type: integer, minimum: 0, description: 'Drafts waiting for review (status `draft`)' } enabled: { type: integer, minimum: 0 } off: { type: integer, minimum: 0, description: 'Every status that is not draft, enabled or discarded: `disabled` today' } discarded: { type: integer, minimum: 0 } OrgAgentsListPage: type: object description: 'A page of the Team Playbook list' required: [agents, next, counts] properties: agents: { type: array, items: { $ref: '#/components/schemas/OrgAgentsAgent' }, description: 'In the list''s order; never null' } next: { type: string, nullable: true, description: 'An opaque cursor: pass it as `before` for the page after this one. Null on the last page' } counts: { $ref: '#/components/schemas/OrgAgentsListCounts' } OrgAgentsTab: type: object description: | The Team Playbook tab. While the organization has the Team Playbook off (its `org_agents` flag), `enabled` (false) is the only key. With it on, every key is present, null where stated. required: [enabled] properties: enabled: { type: boolean, description: 'Whether the organization has the Team Playbook on' } lane: { $ref: '#/components/schemas/OrgAgentsLane' } month_tokens: { type: integer, format: int64, description: 'Input and output tokens of the runs started this calendar month (UTC), the running one included' } monthly_cap_tokens: { type: integer, format: int64, description: 'The cap on month_tokens, 10,000,000 in this release. A run that reaches it stops (stop_reason cap)' } month_cost_usd: { type: number, description: 'What those runs cost, in US dollars' } last_run: allOf: [{ $ref: '#/components/schemas/OrgAgentsRun' }] nullable: true description: The latest run; null when there is none agent_counts: { $ref: '#/components/schemas/OrgAgentsListCounts' } needs_review: { type: array, items: { $ref: '#/components/schemas/OrgAgentsAgent' }, description: 'The drafts waiting for review, newest first, each filled as `GET /organizations/{id}/org-agents/agents` fills a playbook. Its length is `agent_counts.review`. The playbooks themselves come from that list, and one from `GET /organizations/{id}/org-agents/{skillId}`' } projects: type: object description: "The organization's projects, deleted ones aside, and how many of them the Team Playbook may read now. Under all, that is every one. Under opt_in, it is those shared with the organization and the private ones where someone's consent counts" properties: readable: { type: integer, minimum: 0 } total: { type: integer, minimum: 0 } ready_sessions: { type: integer, minimum: 0, maximum: 1000, nullable: true, description: 'Sessions ready to read now: settled, readable, and not read since their last activity. Counted up to 1000, which means 1000 or more. A run reads at most 200 of them. Null when the count took over 2 seconds' } own_projects: { type: array, maxItems: 100, items: { $ref: '#/components/schemas/OrgAgentsOwnProject' }, description: "The caller's private projects, by name, at most 100: owned, shared with them directly or through a group, or where their own consent counts. A project the caller reaches only through the admin role is listed only once they opt in there" } own_projects_total: { type: integer, minimum: 0, description: 'How many such projects there are, the ones past the first 100 included' } scope: { type: string, enum: [opt_in, all], description: 'What the Team Playbook learns from (PUT /organizations/{id}/org-agents/scope)' } scope_set_by: { type: string, format: uuid, nullable: true, description: 'Who set the scope last. Null when it was never set, or once their account is deleted' } scope_set_at: { type: string, format: date-time, nullable: true, description: 'When the scope was set last; null when never' } pending_sweep_agents: { type: integer, minimum: 0, nullable: true, description: 'How many enabled playbooks the privacy sweep would disable now. Above 0 after a sweep failed: POST /organizations/{id}/org-agents/sweep finishes it. Null when the count fails or takes over 2 seconds' } opted_in_people: { type: integer, minimum: 0, nullable: true, description: 'How many people have a consent that counts in at least one private project: a count, never who. Null when the count fails or takes over 2 seconds' } schedule: { $ref: '#/components/schemas/OrgAgentsSchedule' } auto: { $ref: '#/components/schemas/OrgAgentsAuto' } auto_versions: allOf: [{ $ref: '#/components/schemas/OrgAgentsAutoVersions' }] nullable: true description: 'Auto mode for a playbook that is already live. Null while `auto.auto_enable` is false, where it is neither shown nor settable' OrgAgentsAutoVersions: type: object description: | Auto mode's sub-setting for a playbook that is already live: whether a proposed version with no flag, and a rollback proposal, go live by themselves. Off until an owner or admin saves it on (PUT /organizations/{id}/org-agents/auto-versions), which they can only while auto mode for new playbooks is on. Turning that off, or the Team Playbook off, turns this off too. Owners and admins only. properties: auto_versions: { type: boolean, description: 'While true, and while `auto.auto_enable` is true: a version Crios proposes with no flag, from a run that read only projects shared with the whole organization, is activated at the end of the run that proposed it; and a rollback proposal to a version learned from such projects alone is applied as the scorecard pass proposes it, never later. A version whose run read a private project or is not on record waits for a person, and so do a rollback to a version learned from a private project or with no record, a flagged or widening version, the first version proposed after an automatic rollback, a version made from one that is no longer live (never activated this way; an approval then closes it as out of date), and a version whose run sent the model a version of a live playbook that is no longer live' } set_by: { type: string, format: uuid, nullable: true, description: 'Who saved it last. Null when it was never saved, or once their account is deleted' } set_by_name: { type: string, description: 'Their name; empty when set_by is null' } set_at: { type: string, format: date-time, nullable: true, description: 'When it was saved last; null when never' } OrgAgentsAuto: type: object description: | Auto mode: whether a new playbook goes live by itself, with no person's review. Off until an owner or admin of the organization saves it on (PUT /organizations/{id}/org-agents/auto). Turning the Team Playbook off turns it off, and turning the Team Playbook on again leaves it off. Owners and admins only: no member route carries it. properties: auto_enable: { type: boolean, description: 'While true, a draft that has no flag and that Enable would not refuse goes live at the end of the run that drafted it, when that run read only projects shared with the whole organization and got to its end (done, or stopped early, at the cap for instance). A flagged or blocked draft, one whose run read a private project or is not on record, and one whose run failed wait for a person, as every draft does while it is false' } set_by: { type: string, format: uuid, nullable: true, description: 'Who saved it last. Null when it was never saved, or once their account is deleted' } set_by_name: { type: string, description: 'Their name; empty when set_by is null' } set_at: { type: string, format: date-time, nullable: true, description: 'When it was saved last; null when never' } OrgAgentsLane: type: object description: | The lessons lane: the provider and model that Team Playbook runs call. It follows the organization's utility model on the Routing tab, and runs use only the organization's own key. properties: provider: { type: string, description: 'Empty when the lane could not be resolved. It may be empty when the lane has no model' } model: { type: string, description: 'Empty when the lane could not be resolved. It may be empty when the lane has no model' } own_key: { type: boolean, description: "Whether runs can call the lane on the organization's own key" } reason: { type: string, description: "Why runs can't, as a sentence to show people. For example, the lane has no model or runs on the built-in starter model; the provider is missing, turned off, or has no key of the organization's own; or the lane could not be resolved and to try again in a minute. Empty exactly when own_key is true" } OrgAgentsSchedule: type: object description: | The Team Playbook's automatic runs. An armed `daily` or `weekly` schedule starts a run on its own once its interval has passed since the latest run of any kind, when all of these hold: - the organization has the Team Playbook on and isn't suspended; - the lessons lane has the organization's own key; - the month's tokens are under the cap; - at least `min_ready_sessions` sessions are ready; - the privacy sweep finishes. After `pause_after` automatic runs in a row fail, the schedule pauses, which disarms it. It stays paused until it is saved again or Run now arms it. Turning the Team Playbook off disarms it. properties: auto_run: { type: string, enum: [daily, weekly, 'off'], description: daily is the default } armed: { type: boolean, description: 'Whether it may start runs, which is whether armed_at is set' } armed_at: { type: string, format: date-time, nullable: true, description: 'When it was armed; null while disarmed' } paused_at: { type: string, format: date-time, nullable: true, description: 'When it paused after failed runs; null when not paused' } next_run_after: { type: string, format: date-time, nullable: true, description: 'While armed, no automatic run starts before this time. It is the later of armed_at, and the latest run''s start plus a day (daily) or a week (weekly). Null while disarmed, and in a PUT answer when the latest run could not be read' } min_ready_sessions: { type: integer, description: 'How many sessions must be ready for an automatic run, 5 in this release' } pause_after: { type: integer, description: 'How many automatic runs in a row fail before it pauses, 3 in this release' } OrgAgentsRun: type: object description: | One Team Playbook run. A running run with no heartbeat for 15 minutes reads as `failed`, with stop_reason `stale`. properties: id: { type: string, format: uuid } started_by: { type: string, format: uuid, nullable: true, description: 'The owner or admin who pressed Run now. Null for an automatic run, and once their account is deleted' } auto_schedule: { type: string, enum: [daily, weekly], nullable: true, description: 'The schedule an automatic run started on; null for a run a person started' } status: { type: string, enum: [running, done, stopped, failed], description: 'stopped: the monthly cap, the organization''s token quota, or the lack of a key of its own stopped it. failed: the provider failed, the run went stale, or another failure (see error)' } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time, nullable: true, description: 'Null while running. A stale run''s is its last heartbeat' } sessions_read: { type: integer, minimum: 0 } cards: { type: integer, minimum: 0, description: Cards written } drafts: { type: integer, minimum: 0, description: Drafts made } tokens_in: { type: integer, format: int64 } tokens_out: { type: integer, format: int64 } cost_usd: { type: number, description: 'What its calls cost, in US dollars' } stop_reason: { type: string, enum: ['', done, cap, no_key, provider_error, org_quota, stale], description: 'Empty while running, and on a failure that is not the provider''s. done with done; cap, no_key and org_quota with stopped; provider_error and stale with failed' } error: { type: string, description: 'What went wrong, as a short class, for example `the provider failed: HTTP 503` or `the run stopped without finishing`. With no_key it may be the lane''s reason instead. Empty when nothing went wrong' } pipeline: allOf: [{ $ref: '#/components/schemas/OrgAgentsRunPipeline' }] nullable: true description: What the run found at each step; null for a run from before migration 226 OrgAgentsRunPipeline: type: object description: | What a run found at each step. The nullable counts are null until the run reaches their step. The others start at 0. Runs from before release 430 show 0 for `unparsed`, `truncated`, `given_up`, `draft_not_retried` and `draft_truncated`. properties: projects: type: object nullable: true description: "The organization's projects when the run started, and how many the Team Playbook could read" properties: readable: { type: integer, minimum: 0 } total: { type: integer, minimum: 0 } eligible: { type: integer, minimum: 0, nullable: true, description: 'Sessions ready to read when the run started. The run lists one more than the 200 it reads at most, so 201 means more wait for the next run' } read: { type: integer, minimum: 0, description: Sessions read } unreadable: { type: integer, minimum: 0, description: Sessions skipped because they stopped being readable before the run read them } cards: { type: integer, minimum: 0, description: Cards this run wrote } low_signal: { type: integer, minimum: 0, description: 'The cards that teach nothing beyond their session (part of cards). Grouping leaves them out' } unparsed: { type: integer, minimum: 0, description: 'Sessions read whose card answer could not be used, because it was cut off or held no card' } truncated: { type: integer, minimum: 0, description: 'Card answers cut off at the call''s bound (part of unparsed)' } given_up: { type: integer, minimum: 0, description: 'Sessions whose card answers failed twice since their last activity. They are kept as low-signal cards. unparsed minus given_up is how many a later run reads again' } grouped: { type: integer, minimum: 0, nullable: true, description: 'Cards that grouping used: the organization''s readable cards from this run and earlier ones, low-signal ones aside, at most 5000' } themes: { type: integer, minimum: 0, nullable: true, description: 'The groups those cards make, one per kind of work and main stack tag' } below_min_cards: { type: integer, minimum: 0, nullable: true, description: 'Themes with fewer than 5 cards, which wait for more' } candidates: { type: integer, minimum: 0, nullable: true, description: 'Themes the run may draft' } covered: type: array description: "Playbooks that already hold a candidate theme, so the run drafted none for it, one per theme. name is the playbook's name now, or empty once its skill is gone" items: type: object properties: skill_id: { type: string, format: uuid } name: { type: string } suppressed: { type: integer, minimum: 0, description: 'Candidates whose playbook was discarded within the last 90 days' } max_open_drafts: { type: integer, minimum: 0, description: 'Candidates not tried because the organization had 10 open drafts' } draft_not_retried: { type: integer, minimum: 0, description: 'Candidates not tried because 2 draft answers on the same cards were cut off or held no JSON object. They are tried again once their cards change' } drafted: { type: integer, minimum: 0, description: Drafts made } empty: { type: integer, minimum: 0, description: Draft calls of which nothing survived the support bar and the scrub } draft_truncated: { type: integer, minimum: 0, description: 'Draft answers cut off at the call''s bound' } unparseable: { type: integer, minimum: 0, description: Draft answers that held no JSON object } dropped_naming_a_member: { type: integer, minimum: 0, description: Drafted texts dropped for naming a member } improve: type: object nullable: true description: | What the run's Improve step found, as counts: null until the run got there, for a run from before it, and while the organization has no enabled playbook. Each enabled playbook counted in `checked` is counted in exactly one of the others. properties: checked: { type: integer, minimum: 0, description: Enabled playbooks the step looked at } waiting: { type: integer, minimum: 0, description: 'Playbooks Crios asked the model about within the last 7 days, whether that proposed a version or not: an answer it could not use is not asked for again sooner' } not_due: { type: integer, minimum: 0, description: 'Playbooks with fewer than 10 sessions on their current version, and fewer than 3 that failed or were rated down' } edited: { type: integer, minimum: 0, description: 'Playbooks whose instructions hold text beside their items, which a proposed version would lose: they wait for a person' } proposed: { type: integer, minimum: 0, description: Playbooks that got a proposed version } no_change: { type: integer, minimum: 0, description: Playbooks whose answer held no change that had the support to stay } unusable: { type: integer, minimum: 0, description: 'Playbooks whose answer was cut off or held no patch' } refused: { type: integer, minimum: 0, description: 'Playbooks whose version the skills store did not take, for another reason than `rollback_open`, `removal_open` or `moved`' } rollback_open: { type: integer, minimum: 0, description: 'Playbooks left alone because a rollback proposal waits for a person, found when the step read the playbook or opened while its call ran: it goes before a further change' } removal_open: { type: integer, minimum: 0, description: 'Playbooks left alone because a privacy removal''s proposal was open, found when the step read the playbook (no call is made) or stored while its call ran: the privacy sweep is about to activate it, and a version proposed now would set it aside. No failure: a later run asks again, without the 7 days'' wait' } moved: { type: integer, minimum: 0, description: 'Playbooks whose active version changed while the step''s call ran (a person''s edit, an approval, a Restore or a privacy removal): no version made from what was live before is stored, since approving it would undo that change. No failure: a later run asks again, without the 7 days'' wait' } unreadable: { type: integer, minimum: 0, description: 'Playbooks left alone because their evidence, knowledge or item support doesn''t read: a version made from what did read would drop the rest. No call is made, and a later run reads them again' } auto_activated: { type: integer, minimum: 0, description: 'Of `proposed`, the versions that went live by themselves under auto mode for live playbooks (`auto_versions`), each audited as `org_agent.auto.activate` with no actor. The rest wait for a person' } auto_unreadable: { type: integer, minimum: 0, description: 'Of `proposed`, the versions auto mode for live playbooks did not activate because the scan at activation found the proposal''s stored flags, or the knowledge of the proposed or the live version, holding a value that doesn''t read: read as none, each would take flags away. They wait for a person' } auto_partly_read: { type: integer, minimum: 0, description: 'Of `proposed`, the versions whose scan at activation read the evidence or item support of the proposed or the live version as none, because it doesn''t read. That can only add flags, so the decision went on' } auto: type: object nullable: true description: | What auto mode did with the drafts the run made, as counts: null unless the organization's auto setting was on when the run got there with drafts, and for a run from before it. The drafts counted in `flagged`, `blocked` and `failed` wait for a person, as every draft does with the setting off. properties: enabled: { type: integer, minimum: 0, description: 'Drafts that went live by themselves, each audited as `org_agent.auto.enable` with no actor' } flagged: { type: integer, minimum: 0, description: "Drafts that wait because the flag scan found something (the playbook's `flags`)" } private: { type: integer, minimum: 0, description: "Drafts that wait because the run sent the model something from a project that isn't shared with the whole organization, because what it read isn't on record, or because a version of a live playbook it sent the model was replaced or turned off before they could go live, which marks the run and everything it made as if it had read a private project (the playbook's `shared_projects_only` is false)" } blocked: { type: integer, minimum: 0, description: "Drafts that wait because Enable would refuse them (the playbook's `blockers`), or because a person edited, published or discarded them meanwhile" } failed: { type: integer, minimum: 0, description: 'Drafts whose enable failed; they wait too' } OrgAgentsAgent: type: object description: | A playbook as owners and admins see it. Some fields come from its skill's active version, which people may edit: `name`, `when_to_use`, `description`, `session_types`, `rules`, `memory` and `preferences`. `knowledge` is what the run proposed. properties: skill_id: { type: string, format: uuid, description: "The playbook's skill" } name: { type: string } when_to_use: { type: string, description: 'Empty when the skill''s manifest no longer reads. rules, memory and preferences are empty then too' } status: { type: string, enum: [draft, enabled, disabled, discarded], description: 'draft: not enabled yet, published or not. disabled: disabled under Skills or by the privacy sweep (auto_disabled_at). discarded: discarded here, or its skill archived' } origin: { type: string, enum: [miner, person], description: 'miner: drafted by a run, the only origin this release writes' } kind: { type: string, description: 'The kind of work it learned from. A run writes one of: web app, mobile app, API or service, data or automation, research or report, change to an existing app, lookup or action, other' } stack: { type: array, items: { type: string }, description: Lowercase stack tags } rules: { type: array, items: { type: string } } memory: type: array items: type: object properties: fact: { type: string } why: { type: string } apply: { type: string } preferences: { type: array, items: { type: string } } knowledge: type: array description: 'The knowledge items the run proposed. An owner or admin may have deleted one, or one was never written because a project it came from went private first' items: type: object properties: title: { type: string } body: { type: string } applies: { type: boolean, description: 'Whether it is an organization knowledge entry now' } evidence: type: object description: | What it learned from, as counts only, under the privacy floor (3) as a proposal's evidence is: fewer than 3 people send `users` 0 and `few_users` true, fewer than 3 sessions `sessions` 0 and `few_sessions` true. Evidence of no session sends zeros and no flag. properties: sessions: { type: integer, minimum: 0, description: '0 when `few_sessions`' } few_sessions: { type: boolean, description: 'Fewer than `people_floor` sessions: say so, never a number' } users: { type: integer, minimum: 0, description: 'Distinct people who ran those sessions; 0 when `few_users`' } few_users: { type: boolean, description: 'Fewer than `people_floor` people: say so, never a number' } projects: { type: integer, minimum: 0, description: Distinct projects of those sessions } people_floor: { type: integer, description: 'The number "fewer than" means (3); sent only with a flag' } created_at: { type: string, format: date-time } enabled_at: { type: string, format: date-time, nullable: true, description: 'When it was last enabled; null when no enable was recorded' } discarded_at: { type: string, format: date-time, nullable: true } discarded_reason: { type: string, description: 'The reason given when it was discarded here; empty otherwise' } auto_disabled_at: { type: string, format: date-time, nullable: true, description: 'When the privacy sweep disabled it. Null when it didn''t, and again once the playbook is enabled' } auto_disabled_reason: { type: string, enum: ['', evidence_unreadable], description: 'evidence_unreadable: it learned from a session the Team Playbook may no longer read' } description: { type: string, description: "The skill's description" } session_types: { type: array, items: { type: string }, description: 'The session types it applies to; empty for every type' } version: { type: integer, description: "The skill's active version" } version_at: { type: string, format: date-time, nullable: true, description: "When that version was made; null when its row can't be found" } blockers: type: array nullable: true description: | Why the one-click enable would refuse it now, in the order the click checks them, so the first is the click's 409. Empty for an enabled playbook; `agent_discarded` alone for a discarded one. Null when the checks fail for this playbook. items: type: object properties: code: { type: string, enum: [edited_after_drafting, evidence_project_private, review_required, agent_discarded] } reason: { type: string, enum: [changes_beyond_items, text_beside_items, no_items, names_a_member, holds_a_secret, holds_personal_data, unreadable], description: 'With `edited_after_drafting` only: what the privacy check found in the edit. Absent otherwise' } uses: allOf: [{ $ref: '#/components/schemas/OrgAgentsUses' }] nullable: true description: "Where the playbook was used. Null when the counts couldn't be made" item_support: { $ref: '#/components/schemas/OrgAgentsItemSupport' } flags: { type: array, items: { type: string, enum: [personal_data, rare_host, credentials, data_out, model_change, limit_loosened] }, description: 'Why a person should look at the draft first, as codes, from a scan of the draft as Crios wrote it (no model call; it prefers a false alarm to a miss): `personal_data` (possible personal data, a name included), `rare_host` (a host, URL or email in an item fewer than 2 sessions support), `credentials` (talk of credentials, tokens, keys or passwords), `data_out` (talk of sending data out), `model_change`, `limit_loosened`. Never the text that raised a flag. Empty for none, and for a playbook drafted before the scan. A flagged draft never goes live by itself' } flag_words: { type: object, additionalProperties: { type: string }, description: 'For each of `flags`, what raised it: the word as the text has it for `credentials`, `data_out` and a limit put in words; the name of the setting for `model_change` and a limit setting; and for `personal_data` and `rare_host` the kind of thing found (`email`, `phone`, `name`, `host`, `url`, …), never the match itself' } shared_projects_only: { type: boolean, description: "True only when the run that drafted the playbook is on record as having sent the model nothing from a project that isn't shared with the whole organization. A live playbook's own text, which the run sends to improve it, doesn't count, whatever that version learned from: every member already reads it. Auto mode enables a draft only then. False when it read a private project, when there is no record (a draft from before the record, a run that never finished), and when a version of a live playbook the run sent the model was replaced or turned off before the run's drafts could go live. It names no project, session or person" } auto_enabled_at: { type: string, format: date-time, nullable: true, description: 'When the playbook went live by itself under the auto setting. Null when a person enabled it, and again once a person has reviewed any version of it. Owners and admins only' } open_proposal: type: object nullable: true description: 'The version proposed for the playbook and not decided yet (GET /organizations/{id}/org-agents/{skillId}/proposals). Null for none. Owners and admins only' properties: id: { type: string, format: uuid } kind: { type: string, enum: [new_version, rollback], description: '`rollback`: the version the live one replaced, proposed because its scorecard is worse (`GET …/scorecards`)' } version: { type: integer, description: 'The version proposed, or for a rollback the version to go back to' } created_at: { type: string, format: date-time } OrgAgentsProposal: type: object description: | One row of a playbook's decision log: a version Crios proposed, a restore, or a rollback Crios proposed because the live version's scorecard is clearly worse than the one it replaced. A row that rests on a session the organization may no longer read says nothing of what its version says (`text_unavailable`). Owners and admins only. properties: id: { type: string, format: uuid } kind: { type: string, enum: [new_agent, new_version, rollback], description: '`new_version`: a proposed version. `rollback`: going back to `version`: a restore (approved at once, by a person) or, while `state` is `open`, the scorecard''s proposal, which changes nothing until an owner or admin approves it, as for a version. `new_agent` is reserved' } version: { type: integer, description: 'The skill version proposed, or restored' } from_version: { type: integer, description: 'The active version it was computed against, or that the restore replaced' } state: { type: string, enum: [open, approved, rejected, superseded] } flags: { type: array, items: { type: string }, description: 'Why a person must look, as codes: `personal_data` (possible personal data, a name included), `rare_host` (a host, URL or email in an item fewer than 2 sessions support), `credentials` (talk of credentials, tokens, keys or passwords), `data_out` (talk of sending data out), `model_change`, `limit_loosened` (the version removes or loosens a limit the live one had). The scan reads what the version adds or changes against the live one, with no model call, and prefers a false alarm to a miss. Never the text that raised a flag. `privacy_removal` marks a version Crios made to apply by itself, for privacy, whether it applied or was set aside before it did' } flag_words: { type: object, additionalProperties: { type: string }, description: 'For each of `flags`, what raised it, as for a playbook: a word, a setting or a kind, never personal data itself' } shared_projects_only: { type: boolean, description: "True only when the run that proposed the version is on record as having sent the model nothing from a project that isn't shared with the whole organization. The live version's own text, which the run sends beside the cards, doesn't count, whatever it learned from: every member already reads it. Auto mode activates a version only then; false also when there is no record, and when a version of a live playbook the run sent the model was replaced or turned off before its versions could go live. For a `rollback`, which no run made: true only when the version it goes back to is on record as learned from shared projects alone (its draft's or its approved proposal's record, as auto mode reads it before going back); false for one with no record, such as a version a person wrote" } evidence: type: object description: | What the version rests on, as counts: never which sessions, projects or people. A proposed version rests on the sessions the version it was computed against rests on, and on the sessions of the summaries cited for each change, a removal included, since its reason was written from them. Under the privacy floor (3) not even how many: fewer than 3 people send `users` 0 and `few_users` true, fewer than 3 sessions `sessions` 0 and `few_sessions` true. Evidence of no session sends zeros and no flag. properties: sessions: { type: integer, minimum: 0, description: '0 when `few_sessions`' } few_sessions: { type: boolean, description: 'Fewer than `people_floor` sessions: say so, never a number' } users: { type: integer, minimum: 0, description: 'The distinct people; 0 when `few_users`' } few_users: { type: boolean, description: 'Fewer than `people_floor` people: say so, never a number' } projects: { type: integer, minimum: 0 } people_floor: { type: integer, description: 'The number "fewer than" means (3); sent only with a flag' } name: { type: string, description: 'Empty while `text_unavailable`' } description: { type: string, description: 'What the version says it does. Empty while `text_unavailable`' } when_to_use: { type: string, description: 'Empty while `text_unavailable`' } session_types: { type: array, nullable: true, items: { type: string }, description: 'The session types the version applies to; empty for every type. Null when its version can''t be read, and while `text_unavailable`' } profile: type: object nullable: true description: 'What the version says. Null when its version can''t be read, and while `text_unavailable`' properties: rules: { type: array, items: { type: string } } memory: { type: array, items: { type: object, properties: { fact: { type: string }, why: { type: string }, apply: { type: string } } } } preferences: { type: array, items: { type: string } } knowledge: { type: array, items: { type: object, properties: { title: { type: string }, body: { type: string } } }, description: 'The knowledge the version holds, whole. Empty while `text_unavailable`' } reasons: type: array description: | Why Crios made each change of the version, in one sentence of at most 200 characters: one entry for each item it adds or takes out (a changed item has both). Empty for a version with no reasons on record, such as a privacy removal or a restore, and while `text_unavailable`. items: type: object properties: change: { type: string, enum: [added, removed] } section: { type: string, enum: [rules, memory, preferences, knowledge] } text: { type: string, description: "The item: a rule's or a preference's text, a memory line's fact, a knowledge item's title" } reason: { type: string } text_unavailable: type: boolean description: | The row rests on a session the organization may no longer read, for example in a project that went private or of a person who withdrew their opt-in: the check an approval makes (409 `evidence_project_private`). What can't be approved or restored isn't shown: `name`, `description` and `when_to_use` are empty, `session_types` and `profile` null, `knowledge` and `reasons` empty. The kind, the versions, the state, the flags, the counts, the days and the decision stay. Once the session can be read again, the row shows it all again. created_day: { type: string, description: 'When it was proposed, or restored: the day in UTC (YYYY-MM-DD), or only the month (YYYY-MM) while `evidence` is under the privacy floor. Never the instant' } decided_by: { type: string, format: uuid, nullable: true, description: 'Who approved, rejected or restored. Null while open, for a superseded proposal and for a decision Crios made (a privacy removal, or, with `reason` `auto`, auto mode for live playbooks)' } decided_by_name: { type: string } decided_day: { type: string, nullable: true, description: 'When it was decided, or set aside, as `created_day` shows its day. Null while open' } reason: { type: string, description: 'The rejection''s reason; for a superseded proposal why: `edited`, `rolled_back`, `activated`, `newer_proposal`, `base_changed` or `regression` (a rollback proposal ended it); for an approved one with no `decided_by`, `auto` when auto mode for live playbooks applied it. A privacy removal Crios couldn''t apply carries `base_changed` only when the playbook changed first, or else `turned_off` (it was turned off or deleted first), `evidence_unreadable` (more of what it rests on could no longer be read; Crios makes the removal again) or `not_applied` (applying it failed)' } OrgAgentsVersion: type: object description: One version in a playbook's history. Owners and admins only. properties: version: { type: integer } semver: { type: string } created_at: { type: string, format: date-time } written_by: { type: string, enum: [miner, person], description: '`miner`: Crios wrote it. Never who' } privacy_removal: { type: boolean, description: 'Crios made this version to apply by itself: the version before it without the items that rested on sessions the organization may no longer read. No person has to approve it. It applied only if it was ever live (`state` `active` or `earlier`); one set aside before it applied removed nothing' } privacy_removal_reasons_only: { type: boolean, description: 'Such a version applied and took out no item, only reasons Crios gave for earlier changes whose sessions the organization may no longer read: its items are, byte for byte, those of the version it narrowed. Never true without `privacy_removal`' } auto: { type: boolean, description: 'Crios activated this version by itself under auto mode for live playbooks. No person approved it' } auto_rollback: { type: boolean, description: 'The last time this version was restored, Crios went back to it by itself, under auto mode for live playbooks' } state: { type: string, enum: [active, earlier, proposed, rejected, superseded] } restorable: { type: boolean, description: 'Whether Restore would take it now' } restore_blocker: { type: string, enum: ['', active, never_live, evidence_project_private], description: 'Why it can''t be restored; empty when it can' } OrgAgentsScorecardCard: type: object description: | How the sessions a version was applied to fared. Owners and admins only: members never see a score, a cost or a failure rate. Under the privacy floor (fewer than `min_sessions` sessions, or sessions of fewer than `people_floor` people) `too_few` is true and `numbers` is null: no count, rate or median at all, since a handful of sessions can be one person's own feedback. Each scope is floored on its own, and `alone` also while the sessions `all` counts beside another playbook (all minus alone) are some, but fewer than `min_sessions` or of fewer than `people_floor` people, since the difference would show them. properties: too_few: { type: boolean, description: 'True under the floor: "too few to tell", and no numbers' } numbers: allOf: [{ $ref: '#/components/schemas/OrgAgentsScorecardNumbers' }] nullable: true description: 'Null exactly while `too_few` is true' OrgAgentsScorecardNumbers: type: object description: A scorecard's counts, rates and medians, over the floor only. properties: sessions: { type: integer, minimum: 0 } rated: { type: integer, minimum: 0, description: 'Sessions with a thumbs from anyone' } thumbs_down: { type: integer, minimum: 0, description: 'Sessions with a thumbs-down from anyone' } thumbs_down_rate: { type: number, description: '`thumbs_down` over `sessions`' } ignored_instructions: { type: integer, minimum: 0, description: 'Sessions whose feedback gave "ignored instructions" as a reason' } failed: { type: integer, minimum: 0, description: 'Sessions whose status is failed' } failed_rate: { type: number, description: '`failed` over `sessions`' } median_steers: { type: number, nullable: true, description: 'Median steers per session. Null without sessions' } median_cost_usd: { type: number, nullable: true, description: 'Median cost of a session in US dollars (`sessions.cost_usd`). Null without sessions' } labeled: { type: integer, minimum: 0, description: 'Sessions whose outcome label says shipped or abandoned' } shipped: { type: integer, minimum: 0 } ship_rate: { type: number, nullable: true, description: '`shipped` over `labeled`. Null while no session carries the label' } OrgAgentsScorecard: type: object description: One version's scorecard and its comparison with the version it replaced. properties: version: { type: integer } active: { type: boolean } replaced_version: { type: integer, description: 'The version it is compared with: the one it replaced the last time it became active, 0 for the first. For a version Crios made to remove items for privacy, the newest earlier version the organization may still read, never the one it narrowed, and 0 for none' } privacy_removal: { type: boolean, description: 'Its last activation was a privacy removal''s: `replaced_version` is then the newest earlier version the organization may still read, 0 for none, so the page never calls it the version this one replaced' } all: { $ref: '#/components/schemas/OrgAgentsScorecardCard' } alone: { allOf: [{ $ref: '#/components/schemas/OrgAgentsScorecardCard' }], description: 'The same over the sessions in which this was the only playbook applied, the cleaner signal' } comparison: type: object properties: state: { type: string, enum: [none, too_few, compared], description: '`none`: no earlier version (for a privacy removal, none the organization may still read). `too_few`: this version or the earlier one is under the floor (fewer than `min_sessions` sessions, or sessions of fewer than `people_floor` people): "too few sessions to tell". `compared`: the rules ran' } regressions: { type: array, items: { type: string, enum: [thumbs_down, failed, steers, ignored_instructions] }, description: 'The rules that hold: thumbs-down rate 15 points higher with 3 or more extra downs; failed-session rate 1.5 times higher with 3 or more extra failures; steers per session 1.5 times higher with 3 or more extra steers; 3 or more sessions that ignored instructions, which needs no comparison: without one (`none`, `too_few`) it keeps the version from Verified, and no rollback is proposed. None while this version is under the floor' } verified: { type: boolean, description: 'Marked Verified: 20 or more sessions of `people_floor` or more people, and no regression; a privacy removal only on a comparison that ran (`compared`). The system''s mark, never a person''s review' } verified_at: { type: string, format: date-time, nullable: true } first_day: { type: string, description: 'The first day the sessions counted used it, YYYY-MM-DD in UTC; YYYY-MM (the month only) while `all` is under the floor; empty while none' } last_day: { type: string, description: 'The last day, as first_day' } OrgAgentsUses: type: object description: | The sessions that used a playbook, deleted sessions left out. Counts only, never which sessions, projects or people. A session is among `pinned` or `auto` when its skills bundle applied the playbook, and among `retrieved` when its planner found one of the playbook's knowledge entries; it can be in both, so `sessions` can be less than the three add up to. A session from before these were recorded counts only for the first playbook it applied, and never as `retrieved`. properties: sessions: { type: integer, minimum: 0, description: 'The sessions that used it in either way, each once' } pinned: { allOf: [{ $ref: '#/components/schemas/OrgAgentsUseOutcomes' }], description: "Sessions whose creator pinned it" } auto: { allOf: [{ $ref: '#/components/schemas/OrgAgentsUseOutcomes' }], description: 'Sessions it was picked for automatically' } retrieved: { allOf: [{ $ref: '#/components/schemas/OrgAgentsUseOutcomes' }], description: "Sessions whose planner found its knowledge" } OrgAgentsUseOutcomes: type: object description: Sessions by their status now properties: total: { type: integer, minimum: 0 } completed: { type: integer, minimum: 0 } failed: { type: integer, minimum: 0 } cancelled: { type: integer, minimum: 0 } open: { type: integer, minimum: 0, description: 'Every other status: at work, waiting for a message, paused or idle' } OrgAgentsItemSupport: type: object description: | What each item rested on when the miner drafted it, in each section's order. An entry is null for an item with none saved: one a person wrote or changed since, or one drafted before support was saved. properties: rules: { type: array, items: { allOf: [{ $ref: '#/components/schemas/OrgAgentsItemSupportEntry' }], nullable: true } } memory: { type: array, items: { allOf: [{ $ref: '#/components/schemas/OrgAgentsItemSupportEntry' }], nullable: true } } preferences: { type: array, items: { allOf: [{ $ref: '#/components/schemas/OrgAgentsItemSupportEntry' }], nullable: true } } knowledge: { type: array, items: { allOf: [{ $ref: '#/components/schemas/OrgAgentsItemSupportEntry' }], nullable: true } } OrgAgentsItemSupportEntry: type: object description: | Counts and days only, never which sessions or people. Under the privacy floor (fewer than people_floor people) no count of people is given and the days are only months; fewer than people_floor sessions are not counted either. properties: sessions: { type: integer, minimum: 0, description: 'How many sessions the lessons the item cites came from; 0 when few_sessions is true' } few_sessions: { type: boolean, description: 'True when fewer than people_floor sessions were behind the item: their number is not given, since a session has one creator and a small session count would count people' } people: { type: integer, minimum: 0, description: 'How many people those sessions were from; 0 when few_people is true, never an exact count below the floor' } few_people: { type: boolean, description: 'True when fewer than people_floor people were behind the item: the count is then not given and the days are months' } people_floor: { type: integer, minimum: 0, description: 'Set with few_people or few_sessions: the number "fewer than" means (3 today)' } first_day: { type: string, description: 'The first day of those sessions, YYYY-MM-DD in UTC; YYYY-MM (the month only) when few_people is true; empty when unknown' } last_day: { type: string, description: 'The last day, as first_day' } OrgAgentsConsentRequest: type: object description: "A request open on one of the caller's own private projects. It never says who asked" properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } project_name: { type: string } requested_at: { type: string, format: date-time } OrgAgentsOwnProject: type: object description: "One of the caller's private projects, with the caller's own consent there" properties: id: { type: string, format: uuid } name: { type: string } org_agents_consent: { $ref: '#/components/schemas/OrgAgentsConsent' } OrgAgentsNotice: type: object description: The member notice of the Team Playbook, and what the caller acknowledged of it properties: active: { type: boolean, description: 'Whether the organization has the Team Playbook on' } version: { type: integer, description: 'The current notice version, 4 in this release. `acknowledged` stays false until the member acknowledges this version; nothing in the app shows the notice now' } acknowledged: { type: boolean, description: 'Whether the caller acknowledged this version or a later one' } scope: { type: string, enum: [opt_in, all] } scope_set_at: { type: string, format: date-time, nullable: true, description: 'When the scope was set last; null when never' } scope_acknowledged: { type: boolean, description: 'False only while the scope is all and the caller has not acknowledged its current setting' } auto: { type: string, enum: ['off', new_playbooks, versions], description: 'The level of auto mode, for the line that says who reviews playbooks. `off`: an owner or admin reviews every playbook before it goes live. `new_playbooks`: a new playbook that learned only from projects shared with the whole organization can go live without a review. `versions`: such a playbook can also change, or go back to an earlier version, without one. Anything learned from a private project is always reviewed. `off` while the Team Playbook is off' } auto_set_at: { type: string, format: date-time, nullable: true, description: 'When that level was set: the day auto mode was turned on for `new_playbooks`, the day it was widened for `versions`. Null when `off`. Never who set it' } OrgAgentsMemberSummary: type: object description: | The Team Playbook as every member sees it. While the organization has the Team Playbook off, `enabled` (false) is the only key. required: [enabled] properties: enabled: { type: boolean } playbooks: { type: array, items: { $ref: '#/components/schemas/OrgAgentsMemberPlaybook' }, description: 'The enabled playbooks, the most recently enabled first, then by name' } sessions_learned_from: { type: integer, minimum: 0, nullable: true, description: 'Distinct sessions across the playbooks. A session that two playbooks learned from counts once. Null under the privacy floor: fewer than 3' } lessons: { type: integer, minimum: 0, description: "The playbooks' lessons, added up" } OrgAgentsMemberPlaybook: type: object properties: skill_id: { type: string, format: uuid } name: { type: string } enabled_at: { type: string, format: date-time, nullable: true, description: 'When it was last enabled; null when no enable was recorded' } knowledge_titles: { type: array, items: { type: string }, description: "The titles of its knowledge items that are organization knowledge entries now, in the playbook's order" } sessions_learned_from: { type: integer, minimum: 0, nullable: true, description: 'How many sessions it learned from, never which. Null under the privacy floor: fewer than 3' } lessons: { type: integer, minimum: 0, description: 'How many rules, memory lines and preferences it teaches' } sessions_used: { type: integer, minimum: 0, nullable: true, description: "How many of the organization's sessions used it: one organization-wide count, never which sessions. Null when the count couldn't be made" } Session: type: object description: | A session as the session endpoints return it. Optional fields are omitted when unset rather than sent as null. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid, nullable: true, description: null for a session without a project } user_id: { type: string, format: uuid, description: The session's owner (creator) } title: { type: string } description: { type: string } status: type: string enum: [pending, queued, starting, planning, working, running, recovering, waiting_input, paused, idle, completed, failed, cancelled] description: | `running` is a deprecated alias of `working`. `idle` means the agent finished its current work and waits for a message; `paused` means paused by a user or by the idle timeout. `completed` and `failed` are legacy terminal states: current code parks finished sessions at `idle` with the reason in `final_status_reason`. session_type: type: string description: | coding, planning, review, testing, research or publishing for a top-level session. Worker subsessions may carry finer types (code_write_backend, code_write_frontend, schema_migration, docs, security_audit). priority: { type: integer, minimum: 0, maximum: 10 } plan: type: array nullable: true items: { type: object, additionalProperties: true } description: Plan steps (step, title, description, session_type, status, …) current_step: { type: integer } total_steps: { type: integer } model_provider: { type: string } model_name: { type: string } cost_usd: { type: number } tokens_in: { type: integer, format: int64 } tokens_out: { type: integer, format: int64 } sandbox_type: { type: string, description: 'Sandbox flavor: omni, or one of the older names coding, browser, android or desktop (all run the omni sandbox image); empty for chat and planning sessions' } sandbox_id: { type: string, description: Omitted when no sandbox is attached } error_message: { type: string, description: Omitted when unset } final_status_reason: { type: string, description: Why the last agent run ended; omitted when empty } result: { type: string, description: Omitted when unset } pr_url: { type: string, description: Omitted when unset } branch_name: { type: string, description: Omitted when unset } pr_number: { type: integer, format: int64, description: Omitted when unset } parent_session_id: { type: string, format: uuid, description: Coordinator of a worker subsession; omitted for top-level sessions } role: { type: string, enum: [coordinator, worker], description: Omitted when unset } agent_profile_id: { type: string, format: uuid, description: Pinned or auto-selected agent profile; omitted when none } agent_profile_selection: { type: string, enum: [pinned, auto], description: Present with agent_profile_id } agent_profile_name: { type: string, description: Display name of the agent profile } build_session_id: { type: string, format: uuid, description: 'GET /sessions/{id} on a built planning session only' } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } started_at: { type: string, format: date-time, description: Omitted when unset } completed_at: { type: string, format: date-time, description: Omitted when unset } deleted_at: { type: string, format: date-time, description: Soft-delete time; omitted for live sessions } SessionEvent: type: object description: One session event row as GET /sessions/{id}/events and /messages return it. properties: id: { type: string, description: 'Event UUID; synthesized conversation rows use session-spec--' } session_id: { type: string, format: uuid } event_type: { type: string, description: 'e.g. user_message, agent_message, clarification, plan_update, tool_call, status_change, error' } content: type: string description: | The event payload, usually a JSON document encoded as a string. A body over max_content_bytes arrives as `{"message", "truncated": true, "original_bytes"}`; strings inside a JSON body longer than max_string_bytes are shortened and the body is flagged `content_truncated: true`. metadata: { type: string, description: Event metadata as a JSON-encoded string } created_at: { type: string, format: date-time } failure_disposition: { type: string, description: Events only; present on failure rows } correlation_key: { type: string, description: Events only; present on failure rows that carry one } cursor: { type: string, description: Cursor-mode events only; this row's keyset cursor } Playbook: type: object properties: id: { type: string, format: uuid } name: { type: string } description: { type: string, description: Omitted when unset } scope: { type: string, enum: [org, project, session_type] } project_id: { type: string, format: uuid, description: Omitted for org scope } session_type: { type: string, description: Omitted unless scope is session_type } content: { type: string } version: { type: integer, description: Increments on content edits and reverts } is_active: { type: boolean, description: Only active playbooks are injected into sessions } created_by: { type: string, format: uuid, nullable: true, description: Null once the author's account has been deleted } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } KnowledgeEntry: type: object description: | A knowledge library entry. A `document` feeds retrieval; a `prompt` is a versioned agent brief and is never retrieved. A Team Playbook entry carries `org_agent_skill_id` and `org_agent_name`: an organization-wide document that Crios writes from a playbook's knowledge when the playbook is enabled (each thing the organization's Team Playbook learns is a playbook). Nobody can edit one, and only organization owners and admins can delete one. Only they see who enabled it (`created_by`). properties: id: { type: string, format: uuid } name: { type: string } content: { type: string } kind: { type: string, enum: [document, prompt] } variables: type: array items: { type: string } description: Declared template variable names (prompts only; empty for documents) scope: { type: string, enum: [org, project] } project_id: { type: string, format: uuid, description: Omitted for org-wide entries } folder: { type: string, description: Omitted when the entry has no folder } created_by: type: string format: uuid nullable: true description: | The entry's author. Null once the author's account has been deleted. On a Team Playbook entry it is the owner or admin who enabled the playbook, and it is null unless the caller is one of the organization's owners or admins using their own token. A session's sandbox token and an app connected through the Crios MCP server get null whatever their user's role. created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } version: { type: integer, description: 'Create response of a prompt only: the version recorded (1)' } org_agent_skill_id: { type: string, format: uuid, description: "Only on a Team Playbook entry: the skill id of the playbook it belongs to. Omitted on every other entry" } org_agent_name: { type: string, description: "Only on a Team Playbook entry: that playbook's name" } KnowledgeCodedError: type: object description: Error body. A refusal on a Team Playbook entry adds `code`, which a client can branch on; other errors carry only `error`. properties: error: { type: string } code: { type: string, enum: [org_agent_knowledge] } SessionAttachment: type: object properties: id: { type: string, format: uuid } session_id: { type: string, format: uuid } filename: { type: string } content_type: { type: string } size_bytes: { type: integer, format: int64 } kind: { type: string, enum: [image, pdf, document, text, archive] } sandbox_path: { type: string, description: 'Path in the sandbox: /workspace/.crios/attachments/-' } vision_description: { type: string, description: 'Image description, filled asynchronously after upload; omitted when empty' } inline_truncated: { type: boolean, description: The stored text extract was truncated } created_at: { type: string, format: date-time } ExternalTicket: type: object description: An external work item captured by intake (Jira, GitHub or Slack). properties: id: { type: string, format: uuid } source: { type: string, enum: [github_issue, jira_ticket, slack_message] } source_id: { type: string } source_url: { type: string } project_id: { type: string, description: Empty until a project is resolved or assigned } session_id: { type: string, description: Empty until a session is dispatched } organization_id: { type: string, description: 'Empty when the ticket resolved to no organization; only instance admins see such tickets' } status: { type: string, description: 'Legacy mirror of intake_status (pending, in_progress, completed, failed); use intake_status' } intake_status: { type: string, enum: [received, dispatching, working, pr_ready, done, failed, dismissed, unresolved] } title: { type: string } body: { type: string, description: Cut to 500 characters in list responses } requested_by: { type: string } requester_display: { type: string } trigger_kind: { type: string, enum: [assignee, mention, label, slash, nl] } error_message: { type: string } attempts: { type: integer } last_dispatched_at: { type: string, format: date-time, description: Omitted until the first dispatch } raw_payload: { type: object, additionalProperties: true, nullable: true, description: Original webhook payload; null in list responses } converted_spec: { type: object, additionalProperties: true, nullable: true, description: Null in list responses } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } ProviderConfig: type: object description: One LLM provider of an organization. Secrets are never returned. properties: provider: { type: string, description: Provider slug } name: { type: string, description: Same as provider } enabled: { type: boolean } display_name: { type: string } api_base: { type: string, description: Omitted when unset } protocol: { type: string, enum: [native, openai, anthropic], description: native = builtin hand-written client } is_builtin: { type: boolean } api_key_set: { type: boolean } key_source: type: string enum: [org, legacy, db, none] description: Where the key resolves. org = the organization's own secret; legacy = the pre-multi-org instance-wide key (read-only fallback until the organization saves its own, available only to organizations that existed when platform migration 189 ran, and only for a built-in provider at its default address); db = stored on the provider row (no secret store); none = no key extra_headers: type: object additionalProperties: { type: string } description: Omitted when none are set health_status: { type: string, description: "healthy, unknown, or \"unhealthy: \"" } last_tested_at: { type: string, format: date-time } model_count: { type: integer, description: Catalog rows for this provider } last_sync_at: { type: string, format: date-time, description: Most recent catalog change for this provider } models: { type: array, items: { type: string }, description: Selectable model IDs } model_options: type: array items: { $ref: '#/components/schemas/ModelOption' } ModelRouting: type: object description: One session type's effective routing in an organization. properties: session_type: { type: string } primary_provider: { type: string } primary_model_id: { type: string } fallback_provider: { type: string, description: Omitted when no fallback is set } fallback_model_id: { type: string, description: Omitted when no fallback is set } configured: { type: boolean, description: The organization saved this row (false = compiled-in default or inherited) } inherited_from: { type: string, description: Coarse session type an unsaved row mirrors } updated_at: { type: string, format: date-time, description: Present for saved rows } LoginResponse: type: object description: | Session tokens plus the signed-in user. When the password step needs a second factor the response instead carries `mfa_required` (enrolled: verify a code) or `mfa_setup_required` (the organization mandates MFA: enroll now), a 5-minute `mfa_token` that only the `/auth/mfa/*` endpoints accept, and a `user` with only `email` and `name`; no session tokens are issued until the second factor is proven. properties: access_token: { type: string, description: JWT access token (24 hours) } refresh_token: { type: string, description: Rotating refresh token (7 days) } user: type: object properties: id: { type: string, format: uuid } email: { type: string, format: email } name: { type: string } organization_id: { type: string, format: uuid } role: { type: string, enum: [owner, admin, member, viewer] } is_instance_admin: { type: boolean } email_verified: type: boolean description: | Whether the email address is verified, as GET /users/me reports it. After POST /auth/register it is false when a verification link was mailed and true when the deployment has no mailer. The responses of POST /auth/mfa/verify, POST /auth/mfa/enable and POST /auth/switch-org currently always report false. backup_codes: type: array items: { type: string } description: One-time recovery codes; only from POST /auth/mfa/enable, shown once mfa_required: { type: boolean } mfa_setup_required: { type: boolean } mfa_token: { type: string, description: MFA stepping-stone token (5 minutes) } TokenPair: type: object properties: access_token: { type: string } refresh_token: { type: string, description: Replacement refresh token; the one sent is revoked } expires_at: { type: string, format: date-time, description: Access-token expiry } Empty: type: object StatusMessage: type: object properties: status: { type: string, description: Human-readable outcome message } APIToken: type: object description: A personal API token (secret shown only once at creation). properties: id: { type: string, format: uuid } name: { type: string } token_prefix: { type: string, description: 'Display prefix of the secret, e.g. "crios_pat_abc12345"' } scopes: type: array items: { type: string } description: 'Either ["*"] or ":read|write" atoms (resources: sessions, projects, memory, llm, sandboxes, integrations, costs, organization, admin)' project_id: { type: string, description: Project the token is restricted to; empty string when org-wide } project_name: { type: string, description: Name of the restricting project; empty string when org-wide } created_at: { type: string, format: date-time } expires_at: { type: string, format: date-time, nullable: true } last_used_at: { type: string, format: date-time, nullable: true } revoked_at: { type: string, format: date-time, nullable: true } LicenseStatus: type: object description: License state of this deployment. Payload-derived fields are present only when a license key is loaded. properties: state: { type: string, enum: [valid, grace, expired, invalid, unlicensed] } reason: { type: string, description: Why the license is in its current state } enforcement: { type: string, enum: [warn, enforce] } renew_url: { type: string } checked_at: { type: string, format: date-time } fingerprint: { type: string, description: Instance fingerprint (present when computable) } lid: { type: string, description: License ID } edition: { type: string } org_name: { type: string } customer: { type: string } features: type: array items: { type: string } limits: type: object description: Zero or absent means uncapped properties: max_nodes: { type: integer } max_concurrent_runs: { type: integer } max_users: { type: integer } max_org_members: { type: integer, description: Members per organization (enforced) } max_workflows_per_org: { type: integer, description: Workflows per organization (enforced) } expires_at: { type: string, format: date-time } grace_until: { type: string, format: date-time } grace_days_left: { type: integer, description: Only present while state is grace } ModelOption: type: object description: One selectable LLM model. Pricing fields are present only when a price is known. properties: id: { type: string, description: Model identifier used in routing } name: { type: string } provider: { type: string } context_window: { type: integer } max_context_tokens: { type: integer } request_timeout_seconds: { type: integer } supports_vision: { type: boolean } price_source: { type: string } price_approximate: { type: boolean } input_cost_per_1m: { type: number, description: USD per 1M input tokens } output_cost_per_1m: { type: number, description: USD per 1M output tokens } ConnectorRepo: type: object description: A repository visible to the connected source-control account. properties: full_name: { type: string } description: { type: string } private: { type: boolean } default_branch: { type: string } html_url: { type: string } pushed_at: { type: string, format: date-time, description: Omitted when unknown } PlaybookEffectiveness: type: object description: One published playbook rule and how the sessions it was injected into fared. properties: playbook_id: { type: string, format: uuid } name: { type: string } scope: { type: string } is_active: { type: boolean } applied_sessions: { type: integer } shipped: { type: integer } abandoned: { type: integer } failed: { type: integer } failures_before: { type: integer } failures_after: { type: integer } ship_rate: { type: number } verdict: { type: string, enum: [helping, dead, inconclusive] } dead: { type: boolean, description: Mirrors verdict == dead for cheap filtering } SelectableAgentProfile: type: object description: An agent profile selectable for this project (project-scoped plus org-wide). properties: id: { type: string, format: uuid } name: { type: string } identifier: { type: string } description: { type: string } when_to_use: { type: string } session_types: type: array items: { type: string } scope: { type: string } ProjectEnvVar: type: object required: [name, sensitive] properties: name: { type: string, description: 'Must match ^[A-Za-z_][A-Za-z0-9_]{0,127}$' } value: { type: string, description: Omitted on read for sensitive vars (write-only) } sensitive: { type: boolean } ProjectShare: type: object description: A share grant on a project. Exactly one of the user_* or group_* field sets is present. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } role: { type: string, enum: [viewer, editor] } created_at: { type: string, format: date-time } user_id: { type: string, format: uuid, description: Present for user grants } user_email: { type: string, description: Present for user grants } user_name: { type: string, description: Present for user grants } group_id: { type: string, format: uuid, description: Present for group grants } group_name: { type: string, description: Present for group grants } Publication: type: object description: | A project's deployment on the cluster. A project has at most one publication; publishing again updates it in place. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } status: type: string enum: [draft, planning, generating, building, deploying, awaiting_dns, issuing_cert, live, failed, unpublished] description: | planning and generating: a publishing agent session prepares the deploy assets. building: images are being built. deploying: the app is being installed. awaiting_dns: deployed; the domain's A record must point at lb_ips. issuing_cert: DNS resolves and the TLS certificate is being issued. live: serving at url. domain: { type: string } slug: { type: string, description: Cluster-unique app identifier derived from the project; kept across republishes } lb_ips: type: array items: { type: string } description: Load-balancer IPs the domain's DNS A record must point at components: type: array items: { $ref: '#/components/schemas/PublicationComponent' } description: Deployable units from the publish manifest of the current deployment chart_ref: { $ref: '#/components/schemas/PublicationChartRef' } conditions: type: array items: { $ref: '#/components/schemas/PublicationCondition' } description: Pipeline conditions reported by the cluster component_status: type: array items: { $ref: '#/components/schemas/PublicationComponentStatus' } description: Per-component image build state reported by the cluster url: { type: string, description: Public URL once live; empty before that and after unpublish } error: { type: string, description: Why the publication failed; empty otherwise } protected: { type: boolean, description: True when a site password gates the app (the password is never returned) } ssl_provider: { type: string, enum: [letsencrypt, zerossl, google, custom], description: Certificate authority for the domain } seed_on_boot: { type: boolean, description: "Run the repository's seed script on every container start (applied on the next publish)" } auto_repair_attempts: { type: integer, description: 'Repair sessions the platform started for this run; reset by a manual publish or republish and when the app goes live' } fast_path: { type: boolean, description: 'True when the app was published with no agent session: on the platform-owned chart, or by adopting the repository''s committed publish chart. Republishing then re-detects the stack (or re-adopts the chart) instead of starting a session' } publish_session_id: { type: string, format: uuid, nullable: true, description: The publishing agent session of the current run; null for session-less publishes } head_revision: { type: string, description: 'GET of a live publication only: the commit at the head of the default branch. Omitted when the repository cannot be checked.' } update_available: { type: boolean, description: 'GET of a live publication only: true when the default branch content differs from the published revision (compared by tree, so merge-only commits do not count). Omitted when unknown.' } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } SessionArtifact: type: object properties: id: { type: string, format: uuid } session_id: { type: string, format: uuid } filename: { type: string } title: { type: string, description: Omitted when empty } description: { type: string, description: Omitted when empty } content_type: { type: string } size_bytes: { type: integer } kind: { type: string, enum: [chart, diagram, spreadsheet, document, data, image, other] } source_tool: { type: string, description: Omitted when empty } sandbox_path: { type: string } has_preview: { type: boolean } data_url: { type: string, description: API path to download the artifact bytes; omitted when empty } preview_url: { type: string, description: API path to the PNG preview; omitted when empty } created_at: { type: string, format: date-time } SessionOutput: type: object description: Something a session made besides its app. A soft reference to the thing by id. properties: id: { type: string, format: uuid } kind: { type: string, enum: [workflow, agent, skill], description: Only workflow is recorded today } ref_id: { type: string, format: uuid, description: The thing's id in its own store (a workflow id) } origin: { type: string, enum: [created, edited], description: How the session first met the thing; it never changes } name: { type: string, description: The thing's name at the session's last save } first_version: { type: integer, nullable: true, description: The version the session's first write produced } last_version: { type: integer, nullable: true, description: The newest version the session saved } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } Group: type: object properties: id: { type: string, format: uuid } name: { type: string } description: { type: string } member_count: { type: integer } project_count: { type: integer, description: Non-deleted projects shared with the group } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } GroupMember: type: object properties: user_id: { type: string, format: uuid } email: { type: string } name: { type: string } added_at: { type: string, format: date-time } BackupDestination: type: object description: | Resolved effective backup destination: the override Secret when it sets a bucket, else the chart values baked into the backup CronJob, else none. Credentials are never returned — only a masked access key. properties: source: { type: string, enum: [secret, values, none] } provider: { type: string } bucket: { type: string } endpoint: { type: string } region: { type: string } prefix: { type: string } access_key_masked: { type: string } has_credentials: { type: boolean } BackupJob: type: object properties: name: { type: string } manual: { type: boolean } state: { type: string, enum: [pending, running, succeeded, failed] } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time } ConnectorField: type: object properties: key: { type: string } secret: { type: boolean } set: { type: boolean } value: { type: string, description: "Returned for non-secret fields only, never for a platform field" } preview: { type: string, description: "Masked preview for secret fields, never for a platform field" } source: type: string enum: [vault-org, vault-legacy, env, platform, none] description: vault-org = this organization's settings; vault-legacy / env = pre-multi-org fallbacks (oldest organization only); platform = the deployment's shared OAuth app (the Crios app), which an organization without an app of its own connects through OrgAuthenticator: type: object description: An organization's TOTP key. The setup key and its Vault path are never included. required: [id, name, issuer, logo_url, algorithm, digits, period, created_at, updated_at] properties: id: { type: string, format: uuid } name: { type: string } issuer: { type: string } logo_url: { type: string, description: Optional https address of a logo. Empty when none was set. } algorithm: { type: string, enum: [SHA1, SHA256, SHA512] } digits: { type: integer, minimum: 6, maximum: 10 } period: { type: integer, minimum: 1, maximum: 3600, description: Code window in seconds } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } OrgAuthenticatorCode: type: object description: One live TOTP code, computed from the server's Unix clock. expires_at is the first moment it is no longer valid, in UTC. required: [code, seconds_remaining, expires_at, period, digits] properties: code: { type: string, description: The current digits. Not written to the audit log. } seconds_remaining: { type: integer, minimum: 0, description: Seconds until expires_at, from the server clock } expires_at: { type: string, format: date-time } period: { type: integer } digits: { type: integer } ConnectorStatus: type: object properties: name: { $ref: '#/components/schemas/OrgConnectorName' } configured: { type: boolean, description: The connector has the minimum fields to be usable } source: type: string enum: [vault-org, vault-legacy, env, platform, mixed, none] description: mixed = the organization's own values combined with legacy fallbacks; platform = only the Crios app's OAuth fields are set webhook_url: type: string description: "Inbound webhook URL, only when a public base URL is configured: /api/v1/webhooks/{jira|slack}/{organization id} for jira and slack, the shared /api/v1/webhooks/github for github" fields: type: array items: { $ref: '#/components/schemas/ConnectorField' } env_fallback: type: boolean description: Below the organization's own settings, resolution continues to the instance's (the oldest organization only), so DELETE falls back to them; for every other organization DELETE removes the saved settings bound_secrets: type: object additionalProperties: type: array items: { type: string } description: "Each secret that belongs with other fields, mapped to them (jira: api_token → host, email; gitlab: access_token → base_url). A save that changes one of them without the secret clears the saved secret, and a test with such a change is refused" poll_issue: type: object description: telegram only. Why Telegram refuses the bot's messages to Crios, as the long poller last heard it properties: reason: type: string enum: [webhook_set, token_rejected] description: webhook_set = the bot hands its messages to a webhook; token_rejected = Telegram does not know the token since: { type: string, format: date-time, description: When the poller first heard it } ConnectorTestResult: type: object properties: ok: { type: boolean } latency_ms: { type: integer, format: int64 } identity: { type: string, description: Human-readable identity the credentials resolve to } detected: type: object additionalProperties: { type: string } description: Detected settings (e.g. bot_account_id, bot_user_id) error: { type: string } check: type: string enum: [client, presence] description: "OAuth-app connectors only: what a passing test proved. client = the provider accepted the client ID and secret (google, discord); presence = both are filled in, which only a member's sign-in proves (x, instagram, facebook, tiktok)" ModelCatalogEntry: type: object properties: provider: { type: string } model_id: { type: string } display_name: { type: string } max_context_tokens: { type: integer } supports_vision: { type: boolean } supports_tools: { type: boolean, description: false = the model uses the emulated tool protocol } enabled: { type: boolean } source: { type: string, description: "Catalog row origin (e.g. manual, import, sync source)" } available: { type: boolean } updated_at: { type: string, format: date-time } price_source: type: string enum: [override_env, synced, manual, approx_slug, builtin_default, unknown] price_approximate: { type: boolean } input_cost_per_1m: { type: number, description: Omitted when price_source=unknown } output_cost_per_1m: { type: number, description: Omitted when price_source=unknown } cache_read_cost_per_1m: { type: number, description: Present when a cache-read price is known } cache_write_cost_per_1m: { type: number, description: Present when a cache-write price is known } price_synced_at: { type: string, format: date-time } ModelSyncSourceStatus: type: object properties: source: { type: string } enabled: { type: boolean } interval_seconds: { type: integer } url: { type: string } last_success_at: { type: string, format: date-time, nullable: true } last_attempt_at: { type: string, format: date-time, nullable: true } last_error: { type: string } models_seen: { type: integer } UsageTotals: type: object properties: input_tokens: { type: integer, format: int64 } output_tokens: { type: integer, format: int64 } cached_input_tokens: { type: integer, format: int64 } cache_creation_input_tokens: { type: integer, format: int64 } total_tokens: { type: integer, format: int64 } cost_usd: { type: number } call_count: { type: integer, format: int64 } WorkflowApiError: type: object description: | Error envelope of the workflow API. `code` is a stable machine code (for example `invalid_request`, `not_found`, `forbidden`, `name_conflict`, `version_conflict`, `validation_failed`, `workflow_active`, `triggers_unavailable`, `unavailable`, `internal_error`, `oauth2_not_configured`, `no_application_client`, `memory_locked`, `wait_expired`, `approval_decision_required`, `credential_in_use`, `service_in_use`, `telegram_session_bot`, `telegram_bot_registered`, `telegram_bot_unverified`). A 404's `error` names what was not found: the resource for by-id routes (`execution not found`), `project not found` for a project the caller cannot access. `error` never quotes secret material. Some codes carry extra fields: `validation_failed` attaches `issues`; `version_conflict` attaches `current_version` and `checksum`; `checksum_mismatch` attaches `checksum` (plus `version` for agents); `workflow_limit_reached` attaches `limit`. Errors raised by the platform middleware (for example the viewer write guard) carry only `error`. properties: error: { type: string, description: Human-readable message } code: { type: string } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } current_version: { type: integer, description: The current draft version (version_conflict) } checksum: { type: string, description: The current checksum (version_conflict or checksum_mismatch) } version: { type: integer } limit: { type: integer, description: The organization's workflow cap (workflow_limit_reached) } saved: { type: boolean, description: 'Agent publish only: the draft was saved even though activation was refused' } WorkflowValidationIssue: type: object description: One finding of the validation pipeline. properties: code: { type: string, description: 'Stable machine code, e.g. unknown_connection_target, credential_unbound, invalid_shape (a value the document cannot hold), host_access_disabled' } path: type: array description: JSON path to the offending field, mixing keys and indexes (e.g. ["edges", 3, "to"]) items: oneOf: - { type: string } - { type: integer } message: { type: string } severity: { type: string, enum: [error, warning], description: error blocks the operation; warning does not } WorkflowDocument: type: object description: | The canonical workflow definition document. Unlike the rest of the API, the document is camelCase. It is the body of create/save requests and the `workflow` of every read. Server-owned fields (`version`, `activeVersion`, `checksum` and the audit fields) are ignored on write; `id` is honored only on create (import). `projectId` is required on create; on a save it may be omitted. Unknown fields are dropped. required: [apiVersion, name] properties: apiVersion: { type: string, enum: [crios.io/v1] } id: { type: string, format: uuid } projectId: { type: string, format: uuid } name: { type: string, minLength: 1, maxLength: 200, description: Unique per project (case-insensitive) } description: { type: string, maxLength: 2000 } tags: type: array maxItems: 20 items: { type: string, maxLength: 40, pattern: '^[a-z0-9]+(?:[-_][a-z0-9]+)*$' } nodes: type: array description: May be empty in a draft items: { $ref: '#/components/schemas/WorkflowNode' } edges: type: array items: { $ref: '#/components/schemas/WorkflowEdge' } groups: type: array items: { $ref: '#/components/schemas/WorkflowGroup' } annotations: type: array items: { $ref: '#/components/schemas/WorkflowAnnotation' } settings: { $ref: '#/components/schemas/WorkflowSettings' } testFixtures: type: object description: Node id to pinned output items; honored only in test executions additionalProperties: type: array items: { $ref: '#/components/schemas/WfItem' } meta: { type: object, additionalProperties: true, description: Free-form builder UI state; never read by the runtime } version: { type: integer, minimum: 1, readOnly: true, description: 'Draft counter, bumped on every save' } activeVersion: { type: integer, nullable: true, readOnly: true, description: The snapshot version triggers run; null when inactive } lastActiveVersion: { type: integer, nullable: true, readOnly: true, description: 'The version most recently live, kept when deactivating nulls activeVersion; null if never activated. Tells a paused workflow from one never published' } checksum: { type: string, readOnly: true, description: '"sha256:" + hex over the canonical form' } createdBy: { type: string, readOnly: true } createdAt: { type: string, format: date-time, readOnly: true } updatedAt: { type: string, format: date-time, readOnly: true } updatedBy: { type: string, readOnly: true } WorkflowNode: type: object required: [id, name, type, typeVersion, parameters] properties: id: { type: string, format: uuid, description: Unique across all nesting levels; immutable } name: { type: string, minLength: 1, maxLength: 120, description: Unique within the workflow; expressions reference nodes by name } type: { type: string, example: crios.agent } typeVersion: { type: integer, minimum: 1 } position: { type: array, minItems: 2, maxItems: 2, items: { type: number }, description: 'Canvas [x, y]; send it so the builder can render the node' } disabled: { type: boolean } parameters: { type: object, additionalProperties: true, description: 'Type-specific; validated against the type''s parameter schema. Strings may embed {{ }} expressions.' } credentials: type: object description: Credential slot name to connection reference; secrets never enter the document additionalProperties: { $ref: '#/components/schemas/WfNodeCredentialRef' } onError: { type: string, enum: [stopWorkflow, continueRegularOutput, continueErrorOutput], description: Absent means stopWorkflow } retryOnFail: { type: boolean, description: Unset inherits the node type's default } maxTries: { type: integer, minimum: 1, maximum: 8 } waitBetweenTriesMs: { type: integer, format: int64, minimum: 0 } alwaysOutputData: { type: boolean } executeOnce: { type: boolean } notes: { type: string } notesInFlow: { type: boolean } timeoutMs: { type: integer, format: int64 } graph: { $ref: '#/components/schemas/WorkflowSubgraph' } setup: type: object description: What the author left for a person to finish; each mark is pruned once supplied properties: pending: type: array items: type: object properties: param: { type: string, maxLength: 200, description: Dot path under parameters } slot: { type: string, description: Credential slot name } after: { type: string, description: Slot whose binding unlocks this parameter's picker } hint: { type: string, maxLength: 500 } tool: type: object description: Overrides for this node used as an agent tool properties: name: { type: string } description: { type: string } requiresApproval: { type: boolean } WorkflowEdge: type: object required: [from, fromPort, to, toPort] properties: id: { type: string, description: Optional; the runtime never uses it } from: { type: string, description: Source node id } fromPort: { $ref: '#/components/schemas/WfPort' } to: { type: string, description: Target node id } toPort: { $ref: '#/components/schemas/WfPort' } WfPort: type: object required: [type, index] properties: type: { type: string, enum: [main, error, ai_tool, ai_memory, ai_model, ai_agent, ai_embedding, ai_retriever] } index: { type: integer, minimum: 0 } WorkflowSubgraph: type: object description: Nested graph of a container node (crios.loop.map, crios.loop.while, crios.scope.try) properties: nodes: type: array items: { $ref: '#/components/schemas/WorkflowNode' } edges: type: array items: { $ref: '#/components/schemas/WorkflowEdge' } inlet: { type: string, description: Nested node receiving the container input } outlet: { type: string, description: Nested node whose output leaves the container } compensate: { $ref: '#/components/schemas/WorkflowSubgraph' } WorkflowGroup: type: object properties: id: { type: string } name: { type: string, minLength: 1, maxLength: 80 } nodeIds: { type: array, items: { type: string } } description: { type: string, maxLength: 145 } collapsed: { type: boolean } WorkflowAnnotation: type: object properties: id: { type: string } content: { type: string, maxLength: 10000, description: Markdown } position: { type: array, minItems: 2, maxItems: 2, items: { type: number } } size: { type: array, minItems: 2, maxItems: 2, items: { type: number }, description: '[width, height]' } color: { type: string } WorkflowSettings: type: object description: Execution policy. An absent key inherits the platform default. properties: errorWorkflowId: { type: string, format: uuid, description: 'Workflow started when a production-class run of this one fails, times out or crashes. It must be active in the same project; it starts from its Error trigger, or else its Manual trigger' } executionTimeoutMs: { type: integer, format: int64, minimum: 1, maximum: 86400000, description: 'Default 3600000. Caps active time: time parked on a wait (approval, delay, signal, form, sub-workflow) does not count' } timezone: { type: string, description: IANA name; default UTC } callerPolicy: { type: string, enum: [any, none, workflowsFromAList, workflowsFromSameProject, workflowsFromSameOrg], description: Default workflowsFromSameProject } callerIds: { type: array, items: { type: string, format: uuid } } saveDataErrorExecution: { type: string, enum: [all, none], description: 'Not enforced: none draws a setting_not_enforced warning' } saveDataSuccessExecution: { type: string, enum: [all, none], description: 'Not enforced: none draws a setting_not_enforced warning' } saveManualExecutions: { type: boolean, description: 'Not enforced: false draws a setting_not_enforced warning' } maxNodeExecutions: { type: integer, description: Default 10000 } concurrency: { type: integer, description: 'Not enforced (no admission gate yet): any value draws a setting_not_enforced warning' } binaryMode: { type: string, enum: [separate, combined], description: 'Not enforced: combined draws a setting_not_enforced warning' } timeSavedPerExecutionSec: { type: integer } description: { type: string, description: What the workflow does when called as a tool or sub-workflow } inputSchema: { type: object, additionalProperties: true, description: Object JSON Schema of the input callers pass } WfNodeCredentialRef: type: object required: [id] properties: id: { type: string, description: Credential (connection) id } name: { type: string, description: Display label } WfItem: type: object description: One execution item properties: json: { type: object, additionalProperties: true } binary: type: object additionalProperties: type: object properties: id: { type: string, description: Artifact id } mimeType: { type: string } fileName: { type: string } bytes: { type: integer, format: int64 } pairedItem: type: object properties: item: { type: integer } input: { type: integer } WorkflowSetupChecklist: type: object description: What is left before the draft can be activated. Connections come first, then parameters. properties: items: type: array items: { $ref: '#/components/schemas/WorkflowSetupItem' } ready: { type: boolean, description: True when nothing blocks activation } WorkflowSetupItem: type: object properties: kind: { type: string, enum: [connection, parameter] } node_id: { type: string } node_name: { type: string } node_type: { type: string } path: { type: string, example: 'nodes[1].credentials.telegram' } slot: { type: string } cred_type: { type: string } required: { type: boolean } param: { type: string } after: { type: string } hint: { type: string } action: { type: string, enum: [bind, fill] } WorkflowDiff: type: object description: Structural difference between two versions. Empty lists are omitted. properties: nodes: type: array items: type: object properties: nodeId: { type: string } kind: { type: string, enum: [added, removed, modified] } changedFields: { type: array, items: { type: string } } edgesAdded: type: array items: { $ref: '#/components/schemas/WorkflowEdge' } edgesRemoved: type: array items: { $ref: '#/components/schemas/WorkflowEdge' } groups: type: array items: { $ref: '#/components/schemas/WfKeyedChange' } annotations: type: array items: { $ref: '#/components/schemas/WfKeyedChange' } settingsChanged: { type: array, items: { type: string } } fixtures: type: array items: { $ref: '#/components/schemas/WfKeyedChange' } WfKeyedChange: type: object properties: key: { type: string } kind: { type: string, enum: [added, removed, modified] } WorkflowListItem: type: object description: Workflow metadata as listed; the document itself is behind GET /workflows/{id}. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } name: { type: string } description: { type: string } tags: { type: array, items: { type: string } } version: { type: integer } active_version: { type: integer, nullable: true } last_active_version: { type: integer, nullable: true, description: 'The version most recently live, kept when deactivating nulls active_version; null if never activated' } checksum: { type: string } created_by: { type: string } updated_by: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } needs_setup: { type: boolean, description: The draft still has a required connection or parameter to supply } setup_count: { type: integer, description: 'How many required connections or parameters the draft still has open (0 when needs_setup is false)' } WorkflowWriteResult: type: object description: Response of a create, save, restore or fixtures write, and of GET /workflows/{id}. properties: workflow: { $ref: '#/components/schemas/WorkflowDocument' } issues: type: array description: Non-blocking validation findings of the draft items: { $ref: '#/components/schemas/WorkflowValidationIssue' } setup: { $ref: '#/components/schemas/WorkflowSetupChecklist' } needs_setup: { type: boolean } WorkflowVersionSummary: type: object properties: version: { type: integer } checksum: { type: string } created_by: { type: string } created_at: { type: string, format: date-time } WorkflowToolManifest: type: object description: The tools an agent's model would be handed, derived by the same code the runtime uses. properties: node_id: { type: string } node_name: { type: string } agent_id: { type: string, description: Set when the node references a stored agent } complete: { type: boolean, description: False when part of the manifest cannot be derived from the document (a referenced stored agent's own tools) } tools: type: array items: { $ref: '#/components/schemas/WorkflowToolManifestEntry' } errors: { type: array, items: { type: string }, description: Wiring problems of the agent placement } WorkflowToolManifestEntry: type: object properties: name: { type: string } description: { type: string } parameters: { type: object, additionalProperties: true, description: JSON Schema of the arguments the model fills } source: { type: string, enum: [canvas, definition] } node_id: { type: string } kind: { type: string, description: 'Binding kind of a definition tool: node, workflow, agent, mcp or builtin' } requires_approval: { type: boolean } returns: { type: string } err: { type: string, description: Why this binding will not run; such a tool is not offered to the model } WorkflowNodeType: type: object description: Descriptor of one node type at one major version. Labels are i18n keys. properties: type: { type: string, example: crios.slack } version: { type: integer } kind: { type: string, enum: [action, trigger, webhook, container] } category: { type: string } meta: type: object properties: labelKey: { type: string } descriptionKey: { type: string } usage: { type: string, description: English long-form documentation } icon: { type: string } docsUrl: { type: string } keywords: { type: array, items: { type: string } } deprecated: type: object properties: replacement: { type: string } since: { type: string } inputs: type: array items: { $ref: '#/components/schemas/WfNodePortDecl' } outputs: type: array items: { $ref: '#/components/schemas/WfNodePortDecl' } parameters: { type: object, additionalProperties: true, description: JSON Schema of the parameters object with x-ui / x-expression / x-sensitive annotations } credentials: type: array items: type: object properties: slot: { type: string } credType: { type: string } required: { type: boolean } visibleWhen: { type: object, additionalProperties: true } autoBind: { type: string, enum: [any, managed_only, never] } mode: { type: string, enum: [batch, each] } sideEffects: { type: string, enum: [none, idempotent, keyed, atLeastOnce] } defaults: type: object properties: retryOnFail: { type: boolean } maxTries: { type: integer } waitBetweenTriesMs: { type: integer, format: int64 } timeoutMs: { type: integer, format: int64 } tool: type: object properties: name: { type: string } description: { type: string } annotations: type: object properties: readOnly: { type: boolean } destructive: { type: boolean } idempotent: { type: boolean } returns: { type: string } options: { type: array, items: { type: string }, description: Names of the dynamic option resolvers } canMigrateParams: { type: boolean } WfNodePortDecl: type: object properties: type: { type: string } index: { type: integer } required: { type: boolean } joinPolicy: { type: string, enum: [all, any, race, quorum] } quorum: { type: integer } joinPolicyFromParams: { type: boolean } data: { type: object, additionalProperties: true, description: Item shape the output port emits } WorkflowDetail: description: GET /workflows/{id} response. allOf: - { $ref: '#/components/schemas/WorkflowWriteResult' } - type: object properties: tool_manifests: type: array nullable: true description: What each agent node's model would be handed; null when the graph does not compile items: { $ref: '#/components/schemas/WorkflowToolManifest' } access: { $ref: '#/components/schemas/WorkflowAccess' } capabilities: { $ref: '#/components/schemas/WorkflowCapabilities' } WorkflowAccess: type: string enum: [viewer, editor, manager] description: | What the caller may do with the workflow or agent they opened, so an editor can render read-only instead of letting a viewer edit and fail on save. `viewer`: read only. `editor`: a save would be accepted (editor access to the project and the RBAC write action: `workflow.write` for a workflow, the agent write action for an agent). `manager`: manage access to the project. Project editors whose role the RBAC policy refuses the write action read as `viewer`. WorkflowCapabilities: type: object required: [write, run, control] description: | What the caller may do to the workflow they opened, one boolean per group of routes, each computed from the project access level and the RBAC action those routes enforce. It reports the checks and grants nothing: a route still answers 403 by itself. `access` says `editor` or `manager` exactly when `write` is true; `run` and `control` can differ from it where a policy sets those actions apart. The field is additive: a client that does not read it keeps working from `access`. properties: write: type: boolean description: | Editor access to the project and `workflow.write`: saving the draft (`PATCH /workflows/{id}`), replacing and capturing fixtures, replacing the variables, restoring a version and deleting. Not covered, because their routes check another action: publishing and pausing (`workflow.activate`, also needed to force-delete an active workflow), changing, locking, deleting or purging memory (`memory.write`), and saving a draft that holds a host-access node (`workflow.host_access`) or a write-enabled `crios.api` node (`workflow.api_write`). The default roles of all four equal those of `workflow.write`; under a policy that sets one apart, that action answers 403 by itself. run: type: boolean description: | Editor access to the project and `execution.run`: starting a test, production or partial run (`POST /workflows/{id}/executions`). control: type: boolean description: | Editor access to the project and `execution.control`: cancelling, signalling and retrying an execution of this workflow. WorkflowTemplateSummary: type: object properties: id: { type: string, format: uuid } name: { type: string } description: { type: string } tags: { type: array, items: { type: string } } created_by: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } WorkflowTemplate: description: A gallery template with its document (credential slots unbound). allOf: - { $ref: '#/components/schemas/WorkflowTemplateSummary' } - type: object properties: definition: { $ref: '#/components/schemas/WorkflowDocument' } WfCredentialTypeEntry: type: object properties: type: { type: string, example: slack } label_key: { type: string, description: i18n key of the display name } config_schema: { type: object, nullable: true, additionalProperties: true, description: JSON Schema of the non-secret config; null when the type takes none } secrets_schema: { type: object, nullable: true, additionalProperties: true, description: JSON Schema of the secrets; null when the type declares none } primary_secret: { type: string, description: The secret field a single-string import binds to } destination_fields: { type: array, items: { type: string }, description: 'The declared config fields whose change must be sent together with secrets (PATCH /workflows/credentials/{id}). Destination by default: every config field is listed unless the type exempts it, and a key the schema does not declare is one too. Never null' } closed_config: { type: boolean, description: 'The type refuses config keys its schema does not declare; omitted when false' } auth_method: { type: string, description: 'For example oauth2, api_key, token, basic, hmac, jwt_bearer, secret' } WfCredentialServiceEntry: allOf: - { $ref: '#/components/schemas/WfCredentialTypeEntry' } - type: object properties: service: { type: string } category: { type: string } doc_url: { type: string } logo: { type: string } testable: { type: boolean, description: A connectivity Test is available } enabled: { type: boolean, description: False when an operator disabled the service or no connected-account flow is wired for a bridge type } provider: { type: string, description: Provider card grouping key } categories: { type: array, items: { type: string } } keywords: { type: array, items: { type: string } } display_name: { type: string } description: { type: string } source: { type: string, description: 'code (built in) or db (operator-added); MCP rows carry their own source' } token_fallback: { type: boolean, description: 'MCP rows: a static API key is accepted beside the OAuth login' } bridge_of: { type: string, description: Type a connected-account bridge row resolves as } actor: { type: string, enum: [service, individual], description: Who a connection of this type acts as } application_client: type: object description: 'OAuth2 browser-flow types only: whether "Use application integration" can be offered' properties: available: { type: boolean } source: { type: string, enum: [platform_app, service_client] } family: { type: string } scopes: { type: array, items: { type: string } } consumers: { type: array, items: { type: string }, description: Node types with a slot this type satisfies } WorkflowRunAccepted: type: object properties: execution_id: { type: string, format: uuid } status: { type: string, enum: [pending, running, waiting, succeeded, failed, timed_out, cancelled, crashed] } WorkflowExecutionSummary: type: object properties: id: { type: string, format: uuid } workflow_id: { type: string, format: uuid } project_id: { type: string, format: uuid } version: { type: integer, description: The workflow version this execution runs } status: { type: string, enum: [pending, running, waiting, succeeded, failed, timed_out, cancelled, crashed] } mode: { type: string, enum: [production, test, partial, retry, subworkflow] } trigger_kind: { type: string, description: 'What started it, e.g. manual, webhook, schedule, retry, partial, agent_chat' } stats: { $ref: '#/components/schemas/WfExecStats' } created_at: { type: string, format: date-time } started_at: { type: string, format: date-time, nullable: true } finished_at: { type: string, format: date-time, nullable: true } WorkflowExecution: type: object properties: id: { type: string, format: uuid } workflow_id: { type: string, format: uuid } project_id: { type: string, format: uuid } version: { type: integer } status: { type: string, enum: [pending, running, waiting, succeeded, failed, timed_out, cancelled, crashed] } mode: { type: string, enum: [production, test, partial, retry, subworkflow] } trigger: type: object description: What started the execution (camelCase document) properties: kind: { type: string } nodeId: { type: string } summary: { type: string } parentStepId: { type: string, description: The calling step of a sub-workflow execution } depth: { type: integer, description: Sub-workflow nesting level } dedupe_key: { type: string } parent_execution_id: { type: string, format: uuid } root_execution_id: { type: string, format: uuid } error: { type: object, additionalProperties: true, description: Terminal error summary } stats: { $ref: '#/components/schemas/WfExecStats' } created_at: { type: string, format: date-time } started_at: { type: string, format: date-time, nullable: true } finished_at: { type: string, format: date-time, nullable: true } WfExecStats: type: object description: Terminal roll-up, written when the execution finishes properties: steps: { type: integer } tokensIn: { type: integer, format: int64 } tokensOut: { type: integer, format: int64 } costUsd: { type: number } durationMs: { type: integer, format: int64 } WorkflowJournalEvent: type: object properties: seq: { type: integer } at: { type: string, format: date-time } type: { type: string, example: step.finished } payload: { type: object, additionalProperties: true, description: Event-specific payload } WorkflowStep: type: object description: >- One attempt of one step. input_refs and output appear only on the per-step read. warnings, skip_reason, substitution, fixture_key and skip_cause are read from the execution's journal on every request and are present only when they have a value. properties: execution_id: { type: string, format: uuid } step_id: { type: string } node_id: { type: string } iteration_path: { type: string, description: Position inside loops; empty at the top level } attempt: { type: integer } status: { type: string, enum: [scheduled, running, succeeded, failed, skipped, cancelled] } run_after: { type: string, format: date-time } started_at: { type: string, format: date-time, nullable: true } finished_at: { type: string, format: date-time, nullable: true } error: type: object properties: type: { type: string, enum: [input, transient, fatal] } message: { type: string } details: { type: object, additionalProperties: true } metrics: type: object properties: durationMs: { type: integer, format: int64 } items: { type: integer } tokensIn: { type: integer, format: int64 } tokensOut: { type: integer, format: int64 } costUsd: { type: number } warnings: type: array description: >- Notes the node attached to this attempt. A hint explains a result that is correct but easy to misread, such as a search that matched nothing; a warning names something to fix before the step stops succeeding. items: type: object required: [code, message] properties: code: { type: string, description: 'Machine class of the note, stable across runs', example: no_matches } message: { type: string, description: 'The note as a sentence, in English' } level: type: string enum: [hint, info] description: Absent for a warning count: type: integer minimum: 2 description: >- How many times the attempt recorded this note; absent when it was recorded once. It counts within this row only: a node that ran as several steps carries the note on each of them. skip_reason: type: string example: target description: >- The reason the engine recorded on a skipped step. It records one, `target`: the run was bounded ("Run to here") and stopped before this step. Every other skip leaves it out; skip_cause explains those. substitution: type: string example: fixture description: >- Where the output came from when the node was not called. Its one value is `fixture`: the output is a pinned fixture. fixture_key: { type: string, description: 'The pin that supplied the output; present with substitution' } skip_cause: type: object description: >- Why a skipped step was skipped, worked out from the edges the run left without items. Present on skipped steps only, and left out when the server could not work it out. When the step is fed by another skipped step, the cause names the node where the run actually stopped, however many skipped steps lie between. required: [kind] properties: kind: type: string enum: [target, no_items, upstream_failed, upstream_skipped, trigger_not_fired, unconnected, unknown] description: | - `target`: the run was bounded and stopped before this step. - `no_items`: `node_id` ran and sent no items out of `port`. - `upstream_failed`: `node_id` failed. - `upstream_skipped`: `node_id` was skipped as well, for no cause that can be named in its place. - `trigger_not_fired`: the step is fed by the trigger `node_id`, which did not start this run. - `unconnected`: nothing is connected to the step's input. - `unknown`: the journal does not say. node_id: { type: string, description: 'The node the cause names; absent for target, unconnected and unknown' } port: { type: string, description: 'The output port of node_id that stayed empty; no_items only', example: 'main[0]' } input_refs: { description: References to the step's input items } output: description: 'Output items per port ({"": [items]}), or the artifact reference {artifact_id, bytes, sha256, mime_type} of a spilled output' oneOf: - type: object additionalProperties: type: array items: { $ref: '#/components/schemas/WfItem' } - type: object properties: artifact_id: { type: string, format: uuid } bytes: { type: integer, format: int64 } sha256: { type: string } mime_type: { type: string } WorkflowExecutionAgent: type: object properties: step_id: { type: string } node_id: { type: string } state: { type: string, enum: [submitted, working, input-required, completed, canceled, failed] } turns: { type: integer } tool_calls: { type: integer } cost_usd: { type: number } iteration_path: { type: string } parent_step_id: { type: string } agent_id: { type: string, description: Absent for an inline agent } version: { type: integer, description: Agent version; absent for an inline agent } WorkflowApproval: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } execution_id: { type: string, format: uuid } workflow_id: { type: string, format: uuid } step_id: { type: string } status: { type: string, enum: [pending, approved, rejected, expired, cancelled], description: 'cancelled: the run was cancelled or failed while the approval waited' } message: { type: string, description: The request as a person reads it } policy: type: object properties: assignees: { type: array, items: { type: string }, description: User ids; empty means anyone with project access } quorum: { type: integer, description: Approvals required (0 means 1) } timeoutMs: { type: integer, format: int64 } escalateTo: { type: array, items: { type: string } } allowEdit: { type: boolean, description: Approvers may submit replacement arguments } decisions: type: array items: type: object properties: by: { type: string } at: { type: string, format: date-time } decision: { type: string, enum: [approve, reject] } comment: { type: string } arguments: { type: object, additionalProperties: true } override: { type: boolean, description: 'Present and true when a project manager who is not an assignee decided (assignee-or-admin rule)' } payload: { type: object, additionalProperties: true, description: 'Reviewer-visible context (single-approval read only)' } can_decide: { type: boolean, description: 'Single-approval read only: whether the decide route would admit the caller (editor access, the approval.decide permission, and an assignee or a project manager). It reports access, not state: a settled or expired approval is refused whatever it says' } expires_at: { type: string, format: date-time, nullable: true } created_at: { type: string, format: date-time } WfBudgetKey: type: object required: [project_id, source_kind, source_id, rule, metric] properties: project_id: { type: string, format: uuid } source_kind: { type: string, enum: [workflow, agent] } source_id: { type: string, format: uuid } rule: { type: string, enum: [per_run, per_hour, per_day] } metric: { type: string, enum: [cost_usd, tokens, calls] } WorkflowBudget: type: object properties: project_id: { type: string, format: uuid } source_kind: { type: string, enum: [workflow, agent] } source_id: { type: string, format: uuid } rule: { type: string, enum: [per_run, per_hour, per_day] } metric: { type: string, enum: [cost_usd, tokens, calls] } budget: { type: number } action: { type: string, enum: [park, fail] } used: { type: number, description: Spent in the current window } window_start: { type: string, nullable: true, description: Start of the current window; null for per_run caps and unused windows } last_update: { type: string, format: date-time } updated_by: { type: string, nullable: true } stale: { type: boolean, description: The window has passed and will reset on the next charge } WorkflowDeadLetter: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } execution_id: { type: string, format: uuid } workflow_id: { type: string, format: uuid, description: Absent when the execution was pruned } step_id: { type: string } error: { type: object, additionalProperties: true } redriven_as: { type: string, format: uuid, description: The execution a redrive started } created_at: { type: string, format: date-time } WfGenAnswers: type: object properties: answers: type: object description: Question key to option id; empty values keep the draft's reading additionalProperties: { type: string } WorkflowGenRun: type: object description: One generation run (workflow or agent kind). properties: id: { type: string, format: uuid } kind: { type: string, enum: [workflow, agent], description: May be absent on workflow runs } project_id: { type: string, format: uuid } org_id: { type: string } user_id: { type: string } session_id: { type: string, description: The attributed session (workflow runs) } options: type: object properties: questions: { type: string, enum: [shape, none] } prompt: { type: string } stage: { type: string, enum: [grounding, drafting, validating, repairing, questions, done, failed] } message: { type: string, description: Human-readable progress } error: { type: string, description: Why the run failed (stage failed) } questions: type: array description: The parked shape questions (stage questions) items: type: object properties: key: { type: string } kind: { type: string, enum: [shape] } question: { type: string } options: type: array description: 2 to 4 choices; the first is what the draft already does items: type: object properties: id: { type: string, description: The value an answer submits } label: { type: string } node: { type: string, description: The node the question is about } required: { type: boolean, description: Always false; the first option is a valid answer } result: type: object description: 'Workflow runs, stage done: the unsaved draft' properties: definition: { $ref: '#/components/schemas/WorkflowDocument' } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } warnings: { type: array, items: { type: string }, description: The model's disclosed guesses } setup: { $ref: '#/components/schemas/WorkflowSetupChecklist' } agent_result: type: object description: 'Agent runs, stage done: the unsaved agent' properties: agent: { $ref: '#/components/schemas/WorkflowAgentDefinition' } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } warnings: { type: array, items: { type: string } } setup: { $ref: '#/components/schemas/WorkflowSetupChecklist' } generation: { $ref: '#/components/schemas/WfGenMeta' } agent_name: { type: string, description: Proposed agent name (agent runs) } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time, nullable: true } WfGenMeta: type: object description: What a generation run decided on its own (for workflow drafts the same record is in the document's meta.generation) properties: runId: { type: string } at: { type: string, format: date-time } decisions: type: array items: type: object properties: question: { type: string } chosen: { type: string } alternatives: { type: array, items: { type: string } } via: { type: string } bound: type: array description: Connections the run bound automatically, with the reason items: type: object properties: node: { type: string } slot: { type: string } credentialId: { type: string } name: { type: string } why: { type: string } WorkflowAgentDefinition: type: object description: | The agent definition document (camelCase). Only the main fields are listed here; GET /workflows/agents/definition-schema serves the complete JSON Schema. properties: v: { type: integer, description: Document version (1) } persona: type: object properties: role: { type: string } goal: { type: string } backstory: { type: string } promptRef: type: object description: A knowledge prompt rendered into instructions at save time properties: entryId: { type: string } version: { type: integer, description: 0 asks for the newest; the saved reference always names a concrete version } vars: { type: object, additionalProperties: { type: string } } instructions: { type: string } model: { $ref: '#/components/schemas/WfAgentModel' } fallbackModel: allOf: - { $ref: '#/components/schemas/WfAgentModel' } nullable: true tools: type: array items: type: object description: One tool binding; the fields used depend on kind properties: kind: { type: string, enum: [node, workflow, agent, mcp, builtin] } name: { type: string } description: { type: string } requiresApproval: { type: boolean } approval: { type: object, additionalProperties: true } nodeType: { type: string } typeVersion: { type: integer } params: { type: object, additionalProperties: true } credentials: type: object additionalProperties: { $ref: '#/components/schemas/WfNodeCredentialRef' } workflowId: { type: string } waitForCompletion: { type: boolean } agentId: { type: string } agentVersion: { type: integer } mode: { type: string, enum: [call, handoff] } serverId: { type: string } toolName: { type: string } delegation: type: object properties: enabled: { type: boolean } coworkers: { type: array, items: { type: string }, description: Agent ids } webAccess: { type: boolean } knowledge: type: array items: type: object properties: scope: { type: string, enum: [project, org, all] } folders: { type: array, items: { type: string } } entryIds: { type: array, items: { type: string } } topK: { type: integer } inject: { type: string, enum: [tool, relevant] } memory: type: object properties: store: type: object properties: enabled: { type: boolean } scope: { type: string, enum: [shared, run] } injectLimit: { type: integer } injectPrefix: { type: string } injectMaxChars: { type: integer } retentionDays: { type: integer } output: type: object properties: schema: { type: object, nullable: true, additionalProperties: true } expectedOutput: { type: string } policies: type: object properties: maxIterations: { type: integer } maxCostUsd: { type: number } budgetClass: { type: string, enum: [micro, standard, unlimited] } toolChoice: { type: string, description: 'auto, none, required or name:' } approveOnBudget: { type: boolean } parallelToolCalls: { type: boolean } reflection: type: object properties: maxRounds: { type: integer } exposure: { $ref: '#/components/schemas/WfAgentExposure' } guardrails: type: object properties: input: { type: array, items: { type: object, additionalProperties: true } } output: { type: array, items: { type: object, additionalProperties: true } } WfAgentModel: type: object properties: provider: { type: string } model: { type: string } sessionType: { type: string } temperature: { type: number } maxTokens: { type: integer } credential: allOf: - { $ref: '#/components/schemas/WfNodeCredentialRef' } nullable: true WfAgentExposure: type: object properties: asTool: { type: boolean, description: Other agents may bind this agent as a tool (default true) } asWorkflowCallee: { type: boolean } callerPolicy: { type: string, enum: [any, none, workflowsFromAList, workflowsFromSameProject, workflowsFromSameOrg] } api: { type: boolean } chat: { type: boolean, description: Chat and API runs are allowed (default true) } WorkflowAgent: type: object description: An agent as read (camelCase), with its draft definition. properties: id: { type: string, format: uuid } projectId: { type: string, format: uuid } slug: { type: string } name: { type: string } description: { type: string } icon: { type: string } tags: { type: array, items: { type: string } } definition: { $ref: '#/components/schemas/WorkflowAgentDefinition' } version: { type: integer, description: Current draft version } activeVersion: { type: integer, nullable: true } lastActiveVersion: { type: integer, nullable: true, description: 'The version most recently live, kept when deactivating nulls activeVersion; null if never activated' } checksum: { type: string } status: { type: string, enum: [draft, active, archived] } archivedAt: { type: string, format: date-time, nullable: true } createdBy: { type: string } updatedBy: { type: string } createdAt: { type: string, format: date-time } updatedAt: { type: string, format: date-time } WorkflowAgentWriteResult: type: object properties: agent: { $ref: '#/components/schemas/WorkflowAgent' } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } access: allOf: - { $ref: '#/components/schemas/WorkflowAccess' } description: 'GET /workflows/agents/{id} only: what the caller may do with the agent' prompt_status: type: object description: 'GET only, when the draft binds a prompt' properties: entry_id: { type: string } name: { type: string } current: { type: integer, description: Prompt version the draft was rendered from } latest: { type: integer } stale: { type: boolean, description: A newer prompt version exists or the prompt no longer resolves } missing: { type: boolean, description: The prompt no longer resolves } WorkflowAgentSummary: type: object description: Agent metadata as listed (snake_case). properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } slug: { type: string } name: { type: string } description: { type: string } icon: { type: string } tags: { type: array, items: { type: string } } status: { type: string, enum: [draft, active, archived] } version: { type: integer } active_version: { type: integer, nullable: true } last_active_version: { type: integer, nullable: true, description: 'The version most recently live, kept when deactivating nulls active_version; null if never activated' } checksum: { type: string } created_by: { type: string } updated_by: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } model: type: object properties: provider: { type: string } model: { type: string } tool_count: { type: integer } WorkflowAgentVersionSummary: type: object properties: version: { type: integer } checksum: { type: string } created_by: { type: string } created_at: { type: string, format: date-time } provenance: { type: object, additionalProperties: true, description: 'How the version came about, e.g. restoredFrom, or the prompt it was rendered from' } WorkflowAgentRun: type: object properties: execution_id: { type: string, format: uuid } step_id: { type: string } workflow_id: { type: string, format: uuid } node_id: { type: string } iteration_path: { type: string } parent_step_id: { type: string, nullable: true } agent_version: { type: integer } mode: { type: string, enum: [production, test, partial, retry, subworkflow] } status: { type: string, enum: [submitted, completed, canceled, failed] } turns: { type: integer } tool_calls: { type: integer } cost_usd: { type: number } tokens_in: { type: integer, format: int64 } tokens_out: { type: integer, format: int64 } error_kind: { type: string, nullable: true } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time, nullable: true } WorkflowAgentStats: type: object properties: agent_version: { type: integer } runs: { type: integer } succeeded: { type: integer } failed: { type: integer } canceled: { type: integer } in_flight: { type: integer } cost_usd: { type: number } tokens_in: { type: integer, format: int64 } tokens_out: { type: integer, format: int64 } p50_turns: { type: integer, description: Median turns of settled runs } p95_turns: { type: integer } failure_rate: { type: number, description: 'Failed over settled runs, 0 to 1' } WorkflowAgentToolSources: type: object properties: node_types: type: array items: type: object properties: type: { type: string } version: { type: integer } kind: { type: string } category: { type: string } label_key: { type: string } tool: { type: object, nullable: true, additionalProperties: true } credentials: { type: array, items: { type: object, additionalProperties: true } } parameters: { type: object, additionalProperties: true } executable: { type: boolean, description: An agent can call this type } annotations: { type: object, additionalProperties: true } returns: { type: string } args_schema: { type: object, additionalProperties: true } default_tool_name: { type: string } workflows: type: array items: type: object properties: id: { type: string } name: { type: string } description: { type: string } active_version: { type: integer, nullable: true } caller_policy: { type: string } input_schema: { type: object, nullable: true, additionalProperties: true } agents: type: array items: type: object properties: id: { type: string } name: { type: string } slug: { type: string } description: { type: string } active_version: { type: integer, nullable: true } as_tool: { type: boolean } mcp_servers: type: array items: type: object properties: id: { type: string } name: { type: string } tools: type: array items: type: object properties: name: { type: string } description: { type: string } input_schema: { type: object, additionalProperties: true } individual: { type: boolean } owner: type: object properties: user_id: { type: string } name: { type: string } granted: { type: boolean, description: The project may already use this connection } status: { type: string } knowledge: type: object properties: folders: { type: array, items: { type: string } } entries: type: array items: type: object properties: id: { type: string } name: { type: string } folder: { type: string } scope: { type: string } prompts: type: array items: type: object properties: id: { type: string } name: { type: string } folder: { type: string } scope: { type: string } latest_version: { type: integer } variables: { type: array, items: { type: string } } models: type: array items: type: object properties: provider: { type: string } model_id: { type: string } display_name: { type: string } supports_tools: { type: boolean } WfCredOwnerRef: type: object description: The person whose account backs an individual connection. properties: user_id: { type: string, format: uuid } display_name: { type: string, description: 'Best effort; omitted when unknown' } WfCredManagedRef: type: object description: Present only on connections Crios minted for one of the project's own databases (the Project database connectors) or for the owner's bring-your-own app database. properties: kind: { type: string, enum: [store, byo], description: 'store = provisioned by Crios, byo = the owner''s own server' } engine: { type: string } tier: { type: string, enum: [durable, sandbox] } store: { type: string, description: 'default, or the name of a named store' } WfCredSummary: type: object description: One workflow connection as the directory and every write answer render it. Never carries config values, secrets or the Vault path. properties: id: { type: string, format: uuid } name: { type: string } cred_type: { type: string, description: 'Credential type key, for example postgres, http, slack or integration_hub:slack' } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } expires_at: { type: string, format: date-time, nullable: true } last_used_at: { type: string, format: date-time, nullable: true } method: { type: string, description: 'Auth method of the type (api_key, token, basic, hmac, oauth2, jwt_bearer, secret), connected_account for a bridge row, empty when the type is no longer registered' } provider: { type: string, description: 'Product card the connection belongs to' } bridge_of: { type: string, description: 'Bridge rows only - the type the row resolves as' } actor: { type: string, enum: [service, individual], description: 'Whether the connection acts as an app or service, or as a person' } owner: { $ref: '#/components/schemas/WfCredOwnerRef' } client_source: { type: string, enum: [application, own], description: 'Browser-flow OAuth2 rows only - which OAuth client the row runs on' } status: { type: string, enum: [connected, pending, needs_reauth, expired] } managed: { $ref: '#/components/schemas/WfCredManagedRef' } WfCredDetail: description: The summary plus the non-secret config document. allOf: - { $ref: '#/components/schemas/WfCredSummary' } - type: object properties: config: { type: object, additionalProperties: true } WfCredTestResult: type: object required: [ok] properties: ok: { type: boolean } reason: { type: string, enum: [rejected, unreachable, invalid], description: 'Present when ok is false' } error: { type: string, description: 'Value-free failure message; present when ok is false' } WfConnApplicationClient: type: object description: Whether the application OAuth client can be offered for a browser-flow OAuth2 type. properties: available: { type: boolean } source: { type: string, enum: [service_client, platform_app], description: 'Present when available' } family: { type: string, description: 'Connector family whose platform app is the fallback' } WfConnCatalogEntry: type: object description: One connector catalog entry. Field declarations and metadata only, never values. properties: type: { type: string, description: 'Credential type key (for MCP rows the service key)' } service: { type: string } label_key: { type: string, description: 'i18n key of the display name' } display_name: { type: string, description: 'Operator-set name; omitted when empty' } description: { type: string } config_schema: { type: object, nullable: true, additionalProperties: true, description: 'JSON Schema of the config document, or null' } secrets_schema: { type: object, nullable: true, additionalProperties: true, description: 'JSON Schema of the secrets document, or null' } primary_secret: { type: string, description: 'Secret field a single pasted value binds to' } destination_fields: { type: array, items: { type: string }, description: 'The declared config fields whose change must be sent together with secrets (PATCH /workflows/credentials/{id}). Destination by default: every config field is listed unless the type exempts it, and a key the schema does not declare is one too. Never null' } closed_config: { type: boolean, description: 'The type refuses config keys its schema does not declare; omitted when false' } auth_method: { type: string, description: 'For example api_key, token, basic, hmac, oauth2, jwt_bearer, secret, or mcp_oauth, mcp_token, mcp_open for MCP rows' } category: { type: string } categories: { type: array, items: { type: string } } keywords: { type: array, items: { type: string } } provider: { type: string } doc_url: { type: string } logo: { type: string } testable: { type: boolean, description: 'Whether POST /workflows/credentials/{id}/test applies' } enabled: { type: boolean, description: 'False hides the service from creation only' } source: { type: string, enum: [code, db] } token_fallback: { type: boolean, description: 'MCP rows only - a static token is accepted besides OAuth' } bridge_of: { type: string, description: 'Bridge types only - the type a bridge row resolves as' } actor: { type: string, enum: [service, individual] } application_client: { $ref: '#/components/schemas/WfConnApplicationClient' } scopes: { type: array, items: { type: string }, description: 'Default scope set (OAuth2 and MCP rows)' } consumers: { type: array, items: { type: string }, description: 'Node types with a slot this type satisfies; always present' } WfConnCatalogUsage: type: object properties: connections: { type: integer } individual: { type: integer, description: 'Connections acting as a person' } needs_reauth: { type: integer } pending: { type: integer } application_client: { type: integer, description: 'Connections running on the application OAuth client' } WfConnCatalogUpsert: type: object description: Body of PUT /workflows/connectors/catalog/{service}. Which fields apply depends on the kind of key (see the operation). properties: enabled: { type: boolean } auth_method: { type: string, enum: [secret, http_bearer, http_basic, http_header, http_query, mcp_oauth, mcp_token, mcp_open] } display_name: { type: string } description: { type: string } provider: { type: string, description: 'Lowercase token' } categories: { type: array, items: { type: string } } keywords: { type: array, items: { type: string } } doc_url: { type: string, description: 'https URL' } logo: { type: string, description: 'Path under /logos/' } mcp_endpoint: { type: string, description: 'https endpoint of a remote MCP server' } rank: { type: integer, minimum: 0, maximum: 10000, description: 'Directory placement override: featured order (1 first, 0 unranked). Any existing row' } copy: allOf: [{ $ref: '#/components/schemas/ConnectorCatalogCopy' }] description: 'Directory copy override for any existing row: description and requirements up to 300 bytes, at most four example prompts of up to 200 bytes, https website_url and privacy_url' reset_rank: { type: boolean, description: Clear the rank override back to the seed } reset_copy: { type: boolean, description: Clear the copy override back to the seed } WfConnOAuthClient: type: object description: A service's application OAuth client. The secret is write-only and never returned. properties: service: { type: string } client_id: { type: string, description: 'Admin-registered client id; empty when none is stored' } has_secret: { type: boolean } configured: { type: boolean, description: 'Whether a connect on the application client would resolve one' } source: { type: string, enum: [service_client, platform_app, none] } family: { type: string } redirect_uris: { type: array, items: { type: string }, description: 'Callback URLs to whitelist at the provider' } WfTelegramBot: type: object description: One workflow Telegram bot. Never carries the token. properties: id: { type: string, format: uuid, description: 'The bot connection id' } name: { type: string } bot_username: { type: string } bot_type: { type: string, enum: [notify, approvals] } share_link: { type: string, description: 'Public https://t.me/ link; omitted until the username is known' } status: { type: string, enum: [pending, polling, error] } status_detail: { type: string, description: 'Why the last poll failed' } known_chats: { type: integer } last_polled_at: { type: string, format: date-time } created_at: { type: string, format: date-time } WfTelegramChat: type: object properties: chat_id: { type: string } label: { type: string } chat_type: { type: string, description: 'Telegram chat type, or chat when unknown' } username: { type: string } last_seen_at: { type: string, format: date-time } WfTelegramLink: type: object properties: user_id: { type: string } tg_username: { type: string } tg_name: { type: string } chat_id: { type: string } connected_at: { type: string, format: date-time } me: { type: boolean, description: 'The caller''s own link' } WfStore: type: object description: A managed data store. References only, never the DSN. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } name: { type: string } table_name: { type: string, description: 'wd__' } credential_id: { type: string, format: uuid, description: 'The postgres connection database nodes bind' } created_at: { type: string, format: date-time } WfMemoryNamespace: type: object properties: namespace: { type: string, description: 'Stored namespace, including a #test suffix' } base: { type: string, description: 'Namespace without the #test suffix' } test: { type: boolean } keys: { type: integer, format: int64, description: 'Current values' } log_rows: { type: integer, format: int64 } scopes: { type: integer, format: int64 } updated_at: { type: string, description: 'Latest write, UTC with milliseconds; omitted when unknown' } orphaned: { type: boolean } WfMemoryRow: type: object description: A current value (kind value) or a log entry (kind entry) with its provenance. Optional fields are omitted when empty. properties: kind: { type: string, enum: [value, entry] } scope_key: { type: string, description: 'Empty string is the shared scope' } key: { type: string } seq: { type: integer, format: int64, description: 'Log entries only' } value: { description: 'The stored JSON value; omitted when truncated' } value_bytes: { type: integer } truncated: { type: boolean, description: 'Value larger than 8192 bytes' } ttl_at: { type: string } agent_id: { type: string } execution_id: { type: string } step_id: { type: string } node_id: { type: string } run_mode: { type: string } workflow_id: { type: string } readonly: { type: boolean, description: 'Lock flag of this log entry; absent on values' } effective_locked: { type: boolean, description: 'True when any log entry of the key is locked' } created_at: { type: string, description: 'UTC with milliseconds' } updated_at: { type: string, description: 'UTC with milliseconds' } WfMemoryDeleted: type: object properties: values: { type: integer, format: int64 } entries: { type: integer, format: int64 } WfMemoryLockResult: type: object properties: readonly: { type: boolean } affected: { type: integer, format: int64, description: 'Log entries changed' } namespace: { type: string } key: { type: string } WfMemoryTarget: type: object description: Where a memory node's rows go. Names only, never a DSN, user or secret. properties: kind: { type: string, enum: [managed_durable, managed_sandbox, managed_named, byo, connection] } engine: { type: string } host: { type: string } database: { type: string } name: { type: string, description: 'Connection display name, when known' } tables: { type: array, items: { type: string } } WfMemoryTablesStatus: type: object properties: present: { type: boolean, nullable: true, description: 'Null when the database could not be looked at (hibernated)' } version: { type: integer, description: 'Memory schema version, when present' } hibernated: { type: boolean } WfVariables: type: object properties: variables: type: object additionalProperties: true description: Base values by name (any JSON) overrides: type: object description: Per-project overrides, keyed by project id, then by variable name additionalProperties: type: object additionalProperties: true WfTriggerHealth: type: object properties: node_id: { type: string } kind: { type: string, description: 'Listener kind - redis, postgres, kafka, rabbitmq or mqtt' } state: { type: string, enum: [pending, listening, failing, stale] } summary: { type: string, description: 'Channel, topic, queue or stream listened on' } last_error: { type: string } listening_since: { type: string, format: date-time } last_event_at: { type: string, format: date-time } last_fired_at: { type: string, format: date-time } events_seen: { type: integer, format: int64 } executions_made: { type: integer, format: int64 } updated_at: { type: string, format: date-time } WfHookResult: type: object description: Webhook ingress answer. 202 carries execution_id (plus status after a timed-out wait); a finished run adds status, error and stats. A respond node's recorded answer and provider responses are replayed as they are instead. properties: execution_id: { type: string, format: uuid } status: { type: string, description: 'Execution status' } error: { type: object, additionalProperties: true } stats: { type: object, additionalProperties: true } WfWaitResolution: type: object properties: execution_id: { type: string, format: uuid } step_id: { type: string } kind: { type: string, description: 'Resolved wait kind (signal)' } WfArtifactUpload: type: object description: Stored artifact reference, in the runner protocol's camelCase. properties: id: { type: string, format: uuid } sha256: { type: string } bytes: { type: integer, format: int64 } mimeType: { type: string } store: { type: string, description: 'Backing store, db by default' } SessionEventOffsetPage: type: object properties: events: type: array items: { $ref: '#/components/schemas/SessionEvent' } limit: { type: integer } offset: { type: integer } count: { type: integer, description: 'Rows in this page, synthesized rows included' } total: { type: integer, description: Persisted events matching the filters } has_more: { type: boolean, description: Older events exist beyond this page } SessionEventCursorPage: type: object properties: mode: { type: string, enum: [cursor] } events: type: array items: { $ref: '#/components/schemas/SessionEvent' } limit: { type: integer } count: { type: integer } has_older: { type: boolean, description: More rows exist before older_cursor (initial and before_cursor reads) } has_newer: { type: boolean, description: More rows exist after newer_cursor (after_cursor reads) } older_cursor: { type: string, nullable: true, description: Cursor of the oldest row in the page; null when the page is empty } newer_cursor: { type: string, nullable: true, description: Cursor of the newest row in the page; null when the page is empty } SessionCreateRequest: type: object properties: project_id: { type: string, format: uuid, description: Required in practice } natural_language: { type: string, maxLength: 4000000, description: The request in plain language; the planner's main input } title: { type: string, maxLength: 500 } description: { type: string, maxLength: 4000000 } session_type: type: string enum: [coding, planning, review, testing, research, publishing] description: Pins the session type; otherwise the planner chooses. `planning` produces a plan document only. priority: { type: integer, minimum: 0, maximum: 10 } model_provider: { type: string, description: Overrides the routed provider for a build session } model_name: { type: string, description: Overrides the routed model for a build session } conversation: type: array maxItems: 40 description: Client-held planning conversation from earlier turns; 4 MB of content in total items: type: object required: [role, content] properties: role: { type: string, enum: [user, assistant] } content: { type: string } draft_session_id: type: string format: uuid description: | Client-chosen composer-thread id. Repeating it reuses one session row across create calls; a newer call supersedes a planning run still in flight. Each call sets the row's agent profile from its own agent_profile_id, so send the pin with every call: a call without it clears the pin. disable_subsessions: { type: boolean, description: 'Never split the build into worker subsessions. Without it, the planner splits only when the request asks for parallel agents or subsessions.' } plan_approval_mode: { type: string, enum: [required, auto], default: required, description: required pauses the agent for plan approval; auto skips the gate } target_stack: { type: string, enum: [web, mobile, desktop], description: Rebuild platform when uploaded screenshots yield a design spec } agent_profile_id: { type: string, format: uuid, description: Pins an active agent profile of the organization that covers the project; empty means auto } skill_ids: type: array maxItems: 16 items: { type: string, format: uuid } description: Pins enabled organization skills that cover the project, in addition to the project's attached skills external_source: { type: string, maxLength: 50, description: 'Integration that originated the request (slack, jira, github). session_create, wipe_database, persist_database and telegram are reserved for Crios: 400 external_source_reserved.' } external_user: { type: string, maxLength: 200 } external_display: { type: string, maxLength: 200 } SessionCreateResult: description: The created or updated Session plus the planner's outcome flags. allOf: - { $ref: '#/components/schemas/Session' } - type: object properties: requires_clarification: { type: boolean, description: Clarify outcome } message: { type: string, description: Clarify outcome; the planner's question text } questions: { type: array, items: { type: string }, description: Clarify outcome } conversation: type: array description: Clarify outcome; the conversation including this turn items: type: object properties: role: { type: string } content: { type: string } plan_only: { type: boolean, description: Plan-only outcome } auto_decomposed: { type: boolean, description: Build outcome with subsessions } subsession_count: { type: integer } subsessions: type: array items: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } title: { type: string } description: { type: string } status: { type: string } session_type: { type: string } parent_session_id: { type: string, format: uuid } role: { type: string, enum: [worker] } branch_name: { type: string } design_reconstruction: { type: boolean, description: Uploaded screenshots yielded a design spec } target_stack: { type: string } attachments_received: { type: integer, description: Files received in the multipart request } SessionCreateChatResult: type: object description: Chat outcome. id, session_id and project_id are absent when the conversation could not be saved. properties: chat_response: { type: boolean, enum: [true] } message: { type: string, description: The assistant's answer } conversation: type: array items: type: object properties: role: { type: string } content: { type: string } model_provider: { type: string } model_name: { type: string } attachments_received: { type: integer } id: { type: string, format: uuid } session_id: { type: string, format: uuid } project_id: { type: string, format: uuid } SessionSkillsBundle: type: object properties: schema_version: { type: integer, enum: [1] } system_appendix: { type: string, description: Profile guidance and prompt-skill blocks to append to the agent's system prompt } applied: type: array items: type: object properties: id: { type: string, format: uuid } identifier: { type: string } name: { type: string } type: { type: string, description: 'agent_profile, prompt, composite, connector, workflow or code' } selection: { type: string, enum: [pinned, auto, attached] } selection_reason: { type: string, description: Why the agent profile was chosen } tools: type: array items: { $ref: '#/components/schemas/SessionSkillsBundleTool' } SessionSkillsBundleTool: type: object properties: name: { type: string } description: { type: string } input_schema: { type: object, additionalProperties: true, description: JSON Schema of the tool's inputs } skill_id: { type: string } skill_identifier: { type: string } dispatch: type: object description: How to execute the tool properties: kind: { type: string, enum: [connector_action, workflow, code, composite, connector_request, hub_action], description: 'connector_request and hub_action go to POST /sessions/{id}/connector-call; the others to POST /skills/{skill_id}/execute' } action: { type: string } credential_id: { type: string } integration_id: { type: string } account_id: { type: string } SessionConnectorCallError: type: object properties: error: { type: string } code: { type: string } SessionGmailRequest: type: object description: Union of the four actions' fields; see the operation description for which apply. properties: query: { type: string } max_results: { type: integer, default: 10, maximum: 25 } message_id: { type: string } to: { type: string } cc: { type: string } bcc: { type: string } subject: { type: string } body: { type: string } reply_to_message_id: { type: string } message_ids: { type: array, maxItems: 50, items: { type: string } } operation: { type: string, enum: [archive, mark_read, mark_unread, star, unstar, trash, untrash] } SessionWorkspaceFile: type: object properties: path: { type: string } size: { type: integer, format: int64 } git_status: { type: string, enum: [untracked, renamed, deleted, added, modified], description: Omitted for clean files } SessionWorkspaceError: type: object properties: error: { type: string } code: { type: string, enum: [bad_request, sandbox_asleep, sandbox_error] } PreviewServerConfig: type: object description: A running host dev-server preview. properties: port: { type: integer } framework: { type: string } working_dir: { type: string } hmr_enabled: { type: boolean } frame_interval_ms: { type: integer } iframe_id: { type: string } sandboxed: { type: boolean } sandboxed_url: { type: string } security_headers: { type: object, additionalProperties: { type: string } } ReviewIssue: type: object properties: severity: { type: string, description: 'The model is asked for critical, major or minor' } type: { type: string, description: 'The model is asked for bug, security, style, performance or best_practice' } file: { type: string } line: { type: integer } message: { type: string } suggestion: { type: string, description: Omitted when empty } code: { type: string, description: Omitted when empty } ReviewResult: type: object properties: issues: type: array items: { $ref: '#/components/schemas/ReviewIssue' } summary: { type: string } files_changed: { type: integer } lines_added: { type: integer } lines_removed: { type: integer } rating: { type: integer, minimum: 0, maximum: 100, description: 'Merge confidence; set by PR review, 0 otherwise' } risk_level: { type: string, description: 'low, medium or high; set by PR review, empty otherwise' } SandboxRecord: type: object description: A recorded sandbox (project and unfiltered lists) properties: id: { type: string } project_id: { type: string, description: Empty when none } session_id: { type: string, description: Empty when none } name: { type: string, description: Pod name } sandbox_type: { type: string } status: { type: string } created_at: { type: string, format: date-time } ttl_seconds: { type: integer } SandboxInfo: type: object description: A sandbox as the orchestrator tracks it at runtime properties: id: { type: string } session_id: { type: string } project_id: { type: string, description: 'Create and get responses (always empty in get)' } sandbox_type: { type: string } type: { type: string, description: Same as sandbox_type } status: { type: string } pod_name: { type: string } namespace: { type: string } cpu: { type: string } memory: { type: string } disk: { type: string } workspace_pvc: { type: string, description: Session-filtered list items only } ttl_seconds: { type: integer, description: 'Create and get responses (0 in get)' } created_at: { type: string, format: date-time } last_active: { type: string, format: date-time } MultiAgentWorker: type: object properties: id: { type: string, format: uuid } title: { type: string } status: { type: string } branch_name: { type: string, description: Omitted when empty } error_message: { type: string, description: Omitted when empty } updated_at: { type: string, format: date-time, description: Omitted from the list when unset } SessionProgress: type: object properties: session_id: { type: string, format: uuid } status: { type: string } workflow_state: { type: string } workflow: { $ref: '#/components/schemas/SessionWorkflowState' } current_step: { type: integer } active_step: { type: integer } total_steps: { type: integer } total_goals: { type: integer } completed_count: { type: integer } completed_goals: { type: integer } active_goals: { type: array, items: { type: string } } active_goal: { type: string } active_goal_title: { type: string } active_goal_completed_sessions: { type: integer } active_goal_total_sessions: { type: integer } active_goal_remaining_sessions: { type: integer } active_goal_progress_status: { type: string } active_agents: { type: integer } blocked_count: { type: integer } recovering_count: { type: integer } stalled: { type: boolean } stalled_seconds: { type: integer } last_progress_at: { type: string } checkpoints: type: array items: { $ref: '#/components/schemas/SessionProgressCheckpoint' } latest_validation: allOf: - { $ref: '#/components/schemas/SessionProgressValidation' } nullable: true plan: type: array items: { $ref: '#/components/schemas/SessionProgressStep' } updated_at: { type: string, format: date-time } SessionProgressStep: type: object properties: id: { type: integer } step: { type: integer } title: { type: string } description: { type: string } status: { type: string } dependencies: { type: array, items: { type: string } } branch: { type: string } commit: { type: string } merged_into: { type: string } merge_commit: { type: string } pr_number: { type: integer } pr_url: { type: string } reviewed: { type: boolean } last_event_at: { type: string } SessionProgressCheckpoint: type: object description: One goal checkpoint. Empty optional fields are omitted. properties: goal: { type: string } goal_id: { type: string } current_session_id: { type: string } summary: { type: string } done: { type: array, items: { type: string } } not_done: { type: array, items: { type: string } } branch: { type: string } commit: { type: string } merged_into: { type: string } merge_commit: { type: string } pr_number: { type: integer } pr_url: { type: string } merge_status: { type: string } last_merge_error: { type: string } current_blocker: { type: string } next_recommended_action: { type: string } repository_invariants_fingerprint: { type: string } repository_invariants_bytes: { type: integer } progress_status: { type: string } completed_session_count: { type: integer } total_session_count: { type: integer } remaining_session_count: { type: integer } files_created: { type: array, items: { type: string } } files_modified: { type: array, items: { type: string } } tests_written: { type: array, items: { type: string } } test_commands: { type: array, items: { type: string } } last_validation: { $ref: '#/components/schemas/SessionProgressValidation' } updated_at: { type: string } SessionProgressValidation: type: object properties: goal: { type: string } phase: { type: string } attempt: { type: integer } commands: { type: array, items: { type: string } } passed: { type: boolean } error: { type: string } output: { type: string } affected_files: { type: array, items: { type: string } } created_at: { type: string } SessionWorkflowState: type: object properties: session_id: { type: string, format: uuid } lifecycle_status: { type: string } workflow_state: { type: string } workflow_state_label: { type: string } current_goal: { type: string } source: { type: string } reason: { type: string } stalled: { type: boolean } stalled_seconds: { type: integer } last_progress_at: { type: string } last_event_at: { type: string } allowed_transitions: { type: array, items: { type: string } } terminal: { type: boolean } updated_at: { type: string } SessionActiveAgent: type: object properties: id: { type: string } goal: { type: string } workflow_state: { type: string } branch: { type: string } source: { type: string } updated_at: { type: string } SessionBlocker: type: object properties: id: { type: string } goal: { type: string } phase: { type: string } severity: { type: string, enum: [blocked, replanning, recovering] } category: { type: string } summary: { type: string } error: { type: string } current_blocker: { type: string } next_recommended_action: { type: string } source: { type: string } validation: { $ref: '#/components/schemas/SessionProgressValidation' } updated_at: { type: string } SessionMergeQueueItem: type: object properties: id: { type: string } goal_id: { type: string } goal: { type: string } branch: { type: string } commit: { type: string } status: { type: string, enum: [queued, merging, merged, failed] } error: { type: string } merged_into: { type: string } pr_number: { type: integer } pr_url: { type: string } merge_commit: { type: string } updated_at: { type: string } SessionFailureKBMatch: type: object properties: correlation_key: { type: string } disposition: { type: string } rule_text: { type: string, description: The approved fix rule } suggestion_id: { type: string, description: 'Empty for callers below org admin, and for every rule that is not the caller organization''s own (shared seeded rules included)' } session_id: { type: string, description: 'Empty for callers below org admin, and for every rule that is not the caller organization''s own (shared seeded rules included)' } score: { type: number } SessionProjectFact: type: object required: [name, value] properties: name: { type: string } value: { type: string } source: { type: string } SessionTranscriptCall: type: object properties: id: { type: string } step: { type: integer } purpose: { type: string } subagent_id: { type: string } requested_provider: { type: string } requested_model: { type: string } resolved_provider: { type: string } resolved_model: { type: string } input_tokens: { type: integer, format: int64 } output_tokens: { type: integer, format: int64 } cached_input_tokens: { type: integer, format: int64 } cache_creation_input_tokens: { type: integer, format: int64 } cost_usd: { type: number } latency_ms: { type: integer, format: int64 } finish_reason: { type: string } status: { type: string } created_at: { type: string, format: date-time } prompt_bytes: { type: integer, format: int64, description: Stored (compressed) size of the prompt body } completion_bytes: { type: integer, format: int64, description: Stored (compressed) size of the completion body } prompt: { description: 'Request body JSON; with include_bodies=true only' } completion: { description: 'Response body JSON; with include_bodies=true only' } SessionIntentItem: type: object properties: correlation_key: { type: string } disposition: { type: string, enum: [soft, hard] } promoted: { type: boolean, description: A transient failure that became blocking because it outlived a phase } resolved: { type: boolean } title: { type: string } detail: { type: string } event_type: { type: string } occurrences: { type: integer } first_seen: { type: string, format: date-time } last_seen: { type: string, format: date-time } SessionDataError: type: object description: Error body of the session Data endpoints. Errors raised by the shared auth, session-access and viewer checks carry only error. properties: error: { type: string, description: Human-readable message } code: { type: string, description: 'Machine-readable reason, e.g. not_found, bad_request, sandbox_asleep, sandbox_error, user_action_required, no_project' } SessionDataConnection: type: object description: One row of a session's Data tab connection catalog. Connection secrets are encrypted at rest and never returned. properties: id: { type: string, format: uuid } name: { type: string } engine: { type: string, enum: [postgres, mysql, sqlite, redis] } host: { type: string, description: Omitted when empty } port: { type: string, description: Omitted when empty } username: { type: string, description: Omitted when empty } database: { type: string, description: Database name (the file path for sqlite); omitted when empty } source: type: string enum: [manual, discovered, project] description: manual = added by a user; discovered = found by a sandbox scan; project = the seeded project database origin: { type: string, description: 'Where the row came from, as the scan labels it (sandbox service, environment, env file (path), sqlite file, port probe) or project database; omitted for manual rows' } discovered_key: { type: string, description: 'Stable key of a discovered or project row (for example env:DATABASE_URL, file:app/data.db, probe:5432, project-database); omitted for manual rows' } has_password: { type: boolean } has_dsn: { type: boolean } browsable: { type: boolean, description: 'False for redis, which only supports the query endpoint' } created_at: { type: string, format: date-time } SessionDataQueryResult: type: object description: Uniform query result for every engine. On failure error and error_kind are set and the HTTP status is still 200. properties: engine: { type: string } columns: type: array items: { type: string } rows: type: array items: type: array items: { type: string } row_count: { type: integer } truncated: { type: boolean, description: True when the row cap or the 64 KiB output cap cut the result } raw: { type: string, description: Raw reply for non-tabular engines (redis) } error: { type: string } error_kind: { type: string, enum: [sql_write_blocked, invalid_tool_arguments, db_unreachable, timeout, sql_error] } error_reason: { type: string, enum: [write_statement, multiple_statements, unknown_statement, explain_analyze, empty_query], description: 'Why the read-only guard refused the statement; present only with error_kind sql_write_blocked. The error text names what was refused, not how to get past it' } SessionDataTable: type: object properties: name: { type: string } type: { type: string, enum: [table, view] } approx_rows: { type: integer, format: int64, description: Estimate; -1 when unknown } SessionDataColumn: type: object properties: name: { type: string } data_type: { type: string } nullable: { type: boolean } default: { type: string, description: Omitted when the column has no default } is_primary_key: { type: boolean } references: type: object description: Outgoing foreign key; omitted when the column references nothing properties: schema: { type: string } table: { type: string } column: { type: string } SessionDataRows: type: object properties: schema: { type: string } table: { type: string } columns: type: array items: { type: string } rows: type: array items: type: array items: { type: string } row_count: { type: integer, description: Rows in this page } total: { type: integer, format: int64, description: Exact row count matching the filter; -1 when the count failed } limit: { type: integer } offset: { type: integer } SessionDataSearchResult: type: object properties: term: { type: string } schema: { type: string } results: type: array items: type: object properties: schema: { type: string } table: { type: string } columns: type: array items: { type: string } rows: type: array items: type: array items: { type: string } hit_count: { type: integer } truncated: { type: boolean, description: True when the time budget or max_hits stopped the scan early } skipped: type: array items: { type: string } description: Tables not searched (beyond the table cap, or left when the scan stopped) elapsed_ms: { type: integer, format: int64 } SessionDataProjectDatabase: type: object description: | The project's database as a session sees it (never control-plane data): a managed store (on the shared crios-project-db, or on the project's dedicated instance), or a user-bound external server (source byo). Connection fields are present once a store exists. properties: enabled: { type: boolean, description: Whether this deployment serves project databases } provisioned: { type: boolean, description: Whether the requested store exists } created: { type: boolean, description: POST only; true when this call provisioned the store (omitted otherwise) } engine: { type: string, enum: [postgres, mysql, valkey, ferretdb] } name: { type: string, description: Store name; default for the default store } host: { type: string } port: { type: integer } database: { type: string } user: { type: string, description: Database role } dsn: { type: string, description: 'Connection string. Only in the POST answer, and only to the session''s sandbox token.' } status: { type: string, description: 'Store lifecycle state, e.g. ready, hibernated or waking. waking means no DSN yet: retry after retry_after_seconds.' } retry_after_seconds: { type: integer, description: Set with status waking on the POST } source: { type: string, enum: [managed, byo] } tier: { type: string, enum: [sandbox, durable], description: Set only for managed stores that live on a dedicated per-project instance; omitted for stores on the shared crios-project-db } connector: type: object description: The workflow connector that holds this database's credential (Project → Connectors) properties: id: { type: string, format: uuid } type: { type: string, enum: [postgres, mysql, redis, mongodb] } name: { type: string, description: 'For example "Project database", "Project database (sandbox)", "Project database: ", "Project key-value store" or "App database (BYO)"' } engines: type: array items: { type: string } description: GET only; the store engines this deployment can provision stores: type: array description: GET only; every store the project holds; omitted when there are none items: { $ref: '#/components/schemas/SessionDataProjectDatabaseStore' } SessionDataProjectDatabaseStore: type: object properties: engine: { type: string } tier: { type: string, enum: [sandbox, durable], description: 'sandbox or durable (rows on the shared crios-project-db report durable). Pass it as the wipe endpoint''s tier.' } name: { type: string, description: default for the default store } status: { type: string, enum: [provisioning, waking, ready] } ProjectSnapshot: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } name: { type: string } type: { type: string, enum: [project, checkpoint, custom] } tag: { type: string } registry_url: { type: string } size_bytes: { type: integer, format: int64 } created_at: { type: string, format: date-time } session_id: { type: string, description: Omitted when empty } ttl_seconds: { type: integer } metadata: { type: object, additionalProperties: { type: string } } PublicationComponent: type: object description: One deployable unit of a published app. properties: name: { type: string } kind: { type: string, enum: [frontend, backend, data] } build: type: object description: Docker build inputs in the repository properties: context: { type: string } dockerfile: { type: string } stack: { type: string, enum: [static, node, node-ssr, go, python, rust, java-maven, php, ruby], description: Platform-owned build stack used instead of a repository Dockerfile } port: { type: integer, description: Container port serving traffic (frontend and backend) } health: type: object properties: path: { type: string, description: HTTP readiness path } routePrefix: { type: string, description: 'Path the component serves (defaults: frontend /, backend /api)' } engine: { type: string, description: 'Data service engine of a data component, such as postgres, mysql, mongodb or redis' } seed: { type: boolean, description: The component seeds its database on boot } PublicationChartRef: type: object description: What the current deployment was built from. An empty object before the first build. properties: repo_clone_url: { type: string, description: Credential-free clone URL of the project repository } revision: { type: string, description: Commit SHA that was published } chart_path: { type: string, description: Chart directory in the repository; empty when the platform-owned chart is used } manifest_path: { type: string, description: Publish manifest in the repository; empty when the platform-owned chart is used } adopted: { type: boolean, description: 'True when the repository''s committed publish chart was deployed as-is without an agent session; absent for charts a publishing session wrote' } env_defaults: type: object additionalProperties: { type: string } description: Non-secret default environment values declared by the publish manifest PublicationCondition: type: object description: 'One pipeline condition. Types, in order: ChartFetched, ImagesBuilt, Deployed, DNSReady, CertificateReady, Live.' properties: type: { type: string } status: { type: string, enum: ['True', 'False', 'Unknown'] } reason: { type: string } message: { type: string } lastTransitionTime: { type: string, format: date-time } PublicationComponentStatus: type: object properties: name: { type: string } state: { type: string, description: 'Image build state, such as Pending, Running, Succeeded or Failed' } message: { type: string } PublicationEvent: type: object description: One entry of a publication's activity timeline. properties: id: { type: string, format: uuid } publication_id: { type: string, format: uuid } project_id: { type: string, format: uuid } event_type: { type: string, enum: [status_transition, action, auto_repair, error] } from_status: { type: string, description: Status left (status_transition and auto_repair events); may be empty } to_status: { type: string, description: Status entered (status_transition and auto_repair events); empty otherwise } message: { type: string } actor: { type: string, description: 'Email of the user who acted, or "system" for platform-driven events' } created_at: { type: string, format: date-time } PublicationMonitor: type: object description: A synthetic probe of one endpoint of the published app. properties: id: { type: string, format: uuid } method: { type: string, enum: [GET, HEAD] } path: { type: string, description: Absolute path probed on the app's domain (may include a query string) } expected_status_min: { type: integer, description: Lowest HTTP status that counts as healthy } expected_status_max: { type: integer, description: Highest HTTP status that counts as healthy } enabled: { type: boolean } source: { type: string, enum: [user, heuristic, ai], description: 'user: created by a person. heuristic and ai: generated by the platform and replaced when monitors are regenerated.' } description: { type: string } last_status: { type: integer, description: HTTP status of the last probe; 0 until probed } last_latency_ms: { type: integer } last_checked_at: { type: string, description: RFC 3339 time of the last probe; empty string when never probed } last_error: { type: string } consecutive_failures: { type: integer, description: Failed probes in a row; 3 or more means the endpoint is down } created_at: { type: string, format: date-time } PublicationStats: type: object properties: publication_id: { type: string, format: uuid } status: { type: string, description: Current publication status } window_days: { type: integer, description: Always 30 } days: type: array description: One entry per day with data, oldest first items: type: object properties: day: { type: string, format: date } requests: { type: integer, format: int64 } errors_4xx: { type: integer, format: int64 } errors_5xx: { type: integer, format: int64 } bytes_out: { type: integer, format: int64 } avg_latency_ms: { type: number } max_latency_ms: { type: integer, format: int64 } probes_ok: { type: integer, format: int64 } probes_failed: { type: integer, format: int64 } totals: type: object description: Sums over the window (average and maximum latency across it) properties: requests: { type: integer, format: int64 } errors_4xx: { type: integer, format: int64 } errors_5xx: { type: integer, format: int64 } bytes_out: { type: integer, format: int64 } avg_latency_ms: { type: number } max_latency_ms: { type: integer, format: int64 } uptime: type: object description: Percentage (0–100) of successful monitor probes; null when no probe ran in that window properties: today: { type: number, nullable: true } 7d: { type: number, nullable: true } 30d: { type: number, nullable: true } phases: type: array description: Time spent in each pipeline phase, from the status timeline items: type: object properties: phase: { type: string } count: { type: integer, format: int64 } avg_seconds: { type: number } max_seconds: { type: number } monitors: type: object properties: total: { type: integer, format: int64 } enabled: { type: integer, format: int64 } up: { type: integer, format: int64, description: Enabled monitors whose last probe passed } down: { type: integer, format: int64, description: Enabled monitors with 3 or more consecutive failures } PublicationObservabilityStatus: type: object properties: enabled: { type: boolean, enum: [true] } app: { type: string, description: The publication slug } namespace: { type: string, description: Cluster namespace of the app } ready: { type: boolean, nullable: true } smoke_check_success: { type: boolean, nullable: true } smoke_check_duration_p90_seconds: { type: number, nullable: true } container_restarts: { type: number, nullable: true } uptime_ratio_24h: { type: number, nullable: true, description: 'Share of the last 24 hours the app was ready (0–1)' } PublicationObservabilityUnavailable: type: object description: The observability backend is not deployed or did not answer. properties: enabled: { type: boolean, enum: [false] } reason: { type: string } PublicationLogEntry: type: object properties: ts: { type: string, description: RFC 3339 timestamp with nanoseconds } line: { type: string, description: The log line with secrets redacted } labels: { type: object, additionalProperties: { type: string }, description: Log stream labels } PublicationAlert: type: object properties: name: { type: string } state: { type: string, description: 'Alert state, such as pending or firing' } severity: { type: string } summary: { type: string } description: { type: string } active_at: { type: string, format: date-time } ProjectThemeApplyResult: type: object properties: theme: { type: string, description: The theme slug that was applied } applied: { type: boolean, description: True when files were committed or the repository already carries this theme } files_changed: type: array items: { type: string } description: Repository paths rewritten; omitted when none commit_sha: { type: string, description: Last commit written; omitted when nothing was committed } deploy: type: string enum: [started, skipped_not_published, skipped_in_progress, skipped_republish_needed, failed] description: | started: the published app is redeploying at the theme commit (the published revision plus the theme). skipped_not_published: no active publication. skipped_in_progress: a publish is already running. skipped_republish_needed: the theme was committed, but the repository also holds unpublished changes, or the caller lacks publish (manage) access; the next republish puts it live. failed: the theme was committed but the redeploy could not start; republish from the project page. Omitted when nothing was committed (the call stopped before the redeploy step, or the repository already carried the theme). detail: { type: string, description: 'Human-readable explanation when applied is false, or a note about the redeploy' } DiscussionMessage: type: object description: | One message in a project's discussion channel. Deleted and redacted messages stay in the channel as tombstones with an empty body. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } seq: { type: integer, format: int64, description: 'Paging and dedup cursor; increases with every message but is shared across projects, so it is not contiguous within one channel' } author_kind: { type: string, enum: [user, agent_profile, workflow_agent, knowledge, system, external, bot] } author_user_id: { type: string, format: uuid, description: 'Author of a user message; omitted for automated posts and for deleted accounts' } author_ref: { type: string, description: 'Automated author, e.g. an agent profile identifier, knowledge-base, decisions, workflow:, crios_bot, or : for external posts' } body: { type: string, maxLength: 16000, description: Message text; empty on tombstones } body_meta: { type: object, additionalProperties: true, description: 'Structured extras for automated posts (knowledge hits, agent selector reason, decision announcement); empty or omitted for user posts' } reply_to_id: { type: string, format: uuid } continuation_of: { type: string, format: uuid, description: First message of the rapid-fire run this message continues } created_at: { type: string, format: date-time } edited_at: { type: string, format: date-time } deleted_at: { type: string, format: date-time, description: Set when the author retracted the message } redacted_at: { type: string, format: date-time, description: Set when a moderator redacted the message } kind: { type: string, enum: [update, decision, request, question, blocker, idea, feedback, social, other], description: 'Communication type from the classifier; omitted until classified, cleared on edit' } sentiment: { type: string, enum: [positive, neutral, negative] } urgent: { type: boolean } classified_at: { type: string, format: date-time } topics: type: array items: { type: string, enum: [marketing, design, engineering, product, pricing, i18n, ops, other] } reacted_at: { type: string, format: date-time, description: Set once the discussion bot has processed the message } disregarded_at: { type: string, format: date-time, description: Set while a bot or knowledge message is disregarded for the whole channel } disregarded_by: { type: string, format: uuid, description: User who disregarded the message } DiscussionDecision: type: object description: A decision record. Only confirmed decisions are indexed as project knowledge. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } statement: { type: string, maxLength: 2000 } status: { type: string, enum: [candidate, confirmed, dismissed, superseded] } source_message_ids: type: array items: { type: string, format: uuid } description: Discussion messages the decision came from topics: type: array items: { type: string, enum: [marketing, design, engineering, product, pricing, i18n, ops, other] } created_by: { type: string, enum: [user, llm], description: 'user when a person recorded it, llm for extracted candidates' } created_by_user_id: { type: string, format: uuid } confirmed_by_user_id: { type: string, format: uuid } confirmed_at: { type: string, format: date-time } superseded_by: { type: string, format: uuid, description: Decision that replaced this one } supersedes: { type: string, format: uuid, description: 'On a candidate, the confirmed decision it would replace' } schema_version: { type: integer } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } task_count: { type: integer, description: 'Tasks that follow up on this decision; filled by the list endpoint only (0 elsewhere)' } DiscussionReadState: type: object description: The caller's position in one project's discussion channel. properties: last_read_seq: { type: integer, format: int64, description: 'Watermark; every message at or below it counts as read (0 means never opened)' } first_unread_seq: { type: integer, format: int64, description: 'First unread message, where the "New messages" divider goes; 0 when caught up' } unread_count: { type: integer, maximum: 200, description: Unread messages (capped at 200) } unread_capped: { type: boolean, description: 'True when unread_count hit the cap (render as "200+")' } mention_count: { type: integer, description: 'Unread messages that @mention the caller by display name, first name or email local part' } latest_seq: { type: integer, format: int64, description: seq of the channel's newest message } DiscussionMember: type: object description: A person with access to the project (the @mention audience). properties: id: { type: string, format: uuid } name: { type: string } avatar_updated_at: { type: string, format: date-time, description: Omitted when the user has no avatar } DiscussionStreamEvent: type: object description: One frame on the discussion WebSocket (GET /projects/{id}/discussion/listen). properties: id: { type: string, format: uuid, description: Event ID (not the message ID) } type: type: string enum: [discussion_message_created, discussion_message_updated, discussion_message_deleted, discussion_message_removed, stream_gap] session_id: { type: string, description: 'Channel name, discussion:' } content: description: 'The message for message events (only id and project_id are meaningful on discussion_message_removed); {"dropped_events": n} on stream_gap' oneOf: - { $ref: '#/components/schemas/DiscussionMessage' } - type: object properties: dropped_events: { type: integer } timestamp: { type: string, format: date-time } ProjectTask: type: object description: A lightweight project work item. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } title: { type: string, maxLength: 2000 } status: { type: string, enum: [open, done, dismissed] } assignee_user_id: { type: string, format: uuid, description: Omitted when unassigned } created_by_user_id: { type: string, format: uuid } source_message_id: { type: string, format: uuid, description: Discussion message the task was filed from } source_decision_id: { type: string, format: uuid, description: Decision the task follows up on } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } completed_at: { type: string, format: date-time, description: Set while the task is done } CollectorError: type: object description: Error body; `code` is present for the rules a client can act on. properties: error: { type: string } code: { type: string, enum: [collector_classify_requires_signal_names, collector_knowledge_base_not_visible, signal_pipeline_not_entitled] } CollectorSourceWrite: type: object description: Create or partial-update body for a collector source. On update, omitted fields keep their value. properties: kind: { type: string, enum: [rss, http_api, db_change], default: rss, description: Create only; ignored on update } label: { type: string, maxLength: 120, description: Required on create } feed_url: { type: string, description: Feed URL (rss) } source_type: { type: string, enum: [reddit, hackernews, youtube, news, blog, github, forum, other], default: other } tags: { type: array, maxItems: 10, items: { type: string } } poll_interval_sec: { type: integer, default: 300, description: Clamped to 60–86400 } language_declared: { type: string } enabled: { type: boolean, default: true } classify_enabled: { type: boolean, default: false, description: Gates only the classification stage; requires at least one signal name } config: { type: object, additionalProperties: true, description: 'Per-kind configuration for http_api and db_change, validated by the kind (db_change credential references use vault: or env: forms)' } signal_names: type: array maxItems: 32 items: { type: string, maxLength: 120 } description: The closed signal vocabulary the classifier may emit. No spaces or `|`; reserved platform namespaces are refused; duplicates are dropped. knowledge: { type: string, maxLength: 4000, description: The source's own watch-context notes } knowledge_base_id: { type: string, description: 'Document-kind knowledge entry to inject into classification (a UUID); empty string clears the link' } CollectorSource: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } user_id: { type: string, format: uuid } kind: { type: string, enum: [rss, http_api, db_change] } label: { type: string } feed_url: { type: string } source_type: { type: string } tags: { type: array, items: { type: string } } poll_interval_sec: { type: integer } language_declared: { type: string, description: Omitted when empty } config: { type: object, additionalProperties: true } classify_enabled: { type: boolean } signal_names: { type: array, items: { type: string } } knowledge_base_id: { type: string, format: uuid, nullable: true } knowledge: { type: string } enabled: { type: boolean } origin: { type: string, enum: [manual, scout] } origin_prompt: { type: string, description: The scout prompt that created the source; omitted when empty } next_poll_at: { type: string, format: date-time } last_polled_at: { type: string, format: date-time } last_status: { type: string } last_error: { type: string } last_item_count: { type: integer } last_new_count: { type: integer } consecutive_failures: { type: integer } disabled_reason: { type: string, description: Omitted when empty } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } CollectorProbeReport: type: object properties: ok: { type: boolean } problems: { type: array, items: { type: string }, description: Hard failures that block registration } warnings: { type: array, items: { type: string } } resolved_url: { type: string } detected_dialect: { type: string, description: 'json_feed, rss2, atom or unknown' } feed_title: { type: string } item_count: { type: integer } detected_language: type: object properties: value: { type: string, nullable: true } source: { type: string, nullable: true, enum: [upstream, declared] } sample_items: type: array items: type: object properties: title: { type: string } url: { type: string } id: { type: string } published_at: { type: string, description: RFC 3339; omitted when absent } CollectorScoutRun: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } user_id: { type: string, format: uuid } prompt: { type: string } stage: { type: string, enum: [planning, searching, discovering, probing, ranking, creating, complete, failed] } message: { type: string } error: { type: string } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time } candidate_count: { type: integer } created: type: array items: { $ref: '#/components/schemas/CollectorSource' } rejected: type: array items: type: object properties: url: { type: string } reason: { type: string } PipelineRawEventCounts: type: object properties: last_24h: { type: integer, format: int64, description: Documents collected in the last 24 hours } pending_classify: { type: integer, format: int64, description: Documents not classified yet } LicenseWatchScanSummary: type: object properties: scan_id: { type: string, format: uuid } ecosystem: { type: string } dep_count: { type: integer } direct_count: { type: integer } resolved_count: { type: integer } pending_count: { type: integer } findings: { $ref: '#/components/schemas/LicenseWatchFindingCounts' } LicenseWatchFindingCounts: type: object properties: critical: { type: integer } warning: { type: integer } open: { type: integer } acknowledged: { type: integer } LicenseWatchDependency: type: object properties: project_id: { type: string, format: uuid } ecosystem: { type: string, enum: [npm, pypi, cargo, go] } name: { type: string } version: { type: string } declared_range: { type: string, description: Omitted when empty } direct: { type: boolean } license_spdx: { type: string } license_status: { type: string, enum: [pending, resolved, unknown, failed] } license_source: { type: string, description: 'Where the license came from (e.g. npmjs, pypi)' } risk: { type: string, enum: [permissive, weak_copyleft, copyleft, restricted, unknown], description: Omitted while the license is unresolved } first_seen_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } LicenseWatchFinding: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } ecosystem: { type: string } package_name: { type: string } package_version: { type: string } license_spdx: { type: string } kind: { type: string, enum: [denied_license, weak_copyleft, unknown_license, warned_license], description: 'warned_license is a warned-list hit on a license that is not weak copyleft' } severity: { type: string, enum: [critical, warning] } status: { type: string, enum: [open, acknowledged, resolved] } first_seen_at: { type: string, format: date-time } last_seen_at: { type: string, format: date-time } resolved_at: { type: string, format: date-time } acknowledged_by: { type: string, description: User who acknowledged; omitted when empty } LicenseWatchPolicy: type: object properties: enabled: { type: boolean } deny_copyleft: { type: boolean } warn_weak_copyleft: { type: boolean } flag_unknown: { type: boolean } deny_licenses: { type: array, nullable: true, items: { type: string }, description: SPDX ids; null when no policy is saved } warn_licenses: { type: array, nullable: true, items: { type: string } } allow_licenses: { type: array, nullable: true, items: { type: string }, description: Overrides every other rule } LicenseWatchScan: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } user_id: { type: string, description: Omitted when empty } ecosystem: { type: string } manifest: { type: string, description: The uploaded file name } dep_count: { type: integer } direct_count: { type: integer } resolved_count: { type: integer } pending_count: { type: integer } created_at: { type: string, format: date-time } SelectableSkill: type: object description: A declarative skill a session creator may attach in this project. Never includes the instructions body. properties: id: { type: string, format: uuid } name: { type: string } identifier: { type: string } description: { type: string } type: { type: string, enum: [prompt, agent_profile] } scope: { type: string, enum: [org, project] } when_to_use: { type: string, description: Omitted when empty } session_types: { type: array, items: { type: string }, description: Omitted when empty } tags: { type: array, items: { type: string }, description: Omitted when empty } attached: { type: boolean, description: Whether the skill currently attaches to this project } override: { type: string, enum: [enabled, disabled], description: Present only when a project override exists } ProjectConnectorGroup: type: object properties: slug: { type: string, description: Connector catalog slug } instances: type: array items: { $ref: '#/components/schemas/ProjectConnectorInstance' } ProjectConnectorInstance: type: object properties: kind: { type: string, enum: [workflow_credential, hub_account] } id: { type: string, format: uuid } name: { type: string, description: Credential name or account label } credential_type: { type: string, description: workflow_credential only } integration_id: { type: string, description: hub_account only } status: { type: string, description: Omitted when empty } expired: { type: boolean, description: Omitted when false } grant_enabled: { type: boolean, description: hub_account only; whether the project grant is enabled } alias: { type: string, description: Omitted when empty } is_default: { type: boolean } chat_enabled: { type: boolean } customized: { type: boolean, description: True when project settings are stored for this instance } access_level: { type: string, enum: ['off', read, full, custom], description: 'The project''s narrowing of the instance; omitted when the connection''s own level applies' } allowed_actions: { type: array, items: { type: string }, description: 'custom narrowing only: hub actions, or HTTP methods for a workflow credential; omitted otherwise' } domains: { type: array, items: { type: string }, description: 'workflow_credential only: the hosts its chat tool may call (the family''s API hosts, a custom API''s allowed_domains, the configured base URL''s host, or the type''s API hosts); omitted when there are none' } allowed_paths: { type: array, items: { type: string }, description: 'workflow_credential only: the path prefixes its chat tool is confined to; omitted when unrestricted' } description: { type: string, description: 'workflow_credential only: a custom API''s own description; omitted when empty' } chat_capable: { type: boolean, description: Whether the instance can be offered to session agents at all } ProjectIntegrationLink: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } account_id: { type: string, format: uuid } integration_id: { type: string } external_label: { type: string, description: 'Account label, e.g. email or handle' } status: { type: string, enum: [connected, needs_reauth, error] } enabled: { type: boolean, description: False while the grant is parked } granted_by: { type: string, description: Omitted when unknown } created_at: { type: string, format: date-time } ProjectIntegrationAvailableAccount: type: object description: One of the caller's connected accounts. Tokens are never returned. properties: id: { type: string, format: uuid } user_id: { type: string, format: uuid } organization_id: { type: string } integration_id: { type: string } provider: { type: string } external_account_id: { type: string } external_label: { type: string } display_name: { type: string } scopes: { type: array, items: { type: string } } status: { type: string, enum: [connected, needs_reauth, error] } status_reason: { type: string } metadata: { type: object, additionalProperties: true } auto_approve: { type: boolean } connected_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } last_refresh_at: { type: string, format: date-time } last_used_at: { type: string, format: date-time } linked: { type: boolean, description: Whether the account is linked to this project } enabled_in_project: { type: boolean, description: Linked and not parked } ProjectIntegrationError: type: object properties: error: { type: string } code: { type: string } recovery: { type: string, description: Suggested next step } ProjectMCPGrant: type: object properties: id: { type: string, format: uuid, description: MCP server (connection) id } name: { type: string } individual: { type: boolean } enabled: { type: boolean, description: Whether the connection itself is enabled } granted: { type: boolean, description: Whether the grant to this project is enabled } tools: { type: array, items: { type: string }, description: Names of the tools the connection allows } auth_method: { type: string, description: Omitted when empty } status: { type: string, enum: [connected, pending, needs_reauth], description: Omitted on legacy rows } owner: type: object properties: user_id: { type: string, format: uuid } name: { type: string } granted_by: { type: string, description: Omitted when unknown } ProjectJiraMapping: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } account_id: { type: string, format: uuid } jira_project_key: { type: string } external_label: { type: string, description: The Atlassian site name } created_by: { type: string, description: Omitted when unknown } created_at: { type: string, format: date-time } CurrentUser: type: object description: The caller's own profile (GET /users/me). properties: id: { type: string, format: uuid } email: { type: string, format: email } name: { type: string, description: Display name } first_name: { type: string } last_name: { type: string } organization_id: { type: string, description: Active organization id; empty string for an account without one } role: { type: string, enum: [owner, admin, member, viewer], description: Role in the active organization } is_instance_admin: { type: boolean } memberships: type: array description: Organizations the user belongs to (suspended organizations excluded), oldest membership first items: { $ref: '#/components/schemas/UserMembership' } has_completed_onboarding: { type: boolean } language: type: string enum: ['', en, zh-CN, hi, de, fr, ja, es, pt-BR, tr, ko] description: Stored UI language; empty means not chosen (browser detection) theme: type: string enum: ['', light, dark, system] description: Stored theme preference; empty and system both follow the operating system view_prefs: type: object description: | The stored layout of each list (migration 183), keyed by list. A list without a key has no stored choice, and the UI picks its layout from the number of records. Always an object, `{}` when nothing is stored; a stored key or value outside the allow-lists is left out. properties: projects: { type: string, enum: [cards, rows] } workflows: { type: string, enum: [cards, rows] } agents: { type: string, enum: [cards, rows] } skills: { type: string, enum: [cards, rows] } knowledge: { type: string, enum: [cards, rows] } additionalProperties: false has_password: { type: boolean, description: False for SSO-provisioned accounts without password login } totp_enabled: { type: boolean } email_verified: { type: boolean } avatar_updated_at: { type: string, format: date-time, description: Omitted when the user has no avatar } created_at: { type: string, format: date-time } last_login_at: { type: string, format: date-time, description: Omitted when the user never logged in } UserMembership: type: object properties: organization_id: { type: string, format: uuid } organization_name: { type: string } organization_slug: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } UserTOTPStatus: type: object properties: totp_enabled: { type: boolean } pending_setup: { type: boolean, description: A setup secret exists but has not been confirmed yet } backup_codes_remaining: { type: integer } last_used: { type: string, description: RFC 3339 time of the last TOTP use; empty string when never used } org_requires_mfa: { type: boolean, description: The organization mandates MFA (disable is then refused) } UserDiscussionPrefs: type: object properties: bot_muted: { type: boolean, description: Collapse crios_bot messages in the discussion view } UserDiscussionUnread: type: object description: One project discussion channel the caller is behind on. properties: project_id: { type: string, format: uuid } unread_count: { type: integer, maximum: 200 } unread_capped: { type: boolean, description: More than 200 messages are unread; unread_count shows 200 } first_unread_seq: { type: integer, format: int64, description: Sequence number of the oldest unread message } mention_count: { type: integer, description: 'Unread messages that mention the caller (@ plus their display name, its first word, or their email local part); never above unread_count' } UserProjectActivity: type: object description: One project with something for the caller in at least one area. properties: project_id: { type: string, format: uuid } sessions: { type: boolean, description: A session was updated after the caller last opened Sessions } tasks: { type: boolean, description: An open task is assigned to the caller } licensewatch: { type: boolean, description: 'The project has an open License Watch finding and the caller can acknowledge it (editor access or above)' } UserPins: type: object description: Pinned item ids per kind; every key is always present. properties: projects: { type: array, items: { type: string, format: uuid } } workflows: { type: array, items: { type: string, format: uuid } } agents: { type: array, items: { type: string, format: uuid } } knowledge: { type: array, items: { type: string, format: uuid } } agent_profiles: { type: array, items: { type: string, format: uuid } } UserIntegration: type: object description: A personal Gmail or Telegram connection. Credentials are never returned. properties: provider: { type: string, enum: [gmail, telegram] } status: { type: string, description: 'connected, revoked (the provider refused the refresh token; reconnect) or error. A hub-only Gmail account reports the hub account status.' } account_label: { type: string, description: 'Gmail address; for Telegram the "@username" (or first and last name) of the sender who bound the chat' } scopes: { type: string, description: Space-separated granted scopes } auto_approve: { type: boolean, description: 'Gmail only: blast-radius actions run without the approval hold' } connected_at: { type: string, format: date-time } last_used_at: { type: string, format: date-time, nullable: true } last_error: { type: string } IntakeTicketList: type: object properties: tickets: type: array items: { $ref: '#/components/schemas/ExternalTicket' } total: { type: integer, description: 'Tickets matching the filters, before limit and offset' } counts: type: object additionalProperties: { type: integer } description: Tickets per intake_status across the whole inbox, ignoring the status and source filters IntakeTicketTransition: type: object properties: id: { type: string, format: uuid } intake_status: { type: string, description: The ticket's new intake status } project_id: { type: string, format: uuid, description: Assign responses only } SlackChannelLink: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } channel_id: { type: string, description: Slack channel ID } channel_name: { type: string, description: 'Empty when the channel was linked with the `link` chat command, which records only the channel ID' } notification_type: { type: string, description: 'Free-form label; defaults to "all"' } MCPServer: type: object description: | A registered MCP server. The auth-header value and any OAuth material are write-only and never returned. properties: id: { type: string, format: uuid } name: { type: string } transport: type: string enum: [http, stdio] description: '`stdio` only on servers registered before 2026-09-27: new servers are `http`. A stdio server runs only inside a session sandbox; probes, the proxy and workflow steps refuse it.' endpoint: { type: string, description: Omitted when empty } command: { type: string, description: Omitted when empty } args: { type: array, items: { type: string }, description: Omitted when empty } auth_header_name: { type: string, description: Omitted when empty } has_auth: { type: boolean, description: True when a secret is stored } allowed_tools: type: array items: { type: string } description: 'Tools the proxy may call; "*" allows every tool' enabled: { type: boolean } discovered_tools: type: array items: { $ref: '#/components/schemas/MCPServerTool' } description: Tools cached by the last successful probe last_probe_at: { type: string, format: date-time, description: Omitted until the first probe } last_probe_status: { type: string, description: '"ok" or "error: "; omitted until the first probe' } individual: { type: boolean, description: True for a person's own MCP connection } catalog_service: { type: string, description: Connector-catalog service of a connection; omitted when empty } auth_method: { type: string, enum: [mcp_token, mcp_open, mcp_oauth, mcp_custom], description: 'Connections only: the catalog service''s method, or mcp_custom for a person''s own custom server. Omitted for organization servers' } status: { type: string, enum: [connected, pending, error, needs_reauth], description: 'Connection status; omitted when empty (organization servers, and a connection still waiting for its first OAuth consent). pending: a pasted key''s first handshake has not finished; error: the last connect could not reach the server, or the server rejected a reconnect''s key; needs_reauth: the OAuth grant must be renewed' } access_level: type: string enum: ['off', read, full, custom] description: | A person's own connection: the owner's access level, from which `allowed_tools` is derived (`off` no tool, `read` the tools the server marks read-only, re-derived on every probe, `full` every tool, `custom` the picked tools). Organization servers read `full`; their `allowed_tools` is an explicit list. read_tools: { type: array, items: { type: string }, description: 'Discovered tools the server marks read-only (annotations.readOnlyHint); empty when it annotates none' } custom: { type: boolean, description: 'True unless the row connects a connector-catalog service: organization servers and a person''s own custom servers' } headers: type: array items: { $ref: '#/components/schemas/MCPHeader' } description: The header list the server is called with. A secret header carries only its name and source. instructions: { type: string, description: 'Guidance appended to the server''s tool advertisement for agents; omitted when empty' } icon: { type: string, description: 'PNG, JPEG or WebP data URL; omitted when empty' } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } MCPServerTool: type: object properties: name: { type: string } description: { type: string } inputSchema: { type: object, additionalProperties: true, description: JSON Schema of the tool's arguments } annotations: type: object description: The server's behavior hints (MCP tool annotations); omitted when it sends none properties: title: { type: string } readOnlyHint: { type: boolean, description: The tool only reads; this is what the Read access level admits } destructiveHint: { type: boolean } idempotentHint: { type: boolean } openWorldHint: { type: boolean } group: { type: string, description: 'The vendor''s own grouping of the tool as the connector catalog documents it (for example a GitHub toolset); a Crios annotation, omitted when none' } MCPHeader: type: object description: | One header an MCP server is called with. `source` says where the value comes from: `secret` (written once through `header_secrets`, kept in Vault and never returned; for an `Authorization` header a value without a space is sent as `Bearer `), `connection` (resolved at call time from a secret the server's owner already holds, so a rotated token propagates) or `plain` (stored and returned as is). A header that cannot be resolved fails the call instead of being sent empty. The OAuth bearer and the legacy auth header win over a list entry of the same name. required: [name, source] properties: name: { type: string, description: 'An HTTP header token; unique per server, case-insensitively' } source: { type: string, enum: [secret, connection, plain] } value: { type: string, description: 'plain only: a single line. Cleared for the other sources' } ref: { $ref: '#/components/schemas/MCPHeaderRef' } MCPHeaderRef: type: object description: | The secret a `connection` header reads, as the server's owner: the person who owns the connection, or for an organization server the admin who registered it. `hub_account` sends `Bearer ` of the owner's connected account (refreshed when due; the account must be connected and belong to `integration_id`). `workflow_credential` sends one secret field of a project connection of type `cred_type` (the connection's own type), in a project of the server's organization. It is bound three ways, at save and again on every call: the server's endpoint must be `https` on exactly one of the hosts the connection may be sent to (its service's API host, or an HTTP connection's base URL and allowed domains), on that host's port; `key` must be a field the connection's type authenticates requests with (default: its request token), never a client secret, refresh token, private key, password or DSN; and the owner must have created the connection and still be able to edit its project, or manage the project (a connection that acts as one person: its own person's own server only). A save that breaks a rule answers 422 with `code` `mcp_header_host_mismatch`, `mcp_header_no_host`, `mcp_header_field_not_allowed`, `mcp_header_not_permitted`, `mcp_header_personal` or `mcp_header_unavailable` and the header's name in `header`; a saved server that no longer satisfies them answers the same 422 from its probe and its calls, and the request is not sent. `GET /mcp/header-connections` lists what a project's connections may be sent to. required: [kind] properties: kind: { type: string, enum: [hub_account, workflow_credential] } integration_id: { type: string, description: 'hub_account: required' } account_id: { type: string, description: 'hub_account: required' } project_id: { type: string, description: 'workflow_credential: required' } credential_id: { type: string, description: 'workflow_credential: required' } cred_type: { type: string, description: 'workflow_credential: required, the credential''s type' } key: { type: string, description: 'workflow_credential: the secret field to read' } MCPServerError: type: object properties: error: { type: string } ok: { type: boolean, description: Always false } failure_kind: { type: string, enum: [mcp_unreachable, mcp_tool_error], description: Omitted for rate-limit and credential errors of a probe } MCPProbeResult: type: object properties: ok: { type: boolean, description: Always true } server: type: object properties: name: { type: string } version: { type: string } tools: type: array items: { $ref: '#/components/schemas/MCPServerTool' } MCPProxyResult: type: object properties: ok: { type: boolean, description: False when the server ran the tool and reported an error } output: { type: string, description: Tool output text; the error text when ok is false } failure_kind: { type: string, enum: [mcp_tool_error], description: Present only when ok is false } CostSessionTotal: type: object properties: session_id: { type: string, format: uuid } total_cost_usd: { type: number } total_tokens: { type: integer, description: input_tokens plus output_tokens } input_tokens: { type: integer } output_tokens: { type: integer } request_count: { type: integer, description: Recorded LLM cost entries } CostProjectTotal: type: object properties: project_id: { type: string, format: uuid } total_cost_usd: { type: number } total_tokens: { type: integer, format: int64 } active_sessions: { type: integer, description: 'Sessions in an active status: pending, queued, starting, planning, working, recovering, or the legacy running' } completed_sessions: { type: integer, description: Sessions whose status is completed } CostSummary: type: object properties: total_cost_usd: { type: number } total_tokens: { type: integer, format: int64 } active_sessions: { type: integer, description: 'Sessions in an active status: pending, queued, starting, planning, working, recovering, or the legacy running' } total_sessions: { type: integer } CostDailyPoint: type: object properties: date: { type: string, format: date } cost: { type: number, description: USD } tokens: { type: integer, format: int64 } sessions: { type: integer, format: int64, description: Sessions created that day } CostTopProject: type: object properties: project_id: { type: string, format: uuid } project_name: { type: string } cost: { type: number, description: USD } sessions: { type: integer, format: int64, description: All sessions of the project } deleted: { type: boolean, description: True for a soft-deleted project } CostStreamEvent: type: object properties: session_id: { type: string } cost_usd: { type: number } total_tokens: { type: integer } timestamp: { type: integer, format: int64, description: Unix seconds } KnowledgeVersion: type: object description: One immutable snapshot of a prompt entry. properties: version: { type: integer, description: 'Per-entry sequence: 1, 2, 3, ...' } content: { type: string } variables: type: array items: { type: string } checksum: { type: string, description: 'SHA-256 of the content, as "sha256:"' } created_by: { type: string, format: uuid, description: Omitted when unknown } created_at: { type: string, format: date-time } KnowledgeSearchResult: type: object properties: id: { type: string, format: uuid } name: { type: string } content: { type: string } score: { type: number, description: 'Relevance score (semantic similarity, or the keyword-match score in the fallback)' } project_id: { type: string, description: Empty for org-wide entries } org_agent_skill_id: { type: string, format: uuid, description: "Only on a Team Playbook entry: the skill id of the playbook it belongs to. Omitted on every other entry" } org_agent_name: { type: string, description: "Only on a Team Playbook entry: that playbook's name" } PlaybookVersion: type: object description: A snapshot of a playbook's earlier state. properties: version: { type: integer } name: { type: string } description: { type: string } content: { type: string } created_by: { type: string, format: uuid, nullable: true, description: The user whose change created the snapshot; null once that account has been deleted } created_at: { type: string, format: date-time } PlaybookSuggestion: type: object description: A failure→fix pair captured from a session, awaiting (or past) human review. None is captured since the Team Playbook replaced the Playbooks page. properties: id: { type: string, format: uuid } session_id: { type: string, format: uuid } correlation_key: { type: string, description: Failure signature shared by the failure and its recovery } disposition: { type: string, enum: [soft, hard] } occurrences: { type: integer } evidence_event_ids: type: array items: { type: string } description: Session event IDs of the failure and its resolution suggested_rule_text: { type: string, description: Auto-drafted rule for the reviewer to edit } status: { type: string, enum: [pending, approved, rejected, auto_synthesized] } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } project_id: { type: string, description: Project of the source session; empty when unknown } session_type: { type: string, description: Type of the source session; empty when unknown } PlaybookSuggestionGroup: type: object description: Suggestions that share one failure signature. properties: correlation_key: { type: string } sessions_count: { type: integer, description: Distinct sessions that hit the signature } occurrences: { type: integer, description: Sum of the suggestions' occurrence counts } worst_disposition: { type: string, enum: [hard, soft, ''], description: Most severe disposition in the group } sample_suggestion_ids: type: array items: { type: string, format: uuid } description: Up to five suggestion IDs, newest first project_id: { type: string, description: From the newest suggestion's session; empty when unknown } session_type: { type: string, description: From the newest suggestion's session; empty when unknown } PlaybookSuggestionConflict: type: object properties: error: { type: string, description: '"suggestion is not pending"' } status: { type: string, description: The suggestion's current status } PlaybookFailureKBMatch: type: object description: An approved failure→fix rule from the failure knowledge base. properties: correlation_key: { type: string } disposition: { type: string } rule_text: { type: string } suggestion_id: { type: string, description: 'Source suggestion; empty for a rule that is not the caller organization''s own (shared seeded rules included)' } session_id: { type: string, description: 'Source session; empty unless the rule is the caller organization''s own and the caller is an organization owner or admin' } score: { type: number, description: Similarity score } Skill: type: object description: An installed skill. `manifest` is the active version's manifest. properties: id: { type: string, format: uuid } organization_id: { type: string, format: uuid } project_id: { type: string, format: uuid, description: Present only for project-scoped skills } identifier: { type: string, description: Organization-unique slug; stays reserved while the skill is archived } name: { type: string } description: { type: string } type: { type: string, enum: [prompt, agent_profile, workflow, tool, connector, code, composite], description: '"tool" is retired: existing rows keep working, new installs are rejected' } scope: { type: string, enum: [org, project] } status: { type: string, enum: [draft, installed, enabled, disabled, archived] } manifest: { $ref: '#/components/schemas/SkillManifest' } permissions: { type: array, items: { type: string }, description: 'Capability grants the active manifest declares, e.g. "network.github.com"' } active_version: { type: integer } external_authoring_pending: { type: boolean, description: 'An API or MCP caller wrote a version (or a rollback made one live) that no admin has confirmed since. Enabling then needs `confirm_permissions` and answers 409 with a `review` first; a confirmed enable clears it. Always present' } last_confirmed_version: { type: integer, description: The version the last confirmed enable put live. Omitted when no enable was ever confirmed } created_by: { type: string, format: uuid, description: Omitted when unknown } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } SkillDetail: allOf: - $ref: '#/components/schemas/Skill' - type: object properties: active_provenance: { $ref: '#/components/schemas/SkillVersionProvenance' } workflows_owned: type: array items: { $ref: '#/components/schemas/SkillWorkflow' } description: Workflows materialized from the skill's packaged workflows/ definitions advertised_tools: type: array items: { $ref: '#/components/schemas/SkillToolDescriptor' } description: Agent tools the skill derives (executable skills that advertise, and composites) effective_permissions: { type: array, items: { type: string }, description: Composites only; merged permissions of the composite and its dependencies. Left out with composition_hidden } composition_warnings: { type: array, items: { type: string }, description: Composites only; present when the compile left notes. Left out with composition_hidden } composition_error: { type: string, description: Composites only; why the dependency graph does not compile. Left out with composition_hidden } composition_hidden: { type: boolean, description: 'Composites only; true when the dependency graph reaches a skill in a project the caller cannot open, also when the graph does not compile. advertised_tools is then [] and effective_permissions, composition_error and composition_warnings are left out. Absent otherwise; org owners and admins, and anyone who can open every project involved, never get it' } SkillWorkflow: type: object properties: id: { type: string, format: uuid } skill_id: { type: string, format: uuid } organization_id: { type: string, format: uuid } name: { type: string, description: Packaged definition name } workflow_id: { type: string, description: The materialized workflow } created_at: { type: string, format: date-time } SkillToolDescriptor: type: object description: One agent-callable tool derived from a skill manifest. properties: name: { type: string } description: { type: string } input_schema: { type: object, additionalProperties: true, description: JSON Schema of the tool input } skill_id: { type: string, format: uuid } skill_identifier: { type: string } dispatch: type: object properties: kind: { type: string, enum: [connector_action, workflow, code, composite, connector_request, hub_action] } action: { type: string, description: 'Connector action, composite tool key or hub action name' } credential_id: { type: string, description: connector_request only } integration_id: { type: string, description: hub_action only } account_id: { type: string, description: hub_action only } SkillManifest: type: object description: The skill.yaml document (strict; unknown keys are rejected). required: [apiVersion, kind, metadata, spec] properties: apiVersion: { type: string, enum: [crios.io/v1] } kind: { type: string, enum: [Skill] } metadata: type: object properties: name: { type: string, maxLength: 100 } identifier: { type: string, pattern: '^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$' } version: { type: string, description: Semver } description: { type: string, maxLength: 500 } author: { type: string } tags: { type: array, maxItems: 20, items: { type: string, pattern: '^[a-z0-9-]{1,32}$' } } annotations: { type: object, additionalProperties: { type: string }, description: Platform-owned extension keys } spec: type: object properties: type: { type: string, enum: [prompt, agent_profile, workflow, tool, connector, code, composite] } whenToUse: { type: string, maxLength: 2000 } sessionTypes: { type: array, items: { type: string } } advertise: { type: boolean, description: Executable types only; whether derived tools are advertised to agents (default true) } instructions: { type: string, description: Declarative body (at most 64 KiB) } inputs: { type: object, additionalProperties: { $ref: '#/components/schemas/SkillManifestInput' } } outputs: type: object additionalProperties: type: object properties: type: { type: string } description: { type: string } permissions: { type: array, items: { type: string }, description: 'Capability strings, e.g. "network.github.com", "filesystem./workspace:rw"' } credentials: { type: array, items: { type: string }, description: 'Credential slots "_", e.g. "github_oauth"; connectors: jira, github, slack, gitlab, google, x, instagram, tiktok, facebook, telegram' } dependencies: type: array items: type: object properties: identifier: { type: string } versionRange: { type: string } workflows: { type: array, items: { type: string }, description: Workflow references } entrypoint: type: object properties: type: { type: string, enum: [declarative, golang, wasm] } source: { type: string } connector: type: object description: Required for connector skills, forbidden otherwise properties: base_url: { type: string } auth: type: object properties: type: { type: string, enum: [none, apikey, bearer, basic] } credential: { type: string, description: The spec.credentials slot to authenticate with } header: { type: string, description: API-key header name (apikey only) } actions: type: array items: type: object properties: name: { type: string } description: { type: string } method: { type: string } path: { type: string, description: 'Path template under base_url; {var} placeholders come from inputs' } inputs: { type: object, additionalProperties: { $ref: '#/components/schemas/SkillManifestInput' } } SkillManifestInput: type: object properties: type: { type: string, enum: [string, number, boolean, object, array, secret], description: '"secret" is reserved and currently rejected' } description: { type: string } required: { type: boolean } default: { type: string, description: Canonical string form; non-string JSON defaults are accepted on input and stored as their JSON text } SkillInstallEnvelope: type: object required: [manifest] properties: manifest: { type: string, description: skill.yaml text } files: { type: object, additionalProperties: { type: string }, description: 'Package files as path -> text, under src/, tests/, workflows/, connectors/, assets/ or prompts/ (e.g. workflows/main.json)' } SkillVersion: type: object description: An immutable published version. properties: id: { type: string, format: uuid } skill_id: { type: string, format: uuid } version: { type: integer } semver: { type: string } manifest: { $ref: '#/components/schemas/SkillManifest' } checksum: { type: string, description: SHA-256 hex of the manifest JSON } created_by: { type: string, format: uuid, description: Omitted when unknown } created_at: { type: string, format: date-time } provenance: { $ref: '#/components/schemas/SkillVersionProvenance' } SkillVersionProvenance: type: object description: | How a version was written. Omitted for versions written before this was recorded. `client_name` and `redirect_host` are what the OAuth client registered, captured when the version was written: text the client chose, never a verified identity. properties: via: { type: string, enum: [browser, api, mcp], description: 'browser: a person in Crios; api: a personal access token or OAuth token used directly; mcp: through the Crios MCP server' } client_id: { type: string, description: OAuth client id; omitted when the write carried no OAuth token } client_name: { type: string } client_kind: { type: string, description: 'How the client registered: dcr, cimd or registered' } redirect_host: { type: string, description: 'The client''s redirect hosts, comma-separated' } SkillEnableReview: type: object description: | What an admin reviews before enabling a skill an API or MCP caller wrote. Excerpts are cut at 600 characters; the full text is the active version's manifest. properties: active_version: { type: integer, description: The version enabling puts live; a confirmation sends it back as `reviewed_version` } diff_against: { type: integer, description: 'The version to diff against: `last_confirmed_version`, else the skill''s first version' } external_version: { type: integer, description: The newest version an API or MCP caller wrote; 0 when none did } provenance: { $ref: '#/components/schemas/SkillVersionProvenance' } created_by: { type: string, description: 'Who wrote `external_version`; may be ""' } created_by_name: { type: string } scope: { type: string, enum: [org, project] } project_id: { type: string, format: uuid } project_name: { type: string } instructions_excerpt: { type: string } instructions_truncated: { type: boolean } when_to_use_excerpt: { type: string } when_to_use_truncated: { type: boolean } connector_host: { type: string, description: "Connector skills; the lowercase host of `base_url`, without the port" } credential_hosts: type: array description: 'Each declared credential slot and the host its secret is sent to; "" when Crios cannot say (every type but connector)' items: type: object properties: slot: { type: string } host: { type: string } packaged_workflows: { type: array, items: { type: string }, description: The workflows enabling the skill activates } SkillReapproval: type: object description: A publish or rollback that widened the approved capability surface. The version is live; the skill is disabled until an org admin re-enables it. properties: permission_reapproval_required: { type: boolean, enum: [true] } added: { type: array, items: { type: string }, description: 'The widened grants (credential slots as "credential:")' } status: { type: string, enum: [disabled] } version: { $ref: '#/components/schemas/SkillVersion' } materialization_error: { type: string, description: Present when re-materializing the owned workflows also failed } SkillFieldError: type: object properties: field: { type: string, description: 'Manifest field path, e.g. spec.permissions[0]' } message: { type: string } SkillValidationResult: type: object properties: valid: { type: boolean } errors: { type: array, items: { $ref: '#/components/schemas/SkillFieldError' } } warnings: { type: array, items: { type: string } } manifest: { $ref: '#/components/schemas/SkillManifest' } SkillGenerateRequest: type: object required: [description] properties: description: { type: string, maxLength: 4000, description: What the skill should do } project_id: { type: string, format: uuid, description: Ground the draft in this project's scope (must belong to the caller's organization) } type_hint: { type: string, enum: [prompt, agent_profile, workflow, connector, code, composite], description: "The retired tool type is refused (400)" } current_manifest: { type: string, description: 'Refinement: the draft YAML to modify (at most 64 KiB)' } SkillGenerateResult: type: object properties: manifest: { type: string, description: Draft manifest as YAML; empty when no draft was produced } requirements: type: object nullable: true properties: goal: { type: string } inputs: { type: array, items: { type: string } } outputs: { type: array, items: { type: string } } tools: { type: array, items: { type: string } } integrations: { type: array, items: { type: string } } permissions: { type: array, items: { type: string } } validation_errors: { type: array, items: { $ref: '#/components/schemas/SkillFieldError' }, description: Non-empty when the draft still fails validation after the repair round } warnings: { type: array, items: { type: string } } repaired: { type: boolean, description: The draft came from the repair round } files: { type: object, additionalProperties: { type: string }, description: Package files the pipeline stages produced (path -> text); present only when there are any } sandbox: { $ref: '#/components/schemas/SkillTestReport' } execution: { $ref: '#/components/schemas/SkillTestReport' } SkillGenerateRunStarted: type: object description: 'The answer of POST /skills/generate/runs: the run is recorded and its generation is running, detached from the request.' properties: run_id: { type: string, format: uuid, description: 'The run to read with GET /skills/generate/runs/{runId}' } status: { type: string, enum: [running] } example: { run_id: 3f2b8c1e-5a4d-4e7f-9b21-0c6d8e9f1a2b, status: running } SkillGenerateRun: type: object description: | A skill generation run as its starter reads it. `result` is present only when `status` is `done`; `code` and `error` only when it is `failed`. A run still `running` four minutes after `started_at` has lost its worker (a restart mid-generation) and is answered `failed` with `generation_orphaned`. required: [run_id, status, started_at] properties: run_id: { type: string, format: uuid } status: { type: string, enum: [running, done, failed] } started_at: { type: string, format: date-time, description: 'When the run was admitted, in UTC, on the database''s clock' } project_id: { type: string, format: uuid, description: The project the run was started for; absent when none was given } finished_at: { type: string, format: date-time, description: When the run ended; absent while it runs } code: type: string enum: [budget_exceeded, generation_unavailable, invalid_model_output, generation_timeout, invalid_request, generation_failed, internal_error, generation_orphaned] description: 'A failed run: the code POST /skills/generate would have failed with, or generation_orphaned for a run whose worker stopped before it finished' error: { type: string, description: 'A failed run: the user-safe message. For generation_orphaned: "the generation stopped before it finished, most likely because the server restarted; start a new one"' } result: { $ref: '#/components/schemas/SkillGenerateResult' } SkillGenerateRunsLimit: type: object description: 'A generation run refused by a cap (code generation_runs_limit). Nothing was recorded or audited.' properties: error: { type: string } code: { type: string, enum: [generation_runs_limit] } limit: type: string enum: [user_running, org_running, user_hourly, org_daily] description: 'The cap that refused the run: user_running (2 running per user, across organizations), org_running (5 running per organization), user_hourly (SKILLS_GENERATE_USER_PER_HOUR started per user per hour, default 10, across organizations) or org_daily (SKILLS_GENERATE_ORG_PER_DAY started per organization per day, default 100). When several caps are full, the one that frees last' retry_after: type: integer minimum: 1 description: 'Whole seconds, also sent as the Retry-After header. For user_hourly and org_daily, when the counted run that has to leave the window leaves it: sooner is refused. For user_running and org_running, when the oldest running run would be orphaned, at least 5: an upper bound, since a place frees as soon as a run ends' example: { error: 'You already have 2 skill generations running; start another when one has finished.', code: generation_runs_limit, limit: user_running, retry_after: 212 } SkillPublishReviewRequest: type: object description: | The confirmation of the publish review: the person was shown the packaged workflows of `reviewed_version` and confirms them. Both keys come together; `{}`, an empty body and `{"confirm": false}` are no confirmation. Anything else (confirm without reviewed_version, reviewed_version without confirm, a reviewed_version that is not a whole number of at least 1, a body that is not a JSON object, or, on publish, a `?expected_version` that names another version) answers 400 with code invalid_request before the skill is read. properties: confirm: { type: boolean } reviewed_version: { type: integer, minimum: 1, description: 'The active_version of the publish_review_required (or review_outdated) answer whose list was shown' } example: { confirm: true, reviewed_version: 2 } SkillPackagedWorkflowReview: type: object description: 'One packaged workflows/ definition as the publish review lists it. Only names, node types and hosts; the definition itself is in the package. Every node of every graph level counts (container subgraphs and compensate graphs), disabled nodes too, and the tools of a crios.agent v2 node with an inline definition are reviewed as nodes by the same rules: a url or allowedHosts the model fills is "(dynamic)", and web access, delegation, workflow, agent and MCP tools, a definition that does not parse or is nested more than 8 levels deep, and a stored (not inline) agent are "(dynamic)". Every list is sorted, unique and never null. host_nodes and integrations came with the P3 review fixes; a client reading an older server takes a missing one as []' required: [name, triggers, host_access, api_write, host_nodes, integrations] properties: name: { type: string, description: 'The workflow''s name, as the package writes it (a name with leading or trailing whitespace is refused before any review)' } triggers: { type: array, items: { type: string }, description: 'The types of its trigger nodes (e.g. crios.trigger.schedule); a type the catalog does not register only when it has a trigger type''s shape (crios.trigger. and lowercase segments)' } host_access: { type: array, items: { type: string }, description: 'The hosts the definition names: the literal host of a node''s url (a type whose catalog schema declares a top-level url); each allowedHosts entry of a type that declares one (crios.http, crios.webhook.call, crios.ftp, crios.ssh), trimmed, lowercased and without a trailing dot, globs kept as written (e.g. "*.example.com"); and the literal host of crios.git''s sourceRepository and targetRepository and of a vendor''s callback URL (crios.bannerbear webhookUrl, crios.uproc dataWebhook). "(dynamic)" stands for a host that cannot be named here: a URL or allowedHosts entry an expression writes, an allowedHosts that is not a literal list of strings, a node that follows a redirect to any public host (crios.webhook.call, crios.rss, crios.trigger.rss, crios.trigger.sse, crios.web.fetch), a node that runs a workflow, stored agent or MCP tool named by id (crios.workflow.call, crios.tool.workflow, crios.tool.agent, crios.tool.mcp, crios.mcp.call), settings.errorWorkflowId, and the inline-agent cases above' } api_write: { type: boolean, description: 'Whether it writes through a Crios or database API: crios.api with allowWrites true, an action with a database credential slot other than crios.db.read, settings.errorWorkflowId (it starts another workflow when a production run fails), or one of Crios''s own writers (crios.session, crios.discussion.post, crios.agent.message.send, crios.signal.emit, crios.workflow.call, crios.tool.workflow, crios.tool.agent, crios.agent, crios.agent.claim, crios.agent.status)' } host_nodes: { type: array, items: { type: string }, description: 'Its server-access node types, the ones the workflow API gates behind workflow.host_access: crios.command, crios.file.read, crios.file.write, crios.git, crios.ssh, crios.trigger.file (one hardcoded list, so an unregistered type still counts)' } integrations: { type: array, items: { type: string }, description: 'The types of its registered nodes that call an integration through a connector or credential: a non-empty credentials ref on the node in the definition, or a credential slot of the type (required or optional) that applies to the node''s parameters (crios.http with auth other than a credential is not listed); plus crios.postbin, crios.quickchart, crios.hackernews and crios.openthesaurus, which call a host their type fixes with no credential. A crios.agent whose inline definition binds a model credential is listed. A crios.api or database node is listed here and counts in api_write' } SkillPublishReview: type: object description: | 409 of publish, unarchive or a rollback that would install packaged workflows an API or MCP caller wrote (`external_authoring_pending`) without a confirmation of that version. `publish_review_required`: no confirmation was sent. `review_outdated` (publish and unarchive only): the confirmation named another version than the one now active, which needs a review too; the list is the active one's. Answered after the project check, so an outsider gets 404. required: [error, code, active_version, workflows] properties: error: type: string enum: - publishing this skill installs workflows an app wrote; review them first - unarchiving this skill installs workflows an app wrote; review them first - rolling back to this version installs workflows an app wrote; review them first - the skill changed after its workflows were reviewed; review them again code: { type: string, enum: [publish_review_required, review_outdated] } active_version: { type: integer, minimum: 1, description: 'The version a confirmation must name in reviewed_version: the active version, or for a rollback the target' } workflows: { type: array, minItems: 1, items: { $ref: '#/components/schemas/SkillPackagedWorkflowReview' }, description: 'That version''s packaged workflows, in the package''s file order' } example: error: publishing this skill installs workflows an app wrote; review them first code: publish_review_required active_version: 1 workflows: - { name: Cleanup, triggers: [crios.trigger.webhook], host_access: [], api_write: false, host_nodes: [], integrations: [] } - { name: Nightly report, triggers: [crios.trigger.schedule], host_access: ['(dynamic)', api.example.com], api_write: true, host_nodes: [], integrations: [crios.db.write, crios.webhook.call] } - { name: Server ops, triggers: [crios.trigger.schedule], host_access: [], api_write: false, host_nodes: [crios.ssh], integrations: [crios.slack, crios.ssh] } SkillWorkflowNameTaken: type: object description: 'A packaged workflows/ definition is named like a workflow of the skill''s project that this skill does not own (a hand-made one, another skill''s, an agent''s), compared case-insensitively; materializing it would overwrite that workflow. Exactly these three keys. Nothing was stored, and the status did not move' required: [error, code, workflow] properties: error: { type: string, description: 'a workflow named already exists in this project' } code: { type: string, enum: [workflow_name_taken] } workflow: { type: string, description: "The name, as the package spells it, trimmed" } example: { error: a workflow named Cleanup already exists in this project, code: workflow_name_taken, workflow: Cleanup } SkillTestReport: type: object description: Review data from the generation pipeline's sandbox or execution-test stage; never a generation failure. properties: passed: { type: boolean } notes: { type: array, items: { type: string } } diagnostics: { type: array, items: { type: string } } SkillCredentialStatus: type: object properties: slot: { type: string, description: 'Declared slot, e.g. github_oauth' } satisfied: { type: boolean } source: { type: string, enum: [none, connectorcfg, integrations, workflow] } detail: { type: string } SkillCredentialPlanSlot: allOf: - $ref: '#/components/schemas/SkillCredentialStatus' - type: object properties: connector: { type: string } auth_kind: { type: string } fulfillment_options: type: array items: { $ref: '#/components/schemas/SkillCredentialOption' } description: Present only for unsatisfied slots, ordered project credential, connected account, org connector SkillCredentialOption: type: object properties: kind: { type: string, enum: [workflow_credential, hub_account, org_app] } credential_type: { type: string, description: 'workflow_credential: the connector, when it is itself a credential type' } credential_types: { type: array, items: { type: string }, description: "workflow_credential: the family's service credential types" } suggested_name: { type: string, description: 'workflow_credential: a credential named like the slot also satisfies it' } create_path: { type: string, description: 'workflow_credential: /api/v1/workflows/credentials' } dedicated_flow: { type: string, description: 'workflow_credential: "telegram" when the generic create endpoint refuses the type' } integration_ids: { type: array, items: { type: string }, description: 'hub_account: provider ids whose connected accounts fill the slot' } connect_path: { type: string, description: 'hub_account: /connectors' } org_app_configured: { type: boolean, description: 'hub_account: whether the org OAuth app is configured' } connector: { type: string, description: 'org_app: the org connector to configure' } admin_only: { type: boolean, description: 'org_app: always true' } SkillDependencyNode: type: object description: 'One declared dependency. A dependency held by a skill in a project the caller cannot open is exactly {identifier, version_range, status: hidden}: no other key and no children' properties: identifier: { type: string } version_range: { type: string } status: { type: string, enum: [ok, missing, disabled, mismatch, cycle, error, truncated, hidden], description: 'hidden: held by a skill in a project the caller cannot open' } reason: { type: string } skill_id: { type: string, format: uuid } name: { type: string } type: { type: string } skill_status: { type: string } active_semver: { type: string } dependencies: type: array items: { $ref: '#/components/schemas/SkillDependencyNode' } SkillVersionDiff: type: object properties: from_version: { type: integer } from_semver: { type: string } to_version: { type: integer } to_semver: { type: string } identical: { type: boolean } unified: { type: string, description: Unified diff text; empty when identical } SkillHealth: type: object properties: status: { type: string, enum: [draft, installed, enabled, disabled, archived] } runtime: { type: string, enum: [declarative, workflow, code, connector, composite, none], description: "composite skills run through their dependencies' runtimes; none is the retired tool type" } available: { type: boolean } detail: { type: string } checked_at: { type: string, format: date-time } SkillExecuteRequest: type: object properties: inputs: { type: object, additionalProperties: true, description: Input values by name } session_type: { type: string, description: Session type the skill must apply to } action: { type: string, description: Connector skills only; the declared action to run } tool: { type: string, description: Composite skills only; the advertised tool to run (omit for the composition report) } session_id: { type: string, format: uuid, description: Calling session; required for sandbox tokens } wait_seconds: { type: integer, minimum: 0, maximum: 30, description: 'Workflow skills only: how long to await the run before answering with its execution_id and a null output. Absent waits 30 s; the wait also ends 2 s before the request''s own deadline' } SkillExecuteResult: type: object description: | Keys depend on the skill type: prompt/agent_profile `appendix`; workflow `execution_id` and `output` (null when the run was still going after 30 s); code `output` and `logs`; connector `status_code`, `body` and `headers`; composite without `tool` `composite`, `appendix`, `tools`, `effective_permissions` and `warnings` (with `tool`, the owning dependency's keys). properties: appendix: { type: string, description: Rendered system-prompt appendix } execution_id: { type: string, description: Workflow execution id } output: { type: object, nullable: true, additionalProperties: true } logs: { type: string, description: Code runner log tail } status_code: { type: integer, description: Upstream HTTP status } body: { description: 'Upstream body; JSON passes through, anything else as a string' } headers: { type: object, additionalProperties: { type: string }, description: Safe subset of upstream headers (content-type) } composite: { type: string, description: Composite identifier } tools: { type: array, items: { $ref: '#/components/schemas/SkillToolDescriptor' } } effective_permissions: { type: array, items: { type: string } } warnings: { type: array, items: { type: string } } SkillExecution: type: object description: One dispatched execution. Outcomes and sizes only. properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid, description: Omitted when empty } skill_id: { type: string, format: uuid } skill_version: { type: integer } skill_type: { type: string } origin: { type: string, enum: [test, agent, api] } actor_id: { type: string, format: uuid, description: Omitted when empty } session_id: { type: string, format: uuid, description: Omitted when empty } tool: { type: string, description: Connector action or composite tool; omitted when empty } status: { type: string, enum: [success, error] } error_kind: { type: string, description: 'invalid_input, forbidden, not_found, conflict, unprocessable, rate_limited, upstream_error, not_configured, internal, timeout or output_capped' } error_message: { type: string, description: Redacted detail (at most 1024 characters) } input_bytes: { type: integer, format: int64 } output_bytes: { type: integer, format: int64 } duration_ms: { type: integer, format: int64 } workflow_execution_id: { type: string, description: Workflow skills only } started_at: { type: string, format: date-time } created_at: { type: string, format: date-time } SkillExecutionStats: type: object properties: total: { type: integer, format: int64 } success: { type: integer, format: int64 } errors: { type: integer, format: int64 } p50_duration_ms: { type: integer, format: int64 } p95_duration_ms: { type: integer, format: int64 } origins: { type: object, additionalProperties: { type: integer, format: int64 }, description: 'Runs per origin (test, agent, api); origins without runs are omitted' } days: type: array description: Last 14 UTC days, oldest first, zero-filled items: type: object properties: date: { type: string, format: date } total: { type: integer, format: int64 } errors: { type: integer, format: int64 } SkillError: type: object description: Error envelope of the skills API. `error` is always present; the other keys appear only for the failure classes noted. properties: error: { type: string } details: { type: string } fields: { type: array, items: { $ref: '#/components/schemas/SkillFieldError' }, description: 'error "invalid skill manifest"' } dependencies: type: array description: 'error "unmet skill dependencies"' items: type: object properties: identifier: { type: string } reason: { type: string } workflows: type: array description: 'error "unresolved workflow references"' items: type: object properties: ref: { type: string } error: { type: string } files: type: array description: 'error "invalid packaged workflow definitions": objects naming each file and its error (a definition whose name has leading or trailing whitespace, a no-break space included: "workflow name has leading or trailing whitespace"). code draft_has_package_files: the paths, as strings, of the draft''s package that an update with only a manifest would remove, sorted, at most 20, with no total' items: oneOf: - type: object properties: file: { type: string } error: { type: string } - type: string skill: { type: string, description: 'error "skill has enabled dependents"' } dependents: { type: array, items: { type: string }, description: 'error "skill has enabled dependents": the identifiers of the enabled dependents, sorted. An archive names only those in projects the caller can open, so there the list can be empty; disable names every one' } hidden_dependents: { type: boolean, description: 'error "skill has enabled dependents", on an archive: present, and true, when enabled dependents in projects the caller cannot open were left out of dependents. It names and counts none' } path: { type: array, items: { type: string }, description: 'error "skill dependency cycle detected"' } kind: { type: string, description: 'Execute denials (403 session scope, 429 admission)' } code: { type: string, description: 'POST /skills/generate: generation_not_configured, invalid_request, budget_exceeded, generation_unavailable, generation_timeout, invalid_model_output, generation_failed or internal_error. POST /skills/{id}/execute: connector_address_denied, connector_upstream_error, connector_transport_error, workflow_project_access_required or dependency_project_access_required. POST /skills/generate/runs: generation_not_configured, invalid_request, connected_app_drafts_disabled, generation_store_unavailable (generation_runs_limit has its own schema, SkillGenerateRunsLimit). GET /skills/generate/runs/{runId}: generation_run_not_found, generation_store_unavailable. POST /skills and PATCH /skills/{id} from a connected app: connected_app_drafts_disabled, draft_required, project_scope_required, draft_limit, not_your_draft, not_a_draft, draft_has_package_files (PATCH only; packaged_workflows_require_review was removed in P3); PATCH /skills/{id} from any caller: admin_required, version_conflict, status_changed. POST /skills/{id}/publish: version_conflict, status_changed (also with error "skill is not a draft" when the first read finds no draft), invalid_request (the review body). POST /skills/{id}/unarchive and /rollback: invalid_request (the review body); unarchive also version_conflict (with current_version), for a confirmation of another version than the active one when the active one needs no review. publish_review_required, review_outdated (SkillPublishReview) and workflow_name_taken (SkillWorkflowNameTaken) have their own schemas. POST /skills/{id}/rollback and DELETE /skills/{id}: status_changed. POST /skills/{id}/enable: status_changed. POST /skills/{id}/preview: preview_unsupported_type, skill_archived. Any /api/v1 route, from the auth middleware before the handler, with X-Crios-Require-Connected-App: invalid_require_connected_app (400) and connected_app_not_recognised (403)' } scope: { type: string, enum: [deployment, organization], description: 'code connected_app_drafts_disabled: which switch is off. deployment is CRIOS_CONNECTED_APP_SKILL_DRAFTS, which only the operator changes and which wins when both are off; organization is the Organization page''s switch' } upstream_status: { type: integer, description: 'code connector_upstream_error: the status the upstream answered' } limit: { type: integer, description: 'code draft_limit: the most open skill drafts saved by connected apps one user may have in the organization (SKILLS_CONNECTED_APP_MAX_DRAFTS, default 25)' } current_version: { type: integer, description: 'code version_conflict: the active version now; reload it, re-apply the edit and send this as expected_version' } status: { type: string, enum: [draft, installed, enabled, disabled, archived], description: 'code not_a_draft: the skill''s status; code status_changed (PATCH, publish, rollback, archive, enable): its status now' } OrgMember: type: object properties: id: { type: string, format: uuid, description: User ID } email: { type: string } name: { type: string } role: { type: string, enum: [owner, admin, member, viewer], description: Role held in this organization } created_at: { type: string, format: date-time, description: When the user joined this organization } last_login_at: { type: string, format: date-time } OrgMemberLimitError: type: object description: Error body. The member-limit variant adds `code`, `details` and `limit`; other 403s carry only `error`. properties: error: { type: string } code: { type: string, enum: [org_member_limit] } details: { type: string } limit: { type: integer } AuthCodedError: type: object description: Error body with a stable machine-readable `code` a client can branch on. properties: error: { type: string } code: { type: string, enum: [invalid_totp_code, sso_required] } OrgSettings: type: object properties: chat_verbosity: { type: string, enum: [verbose, concise] } require_mfa: { type: boolean, description: Users whose active organization this is must verify or enrol TOTP when they sign in } allow_signups: { type: boolean, description: "Public self-registration (POST /auth/register). Only the signup-target organization's flag (the default organization, else the oldest) takes effect, and only while deployment_allows_signups is true" } deployment_allows_signups: { type: boolean, readOnly: true, description: "The deployment's CRIOS_ALLOW_SIGNUPS (orchestrator.config.allowSignups), a ceiling over allow_signups: when false, registration stays closed whatever allow_signups says. Not settable here" } allow_signups_applies: { type: boolean, readOnly: true, description: "Whether this organization's allow_signups is the one registration reads (the signup-target organization). When false the toggle has no effect: hide it, and an update that changes allow_signups answers 409 `allow_signups_not_applicable`" } connected_app_skill_drafts: { type: boolean, description: "Whether apps connected through the Crios MCP server may write skill drafts in this organization. On by default. Takes effect only while deployment_allows_connected_app_skill_drafts is true" } deployment_allows_connected_app_skill_drafts: { type: boolean, readOnly: true, description: "The deployment's CRIOS_CONNECTED_APP_SKILL_DRAFTS (orchestrator.config.connectedAppSkillDrafts), a ceiling over connected_app_skill_drafts. Not settable here" } OrgCADefault: type: object properties: default_provider: { type: string, enum: [letsencrypt, zerossl, google], description: The stored default; letsencrypt when none is set } available: { type: array, items: { type: string, enum: [letsencrypt, zerossl, google] }, description: "The authorities the organization may choose: letsencrypt always, zerossl and google once their EAB credentials are configured" } OrgSettingsUpdate: type: object description: Partial update; at least one field is required. properties: chat_verbosity: { type: string, enum: [verbose, concise] } require_mfa: { type: boolean } allow_signups: { type: boolean } connected_app_skill_drafts: { type: boolean } OrgInvitation: type: object properties: id: { type: string, format: uuid } email: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } status: { type: string, enum: [pending] } created_at: { type: string, format: date-time } expires_at: { type: string, format: date-time } invited_by_email: { type: string, description: Empty when the inviter no longer exists } invited_by_name: { type: string } OrgInvitationSent: type: object properties: id: { type: string, format: uuid } email: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } status: { type: string, enum: [pending] } created_at: { type: string, format: date-time, description: Create only } expires_at: { type: string, format: date-time } email_sent: { type: boolean } email_configured: { type: boolean, description: False when no mailer is configured; true with email_sent=false means the send failed } accept_url: { type: string, description: Present only when email_sent is false } LicenseAcceptance: type: object properties: component: { type: string, enum: [android-sdk] } terms_version: { type: string } accepted_by: { type: string, format: uuid, nullable: true } accepted_at: { type: string, format: date-time } GroupProjectShare: type: object properties: project_id: { type: string, format: uuid } project_name: { type: string } role: { type: string, enum: [viewer, editor] } added_at: { type: string, format: date-time } ProviderHealthResults: type: object properties: statuses: type: array items: type: object properties: name: { type: string } status: { type: string, enum: [healthy, unhealthy] } error: { type: string, description: Present when unhealthy } ProviderLocalLLMError: type: object description: Error body. The local-LLM variant adds `code`; other 403s carry only `error`. properties: error: { type: string } code: { type: string, enum: [local_llm_requires_enterprise] } ProviderRegistryEntry: type: object properties: id: { type: string } slug: { type: string } display_name: { type: string } api_base: { type: string } protocol: { type: string, enum: [openai, anthropic], description: Guessed generic-client protocol hint } npm: { type: string } doc_url: { type: string } env_vars: { type: array, items: { type: string } } model_count: { type: integer } updated_at: { type: string, format: date-time } configured: { type: boolean, description: The organization already has this provider } builtin: { type: boolean } OrgConnectorName: type: string enum: [jira, github, slack, gitlab, google, x, instagram, tiktok, facebook, discord, telegram] JiraMapping: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } jira_project_key: { type: string, description: The Jira project whose issues the mapping routes } board_id: { type: integer } sprint_id: { type: integer } acceptedIssueTypes: { type: array, items: { type: string } } labelFilter: { type: string } priorityMapping: { type: object, additionalProperties: { type: string } } transitionMapping: { type: object, additionalProperties: { type: string } } IntegrationsHubProviderStats: type: object properties: integration_id: { type: string } accounts: { type: integer, description: Connected member accounts } users: { type: integer, description: Distinct members owning them } broken: { type: integer, description: Accounts not in the connected state } linked_projects: { type: integer, description: Projects linked to one of these accounts } IntegrationsHubJiraMapping: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } project_name: { type: string } jira_project_key: { type: string } external_label: { type: string, description: The linked Jira account's label } owner_email: { type: string, description: Empty when the owning user no longer exists } created_at: { type: string, format: date-time } MCPClient: type: object properties: service: { type: string } client_id: { type: string, description: Empty when none is stored } has_secret: { type: boolean } CertificateAuthorityStatus: type: object properties: name: { type: string, enum: [zerossl, google-public-ca] } email: { type: string } key_id: { type: string } configured: { type: boolean } AdminHealth: type: object properties: status: { type: string, enum: [up, degraded, down] } checked_at: { type: string, format: date-time } version: type: object properties: image_tag: { type: string } migration_version: { type: integer, format: int64 } chart_version: { type: string } components: type: object description: Keyed by component name (postgres, pipeline_postgres, redis, qdrant, qdrant_generalized, vault, searxng, gitea, provider:) additionalProperties: type: object properties: status: { type: string, enum: [up, down, unknown] } latency_ms: { type: number } detail: { type: string } workers: type: array items: type: object properties: name: { type: string } last_run: { type: string, format: date-time } expected_interval_seconds: { type: number } stale: { type: boolean, description: "True when the worker has been silent for more than 3x expected_interval_seconds and at least 60 s; never for an interval of 0 (on-demand workers)" } SSOSettings: type: object properties: enabled: { type: boolean } provider_name: { type: string, description: Name on the SSO login button (defaults to SSO) } issuer_url: { type: string } client_id: { type: string } redirect_url: { type: string } scopes: { type: array, items: { type: string } } auto_provision: { type: boolean, description: Create an account (in the signup-target organization with default_role) on first SSO login } default_role: { type: string, enum: [admin, member, viewer] } required: { type: boolean, description: "Require SSO, enforced server-side while SSO is enabled: password sign-in (POST /auth/login and the /auth/mfa steps that finish it), POST /auth/register and POST /auth/invitations/accept answer 403 `sso_required` for everyone except instance admins, who keep password sign-in as the break-glass path (audited as auth.sso_break_glass). GET /auth/config reports oidc_required and the login page shows only SSO. Sessions that already exist are not ended" } SSOSettingsState: type: object properties: source: { type: string, enum: [database, environment, none] } settings: { $ref: '#/components/schemas/SSOSettings' } client_secret_set: { type: boolean } env_configured: { type: boolean, description: SSO is also configured through environment variables } AdminUser: type: object properties: id: { type: string, format: uuid } email: { type: string } name: { type: string } first_name: { type: string } last_name: { type: string } organization_id: { type: string, format: uuid, nullable: true, description: "Active organization; null when the account has no membership left (its last one was removed). Such accounts are still listed so an admin can add them to an organization again" } organization_name: { type: string, description: Empty when organization_id is null } role: { type: string, enum: [owner, admin, member, viewer], description: Role in the active organization } totp_enabled: { type: boolean } is_instance_admin: { type: boolean } memberships: type: array items: type: object properties: organization_id: { type: string, format: uuid } organization_name: { type: string } organization_slug: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } suspended_at: { type: string, format: date-time } avatar_updated_at: { type: string, format: date-time } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } last_login_at: { type: string, format: date-time } AdminUserMembership: type: object properties: organization_id: { type: string, format: uuid } organization_name: { type: string } organization_slug: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } is_active_org: { type: boolean } created_at: { type: string, format: date-time, description: When the membership was created } org_suspended_at: { type: string, format: date-time, description: Present when the organization is suspended } AdminOrganization: type: object properties: id: { type: string, format: uuid } name: { type: string } slug: { type: string } plan: { type: string } is_default: { type: boolean, description: The organization self-service signups join } member_count: { type: integer } max_users: { type: integer, format: int64, description: Member cap override; omitted when none (the license limit applies) } token_budget_monthly: { type: integer, format: int64, description: 0 = unlimited } token_budget_session: { type: integer, format: int64, description: 0 = unlimited } cost_limit_monthly: { type: number, description: 0 = unlimited } suspended_at: { type: string, format: date-time } created_at: { type: string, format: date-time } features: type: object description: The organization's feature switches, set with PATCH /admin/organizations/{id}. Every flag PATCH accepts is listed. A flag is true only when its stored value is JSON true, the way the feature itself reads it. properties: agent_comms: { type: boolean } agents.a2a: { type: boolean } app_mail.suppress: { type: boolean } org_agents: { type: boolean } org_agents_scope: type: object description: What the organization's Team Playbook learns from (migration 227), and when it was set last. Never who set it. properties: scope: { type: string, enum: [opt_in, all], description: 'opt_in: projects shared with the organization, and in private projects the sessions whose writers all opted in (each person for their own words); all: every session in it, except those holding an external sender''s words' } set_at: { type: string, format: date-time, nullable: true, description: Null when never set } pending_sweep_agents: type: integer nullable: true minimum: 0 description: 'How many enabled playbooks the privacy sweep would disable now, the count the Team Playbook page shows. Above 0 after a sweep that failed: with the Team Playbook off the page shows only that it is off. POST /admin/organizations/{id}/org-agents/sweep finishes it, changing nothing else; a PATCH that leaves the scope at opt_in finishes it too. The counts of the whole list share one 2 s budget; null when the count fails or the budget doesn''t reach the organization, never 0 then' AdminOrgLimits: type: object properties: max_users: { type: integer, format: int64, minimum: 0, nullable: true, description: 'Member cap (members plus pending invitations); 0 freezes the organization (no member can be added), null removes the cap (the license member cap still applies), negative is refused (400)' } token_budget_monthly: { type: integer, format: int64, minimum: 0, nullable: true, description: 'Tokens per rolling 30 days; 0 = unlimited, null resets it to the default (20,000,000,000), negative is refused (400)' } token_budget_session: { type: integer, format: int64, minimum: 0, nullable: true, description: 'Tokens per session; 0 = unlimited, null resets it to the default (2,000,000,000), negative is refused (400)' } cost_limit_monthly: { type: number, minimum: 0, nullable: true, description: 'USD per rolling 30 days; 0 = unlimited, null resets it to the default (1,000,000), negative is refused (400)' } max_sandboxes: { type: integer, format: int64, minimum: 0, nullable: true, description: 'Max concurrent sessions (queued, starting or working), each in its own sandbox; 0 or null removes the cap, negative is refused (400). When the deployment also has a cap, the lower one applies, and a session start beyond it gets 429 concurrent sandbox limit reached' } AdminOrgMember: type: object properties: id: { type: string, format: uuid, description: User ID } email: { type: string } name: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } is_active_org: { type: boolean, description: This is the user's active organization } created_at: { type: string, format: date-time, description: When the membership was created } suspended_at: { type: string, format: date-time, description: Present when the account is suspended } SMTPSettings: type: object properties: host: { type: string } port: { type: string } username: { type: string } from: { type: string } from_name: { type: string } password_set: { type: boolean } source: { type: string, enum: [db, env, none], description: db = saved settings; env = environment configuration } SMTPSendAttempt: type: object properties: id: { type: string, format: uuid } to: { type: string } subject: { type: string } template: { type: string } success: { type: boolean } error: { type: string } source: { type: string, description: Sending service (orchestrator for mail sent by this API) } duration_ms: { type: integer } created_at: { type: string, format: date-time } SMTPDiagnostics: type: object properties: effective: { $ref: '#/components/schemas/SMTPSettings' } tcp: type: object properties: ok: { type: boolean } latency_ms: { type: integer, format: int64 } error: { type: string } dns: type: object properties: domain: { type: string, description: Domain of the from address } checks: type: array items: type: object properties: name: { type: string, enum: [from_domain, mx, spf, dmarc] } status: { type: string, enum: [pass, warn, fail] } detail: { type: string } spf_relay_match: { description: "true/false when determinable, else the string \"unknown\"" } recent: type: array items: { $ref: '#/components/schemas/SMTPSendAttempt' } UsageSeries: type: object properties: days: { type: integer } group_by: { type: string, enum: [model, user, project], description: Present only when grouping was requested } series: type: array items: type: object properties: date: { type: string, description: YYYY-MM-DD } key: { type: string, description: Grouped responses only } label: { type: string, description: Grouped responses only } tokens: { type: integer, format: int64, description: Input plus output tokens } cost_usd: { type: number } call_count: { type: integer, format: int64 } ActiveSandbox: type: object properties: id: { type: string } project_id: { type: string } session_id: { type: string } name: { type: string, description: Pod name } sandbox_type: { type: string } status: { type: string, enum: [running, pending, starting, creating] } created_at: { type: string, format: date-time } ttl_seconds: { type: integer } organization_id: { type: string } organization_name: { type: string } SessionOutcome: type: object properties: session_id: { type: string, format: uuid } outcome: { type: string, enum: [shipped, abandoned, dev, unknown] } evidence_type: { type: string } evidence_ref: { type: string } GradedRun: type: object properties: id: { type: string, format: uuid } run_source: { type: string } workflow_run_id: { type: string } build_name: { type: string } session_id: { type: string } harness_git_sha: { type: string } images_tag: { type: string } primary_provider: { type: string } primary_model: { type: string } final_status: { type: string } invariants_pass: { type: integer } invariants_fail: { type: integer } invariants_skip: { type: integer } score: { type: number } dimensions: { type: object, additionalProperties: true } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time } created_at: { type: string, format: date-time } BehaviorReview: type: object properties: id: { type: string, format: uuid } session_id: { type: string, format: uuid } build_name: { type: string } run_source: { type: string } session_type: { type: string } score: { type: number } dimensions: { type: object, additionalProperties: true } graded_by: { type: string } created_at: { type: string, format: date-time } AuditLogEntry: type: object properties: id: { type: string } actor_user_id: { type: string } actor_name: { type: string } actor_email: { type: string } action: { type: string } target_type: { type: string } target_id: { type: string } before: { type: object, nullable: true, additionalProperties: true } after: { type: object, nullable: true, additionalProperties: true } ip: { type: string } organization_id: { type: string } organization_name: { type: string } created_at: { type: string, format: date-time } KnowledgeOrgReportEntry: type: object properties: entry_id: { type: string, format: uuid } entry_name: { type: string } scope: { type: string } folder: { type: string } entry_organization_id: { type: string, format: uuid } project_id: { type: string, format: uuid } project_name: { type: string } project_organization_id: { type: string, format: uuid } created_by_email: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } IntegrationHubAccount: type: object description: One connected external account. Provider tokens are never serialized. properties: id: { type: string, format: uuid } user_id: { type: string, format: uuid } organization_id: { type: string, format: uuid } integration_id: { type: string } provider: { type: string, description: 'OAuth app family, for example google' } external_account_id: { type: string } external_label: { type: string, description: Email address or handle } display_name: { type: string } scopes: { type: array, items: { type: string } } status: { type: string, enum: [connected, needs_reauth, error] } status_reason: { type: string } metadata: { type: object, additionalProperties: true } auto_approve: { type: boolean, description: Lets actions that require approval run without the owner-approval hold } access_level: type: string enum: ['off', read, full, custom] description: | What the owner allows the account to do, checked on every invoke before the granted scopes: `read` the search, list, read and download actions, `full` every action, `custom` the actions in `allowed_actions`, `off` none. Accounts start at `full` unless the connect chose a level. allowed_actions: { type: array, items: { type: string }, description: 'custom only: the allowed action names; omitted when empty and for the other levels' } connected_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } last_refresh_at: { type: string, format: date-time } last_used_at: { type: string, format: date-time } linked: { type: boolean, description: 'Only with ?project_id= on GET /integrations' } enabled_in_project: { type: boolean, description: 'Only with ?project_id= on GET /integrations' } IntegrationHubEntry: type: object description: One registered integration with the caller's connection state. properties: id: { type: string, description: 'Integration id, for example gmail' } provider: { type: string } name: { type: string } description: { type: string } icon: { type: string } auth_type: { type: string, enum: [oauth2] } version: { type: string } scopes: type: array items: type: object properties: scope: { type: string } description: { type: string } default: { type: boolean, description: Requested on first connect } webhook_support: { type: boolean } polling_support: { type: boolean } enabled: { type: boolean, description: 'The active organization has configured this provider''s OAuth app' } capabilities: { type: array, items: { type: string, enum: [search, list, read, create, update, delete, upload, download, execute, watch] } } actions: type: array items: type: object properties: name: { type: string } capability: { type: string } description: { type: string } required_scopes: { type: array, items: { type: string } } params: type: array items: type: object properties: name: { type: string } type: { type: string, enum: [string, number, boolean, object, array] } required: { type: boolean } description: { type: string } requires_approval: { type: boolean } accounts: type: array items: { $ref: '#/components/schemas/IntegrationHubAccount' } IntegrationHubError: type: object description: Error envelope of the integrations hub. properties: error: { type: string } code: type: string enum: [authentication_error, permission_denied, rate_limited, provider_unavailable, validation_error, network_error, timeout, conflict, not_found, not_connected, not_supported, integration_disabled, approval_required, unknown] recovery: { type: string, description: Suggested next step } connect_url: { type: string, description: 'Consent URL that resolves the failure, when one applies' } IntegrationHubActivity: type: object properties: id: { type: string, format: uuid } user_id: { type: string, format: uuid } organization_id: { type: string } account_id: { type: string } integration_id: { type: string } action: { type: string } status: { type: string, enum: [ok, error] } error_code: { type: string } error_message: { type: string } duration_ms: { type: integer, format: int64 } request_id: { type: string } created_at: { type: string, format: date-time } UnifiedConnectorCatalogEntry: type: object description: One card of the unified connector catalog. Never field values or secrets. properties: slug: { type: string } kind: { type: string, enum: [family, service], description: 'family: an organization connector family; service: a product card grouping the credential types and MCP rows of one provider' } name: { type: string, description: 'Brand name for a family, the operator''s display override, or an MCP-only card''s display name' } label_key: { type: string, description: i18n key the UI translates when name is empty } provider: { type: string } logo: { type: string } category: { type: string } categories: { type: array, items: { type: string } } keywords: { type: array, items: { type: string } } capabilities: type: object properties: user_account: { type: boolean, description: A personal account can be connected } project_credential: { type: boolean, description: A project workflow credential can be created } org_app: { type: boolean, description: Configured as an organization connector app } auth_kinds: { type: array, items: { type: string }, description: 'The auth methods of the card''s methods (for example oauth2, api_key, mcp_oauth), sorted' } enabled: { type: boolean, description: 'Operator catalog flag; families are always enabled, and a product card is enabled while any of its methods is' } chat_capable: { type: boolean } org_app_configured: { type: boolean, description: "Families only: the org connector has its minimum fields, or the family's OAuth app resolves (the organization's own or the Crios app), so members can sign in" } user_accounts: { type: integer, description: 'The caller''s own connected hub accounts in the active organization, across the family''s integrations' } project_satisfied: { type: boolean, description: 'Only with ?project_id=' } hub_integration_ids: { type: array, items: { type: string } } workflow_service_types: { type: array, items: { type: string } } tabs: type: array items: { type: string, enum: [apps, api, mcp] } description: | The directory tabs that list the card, in this order: `apps` for a sign-in (a hub account, an OAuth2 type the deployment holds a client for, an MCP OAuth row), `api` for a method that takes a pasted key, token or own OAuth client, `mcp` for any MCP row. rank: { type: integer, description: 'Featured order, 1 first; 0 is unranked (the alphabetical tail). An operator override wins' } copy: { $ref: '#/components/schemas/ConnectorCatalogCopy' } methods: type: array items: { $ref: '#/components/schemas/ConnectorCatalogMethod' } description: Every way of connecting the card; hub sign-ins first products: type: array items: { $ref: '#/components/schemas/ConnectorCatalogProduct' } description: 'Families with hub integrations only: one entry per product' usage: type: object description: 'The directory''s usage signal: counts only, never names' properties: connections: { type: integer, description: 'The caller''s connected accounts of the card''s integrations plus the unexpired workflow credentials of its types across the deployment' } activity_30d: { type: integer, description: 'Families only: the organization''s hub invocations of the card''s integrations in the last 30 days' } access_tiers: type: object properties: read_available: { type: boolean, description: 'A Read level exists: a product with read-shaped actions, or a method that takes a pasted key (read is GET and HEAD). MCP servers learn theirs when probed' } ConnectorCatalogCopy: type: object description: 'The platform''s directory copy for a provider; an operator may override it with PUT /workflows/connectors/catalog/{service}. Empty fields are omitted' properties: description: { type: string, description: The sentence under the name } requirements: { type: string, description: What the provider requires; the sheet shows it as a banner } example_prompts: { type: array, items: { type: string }, description: Up to four prompts a click turns into a session } website_url: { type: string } privacy_url: { type: string } beta: { type: boolean } ConnectorCatalogMethod: type: object description: One way of connecting a catalog card. properties: service: { type: string, description: 'The workflow catalog key (credential type or MCP row); omitted for a hub sign-in' } hub_integration_id: { type: string, description: 'A hub sign-in''s integration id (telegram for Telegram''s per-user bot link)' } auth_method: { type: string, description: 'oauth2, api_key, token, basic, hmac, jwt_bearer, secret, mcp_oauth, mcp_token or mcp_open; delegated for Telegram''s per-user bot link' } gesture: { type: string, enum: [signin, paste, endpoint], description: 'What the person brings: signin nothing (Crios is the registered app), paste a token, key or their own OAuth client, endpoint an open MCP endpoint' } individual: { type: boolean, description: A connection made this way acts as the person who connected it } application_client: { type: boolean, description: 'A browser-flow OAuth2 type the deployment holds a client for, so it connects in one click; omitted when false' } token_fallback: { type: boolean, description: 'An MCP OAuth vendor that also accepts a pasted key; omitted when false' } enabled: { type: boolean } label_key: { type: string } display_name: { type: string, description: Operator display override } permissions: { $ref: '#/components/schemas/ConnectorPermissions' } ConnectorCatalogProduct: type: object description: 'One product of a family card (Google: Gmail, Calendar, Drive)' properties: integration_id: { type: string } name: { type: string } logo: { type: string } read_available: { type: boolean, description: 'The integration has read-shaped actions (search, list, read, download), so a Read level exists' } user_accounts: { type: integer, description: The caller's connected accounts of this product } permissions: { $ref: '#/components/schemas/ConnectorPermissions' } ConnectorPermissions: type: object description: | A connector's documented permission model, shown before anyone connects: a hub integration's actions with the scopes each needs, grouped `read` and `write` (`shape: actions`), or the tools an MCP server's vendor documents, in the vendor's groups (`shape: tools`). properties: shape: { type: string, enum: [actions, tools] } groups: type: array items: type: object properties: id: { type: string } label: { type: string } items: type: array items: type: object properties: id: { type: string, description: Action or tool name } label: { type: string } description: { type: string } read: { type: boolean } group: { type: string } scopes: { type: array, items: { type: string }, description: 'Actions only: the scopes the action needs' } approval: { type: boolean, description: 'Actions only: every call waits for the owner''s approval' } scopes: type: array description: 'Actions only: the provider''s scopes in the vendor''s words' items: type: object properties: scope: { type: string } label: { type: string } description: { type: string } default: { type: boolean } read: { type: boolean } sensitivity: { type: string, description: 'The vendor''s tier where it has one (Google: basic, sensitive, restricted)' } dynamic: { type: boolean, description: 'The person picks the tools in the vendor''s own UI, so the items are what a probe finds' } unverified: { type: boolean, description: 'The vendor''s published list could not be read in full; the live list is what the server exposes' } total: { type: integer, description: The documented item count; items stops at 150 } truncated: { type: boolean } source_granularity: { type: string, description: 'One line on where the restriction is enforced: at the source, or by Crios' } doc_url: { type: string } MCPUserConnection: type: object description: | One of the caller's own MCP connections: to a connector-catalog service (`catalog_service` set) or to their own custom server (`auth_method` mcp_custom, `custom` true). Secrets and tokens are never returned. Until its first probe a new catalog connection lists the tools the catalog documents for its vendor, when the catalog has a verified list. properties: id: { type: string, format: uuid } name: { type: string } transport: { type: string, enum: [http] } endpoint: { type: string } enabled: { type: boolean } has_auth: { type: boolean } auth_header_name: { type: string } allowed_tools: { type: array, items: { type: string }, description: 'The tools the proxy admits, derived from access_level ("*" is every tool)' } discovered_tools: type: array items: { $ref: '#/components/schemas/MCPServerTool' } last_probe_at: { type: string, format: date-time } last_probe_status: { type: string } individual: { type: boolean, description: Always true for connections } catalog_service: { type: string, description: Omitted for a custom server } auth_method: { type: string, enum: [mcp_oauth, mcp_token, mcp_open, mcp_custom] } status: { type: string, enum: [connected, pending, error, needs_reauth] } access_level: { type: string, enum: ['off', read, full, custom] } read_tools: { type: array, items: { type: string }, description: Discovered tools the server marks read-only } custom: { type: boolean, description: True for a custom server } headers: type: array items: { $ref: '#/components/schemas/MCPHeader' } instructions: { type: string, description: Omitted when empty } icon: { type: string, description: 'Data URL; omitted when empty' } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } LLMGatewayModelConfig: type: object properties: provider: { type: string } model_id: { type: string } display_name: { type: string } max_context_tokens: { type: integer } request_timeout_seconds: { type: integer } supports_vision: { type: boolean } supports_tools: { type: boolean } api_base: { type: string } openrouter_provider: { type: string } openrouter_provider_allow_fallbacks: { type: boolean } LLMGatewayRouting: type: object properties: session_type: { type: string } primary: { $ref: '#/components/schemas/LLMGatewayModelConfig' } fallback: allOf: [{ $ref: '#/components/schemas/LLMGatewayModelConfig' }] nullable: true configured: { type: boolean, description: An operator saved this row; false for compiled-in defaults } inherited_from: { type: string, description: Coarse session type whose routing this row mirrors } LLMGatewayChatRequest: type: object required: [provider, model, request] properties: provider: { type: string, description: 'Must not be "gateway"' } model: { type: string } session_type: { type: string, description: 'Overrides the session''s stored type for routing' } request: type: object required: [messages] properties: messages: type: array items: type: object properties: role: { type: string } content: { type: string } images: type: array items: type: object properties: url: { type: string } base64: { type: string } mime_type: { type: string } detail: { type: string } tool_calls: { type: array, items: { type: object, additionalProperties: true } } tool_call_id: { type: string } session_type: { type: string } temperature: { type: number } max_tokens: { type: integer } response_format: { type: string, description: 'json_object for JSON mode' } response_schema: { type: object, additionalProperties: true, description: JSON Schema the response should follow } stream: { type: boolean } enable_thinking: { type: boolean } override_routing: { type: boolean, description: Keep the given provider and model instead of re-resolving from the session type } tools: type: array items: type: object properties: name: { type: string } description: { type: string } parameters: { type: object, additionalProperties: true } tool_choice: { type: string, description: 'auto, none, required, or name:' } parallel_tool_calls: { type: boolean } LLMGatewayChatResponse: type: object properties: id: { type: string } content: { type: string } reasoning: { type: string } usage: type: object properties: input_tokens: { type: integer } output_tokens: { type: integer } cached_input_tokens: { type: integer } cache_creation_input_tokens: { type: integer } resolved_provider: { type: string, description: Provider that actually answered } resolved_model: { type: string, description: Model that actually answered } finish_reason: { type: string } tool_calls: type: array items: type: object properties: id: { type: string } name: { type: string } arguments: { type: object, additionalProperties: true } GitProxyBranchRequest: type: object required: [branch_name] properties: branch_name: { type: string } base_branch: { type: string, default: main } GitProxyPullList: type: object properties: owner: { type: string } repo: { type: string } state: { type: string } pulls: type: array items: type: object properties: number: { type: integer } title: { type: string } state: { type: string } url: { type: string } head: { type: string } base: { type: string } count: { type: integer } GitProxyPullCreated: type: object properties: status: { type: string, enum: [created] } owner: { type: string } repo: { type: string } pr_number: { type: integer } pr_url: { type: string } title: { type: string } GitProxyPullUpdated: type: object properties: status: { type: string, enum: [updated] } owner: { type: string } repo: { type: string } pr_number: { type: integer } title: { type: string } state: { type: string } paths: # ==================== AUTH (root /auth subrouter) ==================== # NOTE: served on the ROOT router at /auth/*, NOT under /api/v1. /auth/login: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Authenticate and receive tokens (or MFA challenge) description: | Verifies email and password. The email is matched case-insensitively (trimmed and lowercased). An account with TOTP enabled gets `mfa_required`; an account whose organization requires MFA but has not enrolled gets `mfa_setup_required`. Both carry a 5-minute `mfa_token` for the `/auth/mfa/*` endpoints and no session tokens. While SSO is enabled with **Require SSO**, a correct password answers 403 `sso_required` for everyone except an instance admin (the break-glass path, recorded in the audit log as `auth.sso_break_glass`). A wrong password still answers 401, so the check does not reveal which accounts are instance admins. Five failed attempts (bad password here, or a bad code at `/auth/mfa/verify`) lock the account for 15 minutes: 429 with a `Retry-After` header, even for the correct password. The lock needs Redis; without it only the per-IP limiter applies. The `/auth` subrouter allows 10 requests per minute per client IP. security: [] requestBody: required: true content: application/json: schema: type: object required: [email, password] properties: email: { type: string, format: email } password: { type: string, format: password } responses: '200': description: Session tokens, or an MFA stepping-stone content: application/json: schema: { $ref: '#/components/schemas/LoginResponse' } '400': { $ref: '#/components/responses/BadRequest' } '401': { description: Invalid credentials } '403': { description: 'Account suspended, no active organization membership, or SSO is required and the account is not an instance admin (code sso_required)', content: { application/json: { schema: { $ref: '#/components/schemas/AuthCodedError' } } } } '429': { description: 'Account temporarily locked (Retry-After header), or the per-IP rate limit was exceeded' } /auth/logout: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Log out (revoke the session's tokens) description: | Public; no bearer token is required. Revokes both tokens the client presents: the refresh token in the `X-Refresh-Token` header and the access token in `Authorization: Bearer`, so neither works after sign-out. With `?all=true` and a still-valid access token, every token issued to that user is revoked as well, sandbox tokens of running sessions included (sign out of all sessions); personal API tokens are not affected. Revocation needs Redis; without it nothing is revoked. Answers 200 with or without the headers. security: [] parameters: - { name: X-Refresh-Token, in: header, schema: { type: string }, description: Refresh token to revoke } - { name: all, in: query, schema: { type: boolean }, description: 'true revokes every token issued to the user named by the access token' } responses: '200': description: Logged out content: application/json: schema: type: object properties: message: { type: string, enum: [logged out] } '429': { description: Per-IP rate limit exceeded } /auth/refresh: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Exchange a refresh token for a new access token description: | Rotates the pair: the refresh token sent is revoked and a new access and refresh token are returned. The account, its suspension state, and its membership in the token's organization are re-checked, so role or name changes land in the new pair. The refresh stays in the organization the token was minted for, not the user's current active organization. Sandbox tokens keep their short sandbox lifetime. Registered on the root router ahead of the `/auth` subrouter, so it uses its own per-IP limiter (5 requests/s, burst 60) instead of the strict auth limiter. The same handler and limiter also serve `POST /api/v1/auth/refresh` (back-compat, public, no bearer token). security: [] requestBody: required: true content: application/json: schema: type: object required: [refresh_token] properties: refresh_token: { type: string } responses: '200': description: New tokens content: application/json: schema: { $ref: '#/components/schemas/TokenPair' } '400': { $ref: '#/components/responses/BadRequest' } '401': { description: 'Invalid, expired or revoked refresh token, deleted account, or no membership in the token''s organization' } '403': { description: Account or organization suspended } '429': { description: Per-IP rate limit exceeded } /auth/register: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Self-service account registration (may be disabled) description: | Creates an account and signs it in. Refused with 403 when `CRIOS_ALLOW_SIGNUPS` (`orchestrator.config.allowSignups`) is false, which closes registration for the whole deployment whatever any organization's setting says, or when the signup organization (the default organization, else the oldest) has signups disabled. The first organization's setting starts at `CRIOS_ALLOW_SIGNUPS`. The first account on a fresh install creates the organization and becomes its owner and the instance admin. Later accounts join the existing organization as members and take a seat (403 `org_member_limit` when the organization is full). On the Free edition every self-service signup gets its own organization and owns it. When email is configured a verification link is sent and the account stays unverified; otherwise it is verified immediately. security: [] requestBody: required: true content: application/json: schema: type: object required: [email, password, name] properties: email: { type: string, format: email } password: { type: string, format: password, description: Must pass the password-strength rules } name: { type: string } responses: '200': description: Registered and signed in content: application/json: schema: { $ref: '#/components/schemas/LoginResponse' } '400': { description: 'Missing field, invalid email format, or weak password' } '403': { description: 'Signups disabled, SSO is required (code sso_required: accounts come from the identity provider or an admin), or organization member limit reached (code org_member_limit)' } '409': { description: Email already exists } '429': { description: Per-IP rate limit exceeded } /auth/mfa/verify: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Complete MFA login (second factor) description: | Second step of a login that answered `mfa_required`. Accepts a current TOTP code or, failing that, an unused backup code. A wrong code counts toward the same account lockout as a wrong password. security: [] requestBody: required: true content: application/json: schema: type: object required: [mfa_token, code] properties: mfa_token: { type: string, description: Stepping-stone token from POST /auth/login } code: { type: string, description: TOTP code or backup code } responses: '200': description: Session tokens content: application/json: schema: { $ref: '#/components/schemas/LoginResponse' } '400': { description: mfa_token and code are required } '401': { description: 'Invalid or expired mfa_token, or invalid code' } '403': { description: 'No active organization membership, or SSO became required after the password step and the account is not an instance admin (code sso_required)' } '429': { description: 'Account temporarily locked (Retry-After header), or the per-IP rate limit was exceeded' } /auth/mfa/setup: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Begin MFA enrollment during login description: | For a login that answered `mfa_setup_required`: generates a pending TOTP secret. Confirm it with POST /auth/mfa/enable. security: [] requestBody: required: true content: application/json: schema: type: object required: [mfa_token] properties: mfa_token: { type: string, description: Stepping-stone token from POST /auth/login } responses: '200': description: Pending TOTP secret content: application/json: schema: type: object properties: secret: { type: string, description: Base32 TOTP secret } provisioning_uri: { type: string, description: 'otpauth:// URI for authenticator apps' } '400': { $ref: '#/components/responses/BadRequest' } '401': { description: Invalid or expired mfa_token } '409': { description: Two-factor authentication is already enabled } '429': { description: Per-IP rate limit exceeded } /auth/mfa/enable: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Confirm MFA enrollment during login description: | Validates the first code against the pending secret from /auth/mfa/setup, enables TOTP, and completes the login in the same response: session tokens plus the one-time `backup_codes` (shown only here). security: [] requestBody: required: true content: application/json: schema: type: object required: [mfa_token, code] properties: mfa_token: { type: string } code: { type: string, description: Current TOTP code } responses: '200': description: Enrolled; session tokens and backup codes content: application/json: schema: { $ref: '#/components/schemas/LoginResponse' } '400': { description: mfa_token and code are required } '401': { description: 'Invalid or expired mfa_token, or invalid code' } '403': { description: 'No active organization membership, or SSO became required after the password step and the account is not an instance admin (code sso_required)' } '409': { description: 'Already enabled, or no pending setup (call /auth/mfa/setup first)' } '429': { description: Per-IP rate limit exceeded } /auth/config: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Auth] summary: Login-page bootstrap (which affordances to render) description: | Unauthenticated. Tells the login page whether to show the SSO button, the password form and the signup link. Sent with `Cache-Control: public, max-age=60`. Registered ahead of the `/auth` subrouter, so it has the general per-IP rate limit, not the strict 10-per-minute auth limit. security: [] responses: '200': description: Auth configuration content: application/json: schema: type: object properties: oidc_enabled: { type: boolean } provider_name: { type: string, description: 'SSO button label ("SSO" when unset); empty when OIDC is off' } oidc_required: { type: boolean, description: "Require SSO is on: the page shows only SSO, with a break-glass password form for instance admins" } signups_enabled: { type: boolean, description: "Whether POST /auth/register would accept a request: CRIOS_ALLOW_SIGNUPS, the signup organization's allow_signups, and SSO not required" } crisp_website_id: { type: string, description: Present only when CRIOS_CRISP_WEBSITE_ID is set } public_api_base_url: { type: string, description: 'Public origin of the orchestrator''s own routes, where workflow webhook and form triggers answer at /hooks/ (the app host does not serve them); the workflow editor builds trigger URLs from it. From CRIOS_PUBLIC_API_BASE_URL; present only when that is an absolute http(s) URL' } /auth/oidc/login: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Auth] summary: Begin OIDC SSO login (redirect to IdP) description: | Sets the HttpOnly `crios_oidc_state` and `crios_oidc_nonce` cookies (10 minutes, SameSite=Lax) and redirects to the identity provider's authorization endpoint. Over https, including TLS ended at a proxy that sends `X-Forwarded-Proto: https`, the cookies are named `__Host-crios_oidc_state` and `__Host-crios_oidc_nonce` (Secure, Path=/, no Domain), which no other host can set. When provider discovery fails it redirects to `/login?error=sso_unavailable` instead. security: [] responses: '302': { description: 'Redirect to the identity provider, or to /login?error=sso_unavailable' } '501': { description: OIDC is not configured } /auth/oidc/callback: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Auth] summary: OIDC SSO callback description: | The identity provider's redirect target. Checks `state` against the state cookie, exchanges the code, verifies the ID token and its nonce against the nonce cookie (over https it reads only the `__Host-` names), and requires a verified `email` claim (unless `OIDC_ALLOW_UNVERIFIED_EMAIL=true`). An existing account is matched by email and linked; an unknown email is provisioned only when auto-provisioning is on. SSO logins skip local TOTP. On success it redirects to `/login#access_token=…&refresh_token=…` (a URL fragment, so tokens never reach server logs). On failure it redirects to `/login?error=`, where code is one of `sso_failed`, `invalid_callback`, `state_mismatch`, `nonce_mismatch`, `sso_unavailable`, `no_email_claim`, `email_unverified`, `account_not_provisioned`, `org_ambiguous`, `org_member_limit` or `account_suspended`. security: [] parameters: - { name: code, in: query, schema: { type: string } } - { name: state, in: query, schema: { type: string } } - { name: error, in: query, schema: { type: string }, description: Set by the IdP when it refused the request } responses: '302': { description: 'Redirect to /login with tokens in the fragment, or with ?error=' } '501': { description: OIDC is not configured } # ==================== SESSIONS ==================== /sessions: get: tags: [Sessions] summary: List sessions description: | Sessions visible to the caller in their active organization, newest first, one page at a time (`limit`, default 100, at most 500; `offset`); `has_more` says whether older sessions follow. Org owners and admins see every session on the organization's live projects; other members see their own sessions plus sessions on projects they can at least view. Deleted sessions and sessions of deleted projects are excluded. There are no filters; list one project's sessions with GET /projects/{id}/sessions. List items omit the agent-profile fields. parameters: - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 500, default: 100 } } - { name: offset, in: query, schema: { type: integer, minimum: 0, default: 0 } } responses: '200': description: Sessions content: application/json: schema: type: object properties: sessions: type: array items: { $ref: '#/components/schemas/Session' } has_more: { type: boolean, description: More sessions follow this page } limit: { type: integer } offset: { type: integer } post: tags: [Sessions] summary: Create a session description: | Plans a new session from a natural-language request and creates it. The call is synchronous: it returns once the planner has decided, and the session row is saved even if the client disconnects first. `project_id` is required in practice: a missing, unknown or invisible project answers 404, and the caller needs editor access to it. A sandbox token can't create a session: a new session's prompt is a person's message, so it answers 403 `{"code": "sandbox_token_refused"}`. An `external_source` of `session_create`, `wipe_database`, `persist_database` or `telegram` answers 400 `{"code": "external_source_reserved"}`: the Team Playbook reads those sources as the session's own person. Without `natural_language`, the planner input is built from `title`, `description` and `session_type`. The planner's decision picks the response shape (all 200): - chat: `chat_response: true` with the answer in `message`; the session is saved as an idle conversation. - clarify: the Session (status `waiting_input`) plus `requires_clarification: true`, `message`, `questions` and the updated `conversation`. Answer with POST /sessions/{id}/steer. - plan only (`session_type: planning`): the Session plus `plan_only: true`. The plan document is written in the background; POST /sessions/{id}/build starts the implementation. - build: the Session (status `pending`), plus `auto_decomposed`, `subsession_count` and `subsessions` when the planner split the work (only when the request asks for parallel agents). The session starts automatically. Multipart: send the JSON body as the `request` part (or only a `natural_language` field) and the files as repeated `files` parts, 51 MiB in total. The files are stored as session attachments; images are described by a vision model and PDF/Office documents are text-extracted before planning. A file-only request defaults the prompt to "what's here?". Rate limited to 20 creates per minute: per user for a personal access token, an OAuth token or a connected app, per client IP otherwise. Capped by the per-organization active-session limit (instance admins are exempt from the cap). requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SessionCreateRequest' } multipart/form-data: schema: type: object properties: request: { type: string, description: SessionCreateRequest as a JSON string } natural_language: { type: string, description: Used only when no request part is sent } files: type: array items: { type: string, format: binary } responses: '200': description: The planner's outcome (see the description) content: application/json: schema: oneOf: - { $ref: '#/components/schemas/SessionCreateResult' } - { $ref: '#/components/schemas/SessionCreateChatResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not visible to the caller (also returned when project_id is missing) } '413': { description: Multipart body exceeds 51 MiB } '429': description: | Rate limit exceeded (`{"error": "rate limit exceeded", "retry_after": 1}`), or the organization is at its active-session cap (`{"error": "too many active sessions", "details", "active", "limit"}`). '502': description: Planning did not complete. The body carries `error`, `id` and `session_id` of the saved session row. /sessions/{id}: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get a session description: | Returns the session, including a soft-deleted one (with `deleted_at`). A planning session that has been built also carries `build_session_id`, the newest live implementation session built from it. responses: '200': { description: Session, content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '404': { $ref: '#/components/responses/NotFound' } patch: tags: [Sessions] summary: Update a session's title, description or priority description: | Only `title`, `description` and `priority` may be set; any other key answers 400 with the allowed list. Values carry the create-time limits (title at most 500 characters, description at most 4,000,000, priority a whole number from 0 to 10); a wrong type or an out-of-range value is a 400. Everything else about a session is lifecycle-managed. Requires editor access to the session. requestBody: required: true content: application/json: schema: type: object minProperties: 1 additionalProperties: false properties: title: { type: string, maxLength: 500 } description: { type: string, maxLength: 4000000 } priority: { type: integer, minimum: 0, maximum: 10 } responses: '200': { description: Updated session, content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Sessions] summary: Delete a session and its subsessions description: | Soft-deletes the session and every subsession under it. Active ones (pending, queued, planning, working, running, waiting_input, paused) are marked cancelled first, and their sandboxes are deleted. The workspace volume is kept for the retention grace period so an accidental delete stays recoverable, unless `delete_workspace=true`. Requires editor access to the session. parameters: - { name: delete_workspace, in: query, schema: { type: boolean, default: false }, description: Also delete the workspace volumes now instead of after the retention grace period } responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/start: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Start, wake or resume a session description: | Provisions (or reuses) the session's sandbox. A pending session starts its agent. On an idle, paused, waiting_input, completed, failed or cancelled session a plain call is a read-only wake: the sandbox, workspace and preview come back but the agent stays dormant until a chat message arrives. `intent: work` (JSON body or `?intent=work`) resumes the run of a paused, failed or cancelled session; idle and completed sessions stay dormant even then (send a message instead). A session that rested because infrastructure interrupted it resumes either way, up to the auto-recovery limit. Planning sessions never run in a sandbox: 202 while the plan is still being written, otherwise 409 (use POST /sessions/{id}/build). An Android-sandbox session whose organization has not accepted the Android SDK license is parked at waiting_input instead of started. Requires editor access to the session. parameters: - { name: intent, in: query, schema: { type: string, enum: [work] }, description: Same as the body field } requestBody: required: false content: application/json: schema: type: object properties: intent: { type: string, enum: [work] } responses: '200': { description: Session after the start or wake, content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '202': { description: 'Another caller is already starting the session, or a planning session is still writing its plan', content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: | A planning session outside plan generation, or auto-recovery was paused after repeated failures (`{"error", "blocker"}`; send a new message to steer past the blocker). '410': { description: The session is deleted } '502': { description: Could not mint the sandbox's access tokens } /sessions/{id}/cancel: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Cancel a session description: | Marks a pending, queued, planning, working, running, waiting_input or paused session cancelled, signals the agent to stop, and deletes the sandboxes of the session and its subsessions. On any other status the stop signal and sandbox cleanup still run but the status is kept. Requires editor access to the session. responses: '200': { description: Session after the cancel, content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/pause: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Pause a running session description: | Moves a running, working, planning or waiting_input session to paused, signals the agent to pause and releases the session's sandbox. The workspace volume is kept, so resuming provisions a new sandbox onto the same workspace. Any other status is left unchanged, sandbox included (still 200). Resume with POST /sessions/{id}/start (`intent: work`) or by sending a message. Requires editor access to the session. responses: '200': { description: Session after the pause, content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/resume: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Resume a session (alias of start) description: Identical to POST /sessions/{id}/start, including the `intent` parameter and every response. parameters: - { name: intent, in: query, schema: { type: string, enum: [work] } } requestBody: required: false content: application/json: schema: type: object properties: intent: { type: string, enum: [work] } responses: '200': { description: Session after the start or wake, content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '202': { description: 'Already starting, or a planning session still writing its plan', content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'Planning session outside plan generation, or auto-recovery paused' } '410': { description: The session is deleted } '502': { description: Could not mint the sandbox's access tokens } /sessions/{id}/retry: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Retry a session as a new session description: | Creates a NEW session that copies the original's project, owner, title, description, type, priority, model, sandbox type, plan-approval mode, agent-profile pin and skill pins, and starts it automatically. The original is not modified. Subject to the organization's active-session cap. Requires editor access to the session. responses: '200': { description: The new session, content: { application/json: { schema: { $ref: '#/components/schemas/Session' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '429': { description: The organization is at its active-session cap } /sessions/{id}/steer: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Send a chat message to a session description: | Posts a user message into the session. On a resting session (idle, paused, waiting_input, completed, failed, cancelled) the agent is resumed to act on it. A message to a planning session revises the plan, and an answer to a planner clarification continues planning; both return the updated Session instead of the send receipt. `attachment_ids` reference files uploaded with POST /sessions/{id}/attachments; a short brief of them is appended to the message. An identical message sent within 30 seconds is dropped and answered with `status: duplicate_suppressed`. Requires editor access to the session. A sandbox token is refused (403 `{"code": "sandbox_token_refused"}`): a chat message is a person's. The message and its steer record their author (`metadata.user_id`). requestBody: required: true content: application/json: schema: type: object properties: message: { type: string } instruction: { type: string, description: Alias used when message is empty } attachment_ids: { type: array, items: { type: string, format: uuid } } responses: '200': description: | `{"status": "steering_message_sent", "event_id"}` with the id of the persisted user_message event, `{"status": "duplicate_suppressed", "message"}`, or the Session when the message continued planning. content: application/json: schema: oneOf: - type: object properties: status: { type: string, enum: [steering_message_sent, duplicate_suppressed] } event_id: { type: string, format: uuid } message: { type: string } - { $ref: '#/components/schemas/Session' } '400': { description: 'Invalid body, or no message (and no attachments)' } '403': { description: 'Not an editor of the session, or a sandbox token (`{"code": "sandbox_token_refused"}`)' } '404': { $ref: '#/components/responses/NotFound' } '409': description: | Planning or plan generation is still in progress; send the message once it finishes. Or: the message was recorded but the resting session could not be resumed because its recovery was abandoned: `{"code": "recovery_abandoned", "error", "status": 409}`. '429': description: | The message was recorded but the resting session could not be resumed at a session or sandbox cap: the cap's own body, `{"error", "code": "org_session_limit" | "org_sandbox_limit" | "instance_at_capacity", "details", "active", "limit"}`. A refused resume after a plan approval arrives instead as the session event `plan_approval_resume_failed` with the same fields plus `status`. /sessions/{id}/progress: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get session progress description: | The progress dashboard of a session: workflow state, plan steps (merged with the agent's durable run state), goal counts, active agents, blocker counts, goal checkpoints and the latest validation evidence. Several fields are aliases kept for older clients (`active_step` = `current_step`, `total_goals` = `total_steps`, `completed_goals` = `completed_count`, `active_goal_title` = `active_goal`). responses: '200': description: Progress content: application/json: schema: { $ref: '#/components/schemas/SessionProgress' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/state: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get the session's workflow state description: The derived workflow state of the session (the same object progress returns as `workflow`). responses: '200': description: Workflow state content: application/json: schema: { $ref: '#/components/schemas/SessionWorkflowState' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/run-state: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get durable run state description: | Sandbox-facing: the agent's durable run state, as last saved with PUT. Beyond session access, the caller must be the session owner or a member of the session project's organization (else 403). responses: '200': description: Run state content: application/json: schema: type: object properties: state: { type: object, additionalProperties: true, description: The saved state object } status: { type: string } current_goal: { type: string } '403': { description: Not the session owner or a member of its organization } '404': { description: 'Session not visible, or no run state saved yet' } put: tags: [Sessions] summary: Save durable run state description: | Sandbox-facing: the agent saves its durable run state (replacing the previous one) so a new sandbox can resume. The body is either the state object itself or an envelope `{state, status, current_goal}`; `status` and `current_goal` fall back to the state's own fields. A `session_id` inside the state must match the path. Body limit 8 MiB. Same access rule as the GET, plus editor access to the session. requestBody: required: true content: application/json: schema: type: object additionalProperties: true properties: state: { type: object, additionalProperties: true, description: Omit to send the state object as the whole body } status: { type: string } current_goal: { type: string } responses: '200': description: Saved content: application/json: schema: type: object properties: ok: { type: boolean } '400': { description: 'Not a JSON object, an empty state, or a state session_id that does not match the path' } '403': { description: 'Viewer, view-only access, or not the session owner or a member of its organization' } '404': { $ref: '#/components/responses/NotFound' } '413': { description: The body exceeds 8 MiB } /sessions/{id}/previously-completed: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Check whether a prior run concluded description: | Sandbox-facing: true when the session has a session summary from an earlier run that did not end in an infrastructure interruption. The agent uses it to treat a follow-up message as a modification of finished work. Same access rule as GET run-state. responses: '200': description: Result content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } previously_completed: { type: boolean } '403': { description: Not the session owner or a member of its organization } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/latest-user-message: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get the latest user message description: | Sandbox-facing: the text of the newest user message (unwrapped from its `{"message": …}` envelope) and how many user messages the session has, so the agent can classify a follow-up. Same access rule as GET run-state. responses: '200': description: Latest user message content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } message: { type: string, description: Empty when there is none } present: { type: boolean } count: { type: integer, description: Number of user messages in the session } '403': { description: Not the session owner or a member of its organization } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/context-snapshot: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Save a resume context snapshot description: | Sandbox-facing: an agent without direct database access saves its conversation context here so a resumed sandbox can rehydrate it. The JSON body may be gzip-compressed (`Content-Encoding: gzip`; 16 MiB compressed, 128 MiB inflated). A snapshot with `trigger` `interval` (the default) replaces the session's earlier `interval` snapshots, as a direct write does. Same access rule as GET run-state, plus editor access to the session. requestBody: required: true content: application/json: schema: type: object required: [messages] properties: step: { type: integer } trigger: { type: string, default: interval } token_estimate: { type: integer } compacted: { type: boolean } messages: { description: The conversation as JSON; stored verbatim } responses: '204': { description: Stored } '400': { description: 'Unreadable body, invalid JSON, or messages missing or not valid JSON' } '403': { description: 'Viewer, view-only access, or not the session owner or a member of its organization' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/context-snapshot/latest: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get the latest context snapshot description: Sandbox-facing. The newest saved snapshot, for rehydration on resume. Same access rule as GET run-state. responses: '200': description: The snapshot, or `present false` when none is stored content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } present: { type: boolean } token_estimate: { type: integer, description: Present with a snapshot } messages: { description: 'The stored conversation JSON, exactly as uploaded; present with a snapshot' } '403': { description: Not the session owner or a member of its organization } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/failure-kb/query: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Query the failure-to-fix knowledge base description: | Sandbox-facing: the agent posts a live failure signature and gets the fix rules most similar to it — the rules its organization approved and the deployment's shared seeded rules, never another organization's. At least one of `snippet` and `correlation_key` is required. For callers below org admin the `session_id` and `suggestion_id` of each match are blanked, and for every rule that is not the organization's own they are blanked for everyone. Read-shaped: viewers may call it. Answers 503 when the knowledge base is not configured. requestBody: required: true content: application/json: schema: type: object properties: snippet: { type: string, description: Live error text } correlation_key: { type: string } disposition: { type: string } limit: { type: integer, default: 5, maximum: 20, description: 'Values above 20 are capped' } responses: '200': description: Matching rules content: application/json: schema: type: object properties: correlation_key: { type: string } results: type: array items: { $ref: '#/components/schemas/SessionFailureKBMatch' } '400': { description: 'Invalid body, or neither snippet nor correlation_key given' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: The failure knowledge base is not configured } /sessions/{id}/project-facts: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Harvest project facts at session end description: | Sandbox-facing: stores the facts the session derived (stack, dev port, package manager, …) for later sessions of the same project and session type; the key comes from the session row, never from the body. An empty `facts` list stores nothing. Requires editor access. Answers 503 when the project-facts store is not configured. requestBody: required: true content: application/json: schema: type: object properties: schema_version: { type: integer, enum: [0, 1], description: 0 or omitted is accepted; any other version than 1 is rejected } facts: type: array items: { $ref: '#/components/schemas/SessionProjectFact' } responses: '200': description: Stored content: application/json: schema: type: object properties: stored: { type: integer } project_id: { type: string, format: uuid } session_type: { type: string } '400': { description: Invalid body or unsupported schema version } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Session not visible, or it has no project' } '503': { description: The project-facts store is not configured } /sessions/{id}/project-facts/query: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Look up project facts description: | Sandbox-facing: the facts stored for the session's project and session type, for the agent's start-of-session context. A session without a project, or without facts, gets an empty list. The body is optional. Read-shaped: viewers may call it. Answers 503 when the store is not configured. requestBody: required: false content: application/json: schema: type: object properties: query: { type: string } limit: { type: integer } responses: '200': description: Facts content: application/json: schema: type: object properties: facts: type: array items: { $ref: '#/components/schemas/SessionProjectFact' } count: { type: integer } age_days: { type: number, description: Age of the stored facts } project_id: { type: string, format: uuid, description: Absent when the session has no project } session_type: { type: string, description: Absent when the session has no project } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: The project-facts store is not configured } /sessions/{id}/mcp-servers/config: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get the session's MCP server config description: | Sandbox-facing: the MCP servers the agent may advertise as `mcp____`, resolved from the session row. That is the organization's servers enabled for the project, the session owner's own MCP connections (catalog services and custom servers), and the platform server (plus the project's active workflows as `wf_` tools) when the deployment configures one. Each server has the MCPServer shape; the platform server carries only the basic fields and `platform: true`. Secrets are never returned; the sandbox reaches HTTP servers only through the MCP proxy. A session without a project gets an empty list. responses: '200': description: MCP servers content: application/json: schema: type: object properties: servers: type: array items: type: object additionalProperties: true properties: id: { type: string } name: { type: string } transport: { type: string } enabled: { type: boolean } has_auth: { type: boolean } allowed_tools: { type: array, items: { type: string } } discovered_tools: { type: array, items: { type: object, additionalProperties: true } } endpoint: { type: string } individual: { type: boolean, description: The session owner's own connection } access_level: { type: string, description: 'A connection''s access level, from which allowed_tools is derived' } instructions: { type: string, description: 'A custom server''s guidance for agents; omitted when empty' } platform: { type: boolean, description: 'Only on the platform server (id crios-platform)' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/budget-status: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get live session budget usage description: | Sandbox-facing: the budget enforcer's live usage for the session, as percentages (0–100 of each limit; an unconfigured limit reads 0). A session without a project gets `{"max_percent": 0}`. Same access rule as GET run-state. Answers 503 when budget enforcement is off. responses: '200': description: Budget status content: application/json: schema: type: object properties: session_percent: { type: number } org_token_percent: { type: number } cost_percent: { type: number } max_percent: { type: number, description: The largest of the three } session_tokens: { type: integer, format: int64 } session_budget: { type: integer, format: int64 } '403': { description: Not the session owner or a member of its organization } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Budget enforcement is not enabled } /sessions/{id}/plan-approval: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get plan-approval gate state description: | The plan-approval gate state derived from the session's persisted events. Read by a relaunched sandbox (to skip straight past an already approved plan) and by the UI (to rebuild the approval banner). Verdicts are given over the WebSocket or integrations, not here. Same access rule as GET run-state. responses: '200': description: Gate state content: application/json: schema: type: object properties: state: { type: string, enum: [none, pending, approved, changes_requested, parked] } note: { type: string, description: 'The reviewer''s comment, when there is one' } '403': { description: Not the session owner or a member of its organization } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/share: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Mint a read-only spectator link description: | Mints a token for the public, read-only spectator view (`/spectate/`). Only the session owner, or an owner or admin of the session's organization, may mint one; for a session in a project the owner counts only while still a member of the project's organization. The raw token is returned only here. `ttl_seconds` defaults to 24 hours and is capped at 7 days. The body is optional. Removing the minter from the organization revokes their links. requestBody: required: false content: application/json: schema: type: object properties: ttl_seconds: { type: integer, default: 86400, maximum: 604800 } responses: '200': description: Share token content: application/json: schema: type: object properties: token: { type: string } expires_at: { type: string, format: date-time } url: { type: string, description: 'Spectator URL; present when the server knows its public base URL' } '403': { description: 'Viewer, or not the session owner or an admin of its organization' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/share/revoke: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Sessions] summary: Revoke all spectator links description: | Revokes every active share token of the session, whoever minted it. Idempotent. Like minting, only the session owner (while still a member of the session's organization), or an owner or admin of the session's organization, may revoke; other editors get 403. responses: '200': description: Revoked content: application/json: schema: type: object properties: revoked: { type: integer, description: Number of tokens revoked by this call } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/active-agents: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: List active agents for the session responses: '200': description: Active agents content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } active_agents: { type: integer } active_goals: { type: array, items: { type: string } } agents: type: array items: { $ref: '#/components/schemas/SessionActiveAgent' } workflow_state: { type: string } updated_at: { type: string, format: date-time } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/blockers: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get current blockers responses: '200': description: Blockers content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } blocked_count: { type: integer } replanning_count: { type: integer } recovering_count: { type: integer } blockers: type: array items: { $ref: '#/components/schemas/SessionBlocker' } updated_at: { type: string, format: date-time } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/merge-queue: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get merge queue state responses: '200': description: Merge queue content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } queued: { type: integer } merging: { type: integer } merged: { type: integer } failed: { type: integer } items: type: array items: { $ref: '#/components/schemas/SessionMergeQueueItem' } updated_at: { type: string, format: date-time } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/checkpoints: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: List session goal checkpoints description: The agent's per-goal checkpoints (done / not done, branch, merge and validation state). Unrelated to sandbox checkpoints. responses: '200': description: Checkpoints content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } status: { type: string } checkpoints: type: array items: { $ref: '#/components/schemas/SessionProgressCheckpoint' } checkpointed: { type: integer } updated_at: { type: string, format: date-time } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/messages: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get chat-visible session messages description: | The newest `limit` chat-visible events (user and agent messages, clarifications, plan and review events, errors, git and deliverable events), returned oldest first. There is no paging; for history use GET /sessions/{id}/events in cursor mode. A session with no such events yet returns its opening prompt and planning turns synthesized from the stored conversation. parameters: - { name: limit, in: query, schema: { type: integer, default: 500, minimum: 50, maximum: 2000 }, description: Clamped to 50–2000 } - { name: max_content_bytes, in: query, schema: { type: integer, default: 20000, minimum: 1024, maximum: 100000 }, description: Bodies above this size are replaced by a truncation wrapper } - { name: max_string_bytes, in: query, schema: { type: integer, default: 8000, minimum: 512, maximum: 50000 }, description: Longer strings inside JSON bodies are shortened } responses: '200': description: Messages content: application/json: schema: type: object properties: messages: type: array items: { $ref: '#/components/schemas/SessionEvent' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/events: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get session events (offset or cursor pages) description: | Pages through the session's persisted event stream. Events in a page are always returned oldest first. Offset mode (default): `offset` counts back from the newest event, and `before` / `after` bound `created_at`. The response carries `total` and `has_more`. Cursor mode (`page=cursor`, or any `before_cursor` / `after_cursor`): keyset pages over (created_at, id) without a count. The first read and `before_cursor` reads walk back from the newest event (`has_older`); `after_cursor` reads walk forward from a cursor (`has_newer`), which is how a client catches up the live tail. Every row carries its `cursor`; pass `older_cursor` as `before_cursor` to load older history, and `newer_cursor` as `after_cursor` to load newer rows. When the server disables cursor mode (CRIOS_SESSION_EVENTS_CURSOR_MODE=false) the cursor parameters are ignored and offset mode is used. `event_types` narrows either mode. The page that reaches the start of the stream (untyped, non-`after` reads only) also carries the opening prompt and planning turns synthesized from the stored conversation when they were never persisted as events; those rows have no cursor. parameters: - { name: page, in: query, schema: { type: string, enum: [offset, cursor] }, description: Selects cursor mode when set to cursor } - { name: limit, in: query, schema: { type: integer, default: 500, minimum: 1, maximum: 1000 }, description: Clamped to 1–1000 } - { name: offset, in: query, schema: { type: integer, default: 0, minimum: 0, maximum: 1000000 }, description: Offset mode only } - { name: before, in: query, schema: { type: string, format: date-time }, description: 'Offset mode only; RFC 3339, unparsable values are ignored' } - { name: after, in: query, schema: { type: string, format: date-time }, description: 'Offset mode only; RFC 3339, unparsable values are ignored' } - { name: before_cursor, in: query, schema: { type: string }, description: 'Opaque cursor (v1.<µs>.); mutually exclusive with after_cursor' } - { name: after_cursor, in: query, schema: { type: string }, description: Opaque cursor; mutually exclusive with before_cursor } - { name: event_types, in: query, schema: { type: string }, description: 'Comma-separated allow-list, each ^[a-z0-9_]{1,50}$, at most 50' } - { name: max_content_bytes, in: query, schema: { type: integer, default: 20000, minimum: 1024, maximum: 100000 }, description: Bodies above this size are replaced by a truncation wrapper } - { name: max_string_bytes, in: query, schema: { type: integer, default: 8000, minimum: 512, maximum: 50000 }, description: Longer strings inside JSON bodies are shortened } responses: '200': description: One page of events content: application/json: schema: oneOf: - { $ref: '#/components/schemas/SessionEventOffsetPage' } - { $ref: '#/components/schemas/SessionEventCursorPage' } '400': { description: 'Invalid cursor, invalid event_types, or both before_cursor and after_cursor' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/transcript: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get the per-LLM-call transcript description: | The session's LLM calls in chronological order: what was requested and which provider/model served it, tokens, cost, latency and status. Prompt and completion bodies are included only with `include_bodies=true`. `totals` aggregates the whole session, not just the page. parameters: - { name: limit, in: query, schema: { type: integer, default: 100, minimum: 1, maximum: 500 }, description: Values above 500 are clamped } - { name: offset, in: query, schema: { type: integer, default: 0, minimum: 0 } } - { name: include_bodies, in: query, schema: { type: boolean, default: false } } responses: '200': description: Transcript page content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } calls: type: array items: { $ref: '#/components/schemas/SessionTranscriptCall' } count: { type: integer } offset: { type: integer } totals: type: object nullable: true properties: calls: { type: integer, format: int64 } input_tokens: { type: integer, format: int64 } output_tokens: { type: integer, format: int64 } cached_input_tokens: { type: integer, format: int64 } cost_usd: { type: number } errors: { type: integer, format: int64, description: Calls whose status is not success } '400': { description: limit or offset is not a valid integer } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/intent: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: Get the curated failure feed description: | The session's failures grouped by correlation key: `blockers` (hard failures), `recovered` (transient failures the agent recovered from) and `active` (transient failures still open on a live session). responses: '200': description: Intent feed content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } terminal: { type: boolean, description: The session is in a terminal status } blockers: { type: array, items: { $ref: '#/components/schemas/SessionIntentItem' } } recovered: { type: array, items: { $ref: '#/components/schemas/SessionIntentItem' } } active: { type: array, items: { $ref: '#/components/schemas/SessionIntentItem' } } counts: type: object properties: blockers: { type: integer } recovered: { type: integer } active: { type: integer } total_failures: { type: integer } '404': { $ref: '#/components/responses/NotFound' } # ==================== ATTACHMENTS (session-scoped) ==================== /sessions/{id}/attachments: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Attachments] summary: List attachments for a session description: | Attachment metadata in upload order. Besides session access, the caller must be the session owner or a member of the session project's organization, and the session must not be deleted (404 otherwise). responses: '200': description: Attachments content: application/json: schema: type: object properties: attachments: type: array items: { $ref: '#/components/schemas/SessionAttachment' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Attachments] summary: Upload attachments description: | Uploads one or more files (repeat the `files` part), 50 MiB per file and 51 MiB per request. Accepted: images, PDF, Office/OpenDocument documents and RTF, fonts, source code, config and plain-text formats, archives (.zip, .tar, .tar.gz, …) and files without an extension. Each file is delivered to the session's sandbox under /workspace/.crios/attachments/, or queued until a sandbox exists. Images get an asynchronous vision description. Reference the returned ids in `attachment_ids` of POST /sessions/{id}/steer. Same access rule as the list, plus editor access to the session. requestBody: required: true content: multipart/form-data: schema: type: object required: [files] properties: files: type: array items: { type: string, format: binary } responses: '201': description: Uploaded content: application/json: schema: type: object properties: attachments: type: array items: { $ref: '#/components/schemas/SessionAttachment' } '400': { description: 'No files part, or an invalid multipart body' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '413': { description: A file exceeds 50 MiB or the request exceeds 51 MiB } '415': { description: A file has an unsupported type } '503': { description: The running sandbox did not accept the file; nothing was stored for it } /sessions/{id}/attachments/{att_id}/data: parameters: - { $ref: '#/components/parameters/SessionId' } - { name: att_id, in: path, required: true, schema: { type: string, format: uuid } } get: tags: [Attachments] summary: Fetch an attachment's bytes description: | Streams the stored bytes with the attachment's content type. Images are always stored; other files only up to 5 MiB, so larger ones answer 404. `format=pdf` returns the PDF rendering the sandbox produced for an office document instead. Same access rule as the list. parameters: - { name: format, in: query, schema: { type: string, enum: [pdf] }, description: Return the converted PDF } responses: '200': description: File bytes content: application/octet-stream: schema: { type: string, format: binary } application/pdf: schema: { type: string, format: binary } '404': { description: 'Session or attachment not found, bytes not stored inline, or no converted PDF' } /sessions/{id}/attachments/{att_id}/converted: parameters: - { $ref: '#/components/parameters/SessionId' } - { name: att_id, in: path, required: true, schema: { type: string, format: uuid } } post: tags: [Attachments] summary: Store converted attachment content description: | Sandbox-facing: after converting an uploaded document (for example with LibreOffice), the agent posts the PDF rendering and/or the extracted text with its sandbox token. At least one part is required. The text is stored truncated to the inline limit. Same access rule as the list, plus editor access to the session. requestBody: required: true content: multipart/form-data: schema: type: object properties: pdf: { type: string, format: binary, description: PDF rendering (max 25 MiB) } text: { type: string, description: Extracted plain text (a file part or a form field) } responses: '204': { description: Stored } '400': { description: Invalid multipart body or unreadable pdf part } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Session or attachment not found } '413': { description: The PDF exceeds 25 MiB or the request exceeds 51 MiB } '415': { description: Neither a pdf nor a text part was sent } put: tags: [Attachments] summary: Store converted attachment content (PUT) description: Identical to the POST form of this endpoint. requestBody: required: true content: multipart/form-data: schema: type: object properties: pdf: { type: string, format: binary, description: PDF rendering (max 25 MiB) } text: { type: string, description: Extracted plain text (a file part or a form field) } responses: '204': { description: Stored } '400': { description: Invalid multipart body or unreadable pdf part } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Session or attachment not found } '413': { description: The PDF exceeds 25 MiB or the request exceeds 51 MiB } '415': { description: Neither a pdf nor a text part was sent } # ==================== MULTI-AGENT ==================== /sessions/{id}/decompose: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Multi-Agent] summary: Decompose a session into subsessions description: | Splits the session's description into worker subsessions with a text heuristic (no model call): one subsession for a short description, up to three parts (by paragraph, else sentence) for a longer one. The session becomes a coordinator; each worker is created pending on its own `feature/-partN` (or `-impl`) branch. No request body. A worker session cannot be decomposed. Requires editor access. responses: '200': description: Created subsessions content: application/json: schema: type: object properties: parent_session_id: { type: string, format: uuid } subsessions: type: array items: type: object properties: id: { type: string, format: uuid } title: { type: string } description: { type: string } role: { type: string, enum: [worker] } branch_name: { type: string } '400': { description: The session is a worker } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/subsessions: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Multi-Agent] summary: List subsessions description: The session's child sessions in creation order. responses: '200': description: Subsessions content: application/json: schema: type: object properties: parent_session_id: { type: string, format: uuid } subsessions: type: array items: type: object properties: id: { type: string, format: uuid } title: { type: string } description: { type: string } status: { type: string } session_type: { type: string } role: { type: string } branch_name: { type: string } result: { type: string, description: Omitted when unset } sandbox_id: { type: string, description: "The sandbox the subsession ran in. Omitted when it has none: a build's plan step rows never run." } '404': { $ref: '#/components/responses/NotFound' } '500': { description: The subsessions could not be read } /sessions/{id}/subsessions/{sid}/steer: parameters: - { $ref: '#/components/parameters/SessionId' } - { name: sid, in: path, required: true, schema: { type: string, format: uuid } } post: tags: [Multi-Agent] summary: Steer a subsession description: Sends a steering message to one worker subsession of this session. Requires editor access; a sandbox token is refused (403 `sandbox_token_refused`). requestBody: required: true content: application/json: schema: type: object required: [message] properties: message: { type: string } responses: '200': description: Sent content: application/json: schema: type: object properties: status: { type: string, enum: [steering_sent] } subsession_id: { type: string, format: uuid } '400': { description: Invalid body or empty message } '403': { description: 'Not an editor of the session, or a sandbox token (`{"code": "sandbox_token_refused"}`)' } '404': { description: 'Session not visible, or the subsession does not belong to it' } /sessions/{id}/steer-worker: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Multi-Agent] summary: Steer a worker or the session description: | With `subsession_id`, sends the message to that worker subsession of this session (404 if it is not one). Without it, publishes the message as a steer event on the session itself. Requires editor access; a sandbox token is refused (403 `sandbox_token_refused`). requestBody: required: true content: application/json: schema: type: object properties: message: { type: string } subsession_id: { type: string, format: uuid } responses: '200': description: Sent content: application/json: schema: type: object properties: status: { type: string, enum: [steering_sent] } subsession_id: { type: string, format: uuid, description: Present when a subsession was steered } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Session not visible, or the subsession does not belong to it' } /sessions/{id}/merge: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Multi-Agent] summary: Merge completed subsessions description: | Concatenates the results of all subsessions of a coordinator session into its `result` and marks it completed. Every subsession must be completed. No git merge is performed; `pr_branch` is the suggested branch name for one. No request body. Requires editor access. responses: '200': description: Merged content: application/json: schema: type: object properties: status: { type: string, enum: [merged] } parent_session_id: { type: string, format: uuid } subsessions_merged: { type: integer } branches: { type: array, nullable: true, items: { type: string } } pr_branch: { type: string } merged_result: { type: string } '400': { description: 'Not a coordinator session, no subsessions, or not all subsessions completed' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/workers: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Multi-Agent] summary: List workers description: The worker subsessions of a coordinator session, in creation order. responses: '200': description: Workers content: application/json: schema: type: object properties: coordinator_session_id: { type: string, format: uuid } workers: type: array items: { $ref: '#/components/schemas/MultiAgentWorker' } count: { type: integer } '400': { description: Not a coordinator session } '404': { $ref: '#/components/responses/NotFound' } '500': { description: The workers could not be read } /sessions/{id}/workers/{wid}: parameters: - { $ref: '#/components/parameters/SessionId' } - { name: wid, in: path, required: true, schema: { type: string, format: uuid } } get: tags: [Multi-Agent] summary: Get a worker responses: '200': description: Worker content: application/json: schema: allOf: - { $ref: '#/components/schemas/MultiAgentWorker' } - type: object properties: description: { type: string } created_at: { type: string, format: date-time } '404': { description: 'Session not visible, or the worker does not belong to it' } delete: tags: [Multi-Agent] summary: Cancel a worker description: Marks the worker subsession cancelled; the row is kept. Requires editor access. responses: '200': description: Cancelled content: application/json: schema: type: object properties: status: { type: string, enum: [cancelled] } worker_id: { type: string, format: uuid } message: { type: string } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Session not visible, or the worker does not belong to it' } # ==================== SESSION-SCOPED PREVIEW ==================== /sessions/{id}/preview/start: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Preview] summary: Start a host dev-server preview description: | Same as POST /preview/start for the path session: the preview runs for the session in the path, and a `session_id` in the body is ignored. `work_dir` is required. Requires editor access to the session. requestBody: required: true content: application/json: schema: type: object required: [work_dir] properties: session_id: { type: string, format: uuid, description: Ignored on this route } work_dir: { type: string } responses: '200': description: Started content: application/json: schema: type: object properties: status: { type: string, enum: [started] } session_id: { type: string, format: uuid } config: { $ref: '#/components/schemas/PreviewServerConfig' } '400': { description: 'Invalid body, or work_dir missing' } '403': { description: 'work_dir not allowed, a viewer, or view-only access to the session' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/preview/stop: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Preview] summary: Stop a session's host dev-server preview description: Stops the path session's preview; a `session_id` query parameter is ignored. Stopping one that is not running is a no-op. Requires editor access. responses: '200': description: Stopped content: application/json: schema: type: object properties: status: { type: string, enum: [stopped] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/preview/refresh: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [Preview] summary: Restart a session's host dev-server preview description: | Restarts the path session's preview. No body is needed; a `session_id` in the body or the query is ignored. Requires editor access. A session without a running preview answers 409. responses: '200': description: Restarted content: application/json: schema: type: object properties: status: { type: string, enum: [refreshed] } session_id: { type: string, format: uuid } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: No preview is running for the session } '500': { description: The restart failed } /sessions/{id}/preview/config: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Preview] summary: Get a session's host dev-server preview config description: The path session's running preview; a `session_id` query parameter is ignored. The keys are capitalized (Go field names). responses: '200': description: Preview configuration content: application/json: schema: { $ref: '#/components/schemas/PreviewServerConfig' } '404': { description: 'No access to the session, or no preview is running for it' } patch: tags: [Preview] summary: Update a session's host dev-server preview config description: | Same as PATCH /preview/config for the path session: a `session_id` in the body is ignored. A port change restarts a running dev server. Requires editor access. A session without a running preview answers 409. requestBody: required: true content: application/json: schema: type: object properties: session_id: { type: string, format: uuid, description: Ignored on this route } framework: { type: string } port: { type: integer } responses: '200': description: Updated content: application/json: schema: type: object properties: status: { type: string, enum: [updated] } session_id: { type: string, format: uuid } config: { $ref: '#/components/schemas/PreviewServerConfig' } '400': { description: Invalid body } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: No preview is running for the session } '500': { description: The update failed } # ==================== WEBRTC ==================== /sessions/{id}/webrtc/offer: parameters: [{ $ref: '#/components/parameters/SessionId' }] post: tags: [WebRTC] summary: Submit an SDP offer, receive the SFU answer description: | Starts the live browser stream of the session's sandbox: send the browser's SDP offer and get the SFU's answer once it has attached the session's video track. Allowed for viewers (read-shaped POST). Personal API tokens need full access; fine-grained tokens cannot open realtime channels. Errors are plain text. requestBody: required: true content: application/json: schema: type: object required: [type, sdp] properties: type: { type: string, enum: [offer] } sdp: { type: string } responses: '200': description: SDP answer content: application/json: schema: type: object properties: type: { type: string, enum: [answer] } sdp: { type: string } '400': { description: 'Invalid payload, or type is not offer, or sdp is empty' } '403': { description: A fine-grained API token } '404': { $ref: '#/components/responses/NotFound' } '500': { description: The SFU could not negotiate the session's stream } /webrtc/ice-servers: get: tags: [WebRTC] summary: Get ICE (STUN/TURN) server configuration description: | ICE servers for the browser leg of the live view. STUN comes from `CRIOS_STUN_URL`, or is derived from the first TURN URL. TURN entries (`CRIOS_TURN_URL`, comma-separated) carry short-lived credentials minted from `CRIOS_TURN_STATIC_AUTH_SECRET`, tagged with `session_id`. The list is empty when neither is configured. Cached privately for 60 s. parameters: - { name: session_id, in: query, schema: { type: string }, description: Tags the TURN username } responses: '200': description: ICE servers content: application/json: schema: type: object properties: iceServers: type: array items: type: object properties: urls: { type: array, items: { type: string } } username: { type: string } credential: { type: string } '401': { $ref: '#/components/responses/Unauthorized' } # ==================== PROJECTS ==================== /projects: get: tags: [Projects] summary: List projects description: | The projects the caller can access, newest first: every project of the organization for org owners and admins; otherwise projects visible to the whole organization plus those the caller owns or that are shared with them directly or through a group. Each row carries the caller's effective `access`. `pinned_ids` lists the projects the caller has pinned, in pin order. `pinned_limit` and `recent_sessions` (either one) add `pinned`: the caller's first pinned projects in pin order, each with its publication and newest top-level sessions, for the sidebar. Pins on deleted projects or projects the caller can no longer reach are skipped. Without either parameter the response is unchanged; if `pinned` cannot be read the list still answers without it. parameters: - { name: include_deleted, in: query, description: 'Also return soft-deleted projects (true, 1 or yes)', schema: { type: boolean, default: false } } - { name: pinned_limit, in: query, description: 'Add `pinned` with up to this many pinned projects (1–20, clamped; default 5 when only recent_sessions is given)', schema: { type: integer, minimum: 1, maximum: 20 } } - { name: recent_sessions, in: query, description: 'Newest top-level sessions per pinned project (0–10, clamped; default 3 when only pinned_limit is given)', schema: { type: integer, minimum: 0, maximum: 10 } } responses: '200': description: Projects content: application/json: schema: type: object properties: projects: type: array items: { $ref: '#/components/schemas/Project' } pinned_ids: type: array items: { type: string, format: uuid } pinned: type: array description: Only with pinned_limit or recent_sessions. items: type: object properties: project_id: { type: string, format: uuid } pinned_at: { type: string, format: date-time } publication: type: object nullable: true description: The stored publication row (no repository freshness check); null when the project has none. properties: status: { type: string } chart_ref: type: object properties: revision: { type: string } recent_sessions: type: array items: type: object properties: id: { type: string, format: uuid } title: { type: string } status: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } releases: type: array description: The session's outputs that are published to run. `app` is the project's app (see publication); `agent` and `workflow` are session_outputs references whose release facts the workflow API's list reads (`?ids=`). items: type: object properties: kind: { type: string, enum: [app, agent, workflow] } ref_id: { type: string, format: uuid } name: { type: string } post: tags: [Projects] summary: Create a project description: | The caller becomes the project owner. Without `repository_url` a built-in Git repository is created for the project (502 if that fails) and `repository_kind` becomes `gitea`. With a URL, a missing `repository_kind` is inferred from the host, and the repository is indexed into project memory in the background. `default_branch` defaults to `main`. Org-role viewers are refused (403). requestBody: required: true content: application/json: schema: type: object required: [name] properties: name: { type: string } description: { type: string } repository_url: { type: string, description: Omit to get a built-in repository } repository_kind: { type: string, enum: [github, gitlab, gitea] } default_branch: { type: string, default: main } responses: '201': description: Created project (the caller's access is `manage`) content: application/json: schema: { $ref: '#/components/schemas/Project' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '502': { description: The built-in Git repository could not be created } /projects/{id}: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Projects] summary: Get a project description: | Includes the caller's effective `access`. A soft-deleted project is still returned, with `deleted_at` set; this and POST /projects/{id}/restore are the only project routes that answer for a deleted project, every other one answers 404 until it is restored. Requires project viewer access. responses: '200': description: Project content: application/json: schema: { $ref: '#/components/schemas/Project' } '404': { $ref: '#/components/responses/NotFound' } patch: tags: [Projects] summary: Update a project description: | Partial update of the listed fields; other keys are ignored, and a body with none of them is a 400. `settings` is merged into the stored settings by top-level key: each key sent replaces that key, a key sent as `null` removes it, and keys not sent are kept (so a save cannot wipe what a background writer stored meanwhile). Send only the keys you edit. The keys sent are validated: `model_routing` entries must name known session types and models from the organization's allowed catalog (vision models where the session type needs them), and `theme` must be a registered theme. Changing `visibility` requires project manage access (project owner or org owner/admin); everything else requires project editor access. requestBody: required: true content: application/json: schema: type: object properties: name: { type: string } description: { type: string } repository_url: { type: string, description: A new URL triggers background re-indexing of project memory } repository_kind: { type: string } default_branch: { type: string } visibility: { type: string, enum: [organization, private] } settings: { type: object, additionalProperties: true } sandbox_cpu_limit: { type: integer, minimum: 1, maximum: 1024, nullable: true, description: "Whole CPUs per sandbox; null clears. Any other type or value is a 400" } sandbox_memory_limit: { type: string, nullable: true, description: "Positive Kubernetes quantity such as 8Gi; null clears. Anything else is a 400" } discussion_bot_enabled: { type: boolean, description: Whether the Discussion agent answers in the project channel } discussion_bot_knowledge: type: array nullable: true maxItems: 50 items: { type: string, format: uuid } description: Knowledge entry ids the Discussion agent works from (organization-wide or this project's). Ids that no longer exist or are not visible to this project are dropped silently rather than refused; deleting a knowledge entry also removes its id from every project. Send this field only when it changed. null or [] clears. discussion_bot_prompt: { type: string, maxLength: 4000, description: Extra instructions for the Discussion agent; empty clears } responses: '200': description: Updated project content: application/json: schema: { $ref: '#/components/schemas/Project' } '400': { description: "No recognized field, or an invalid value (visibility, settings, discussion agent fields)" } '403': { description: "Below project editor access, or a visibility change without manage access" } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Projects] summary: Soft-delete a project description: | Marks the project and its sessions deleted and cancels sessions that are still active. Refused with 409 while the project has a publication that is not unpublished: unpublish first. The project row and sessions stay restorable, but the following are removed and do not come back on restore: the built-in Git repository, the project's managed databases, its memory index, and its sandboxes and session workspaces. Requires project manage access (project owner or org owner/admin). responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: The project has a publication that is not unpublished } /projects/{id}/restore: parameters: [{ $ref: '#/components/parameters/ProjectId' }] post: tags: [Projects] summary: Restore a soft-deleted project description: | Clears `deleted_at`. If the project's built-in Git repository was removed with the project, a new one is created. Sessions stay deleted. Requires project manage access (project owner or org owner/admin). responses: '200': description: Restored content: application/json: schema: type: object properties: id: { type: string, format: uuid } name: { type: string } restored: { type: boolean } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not deleted } '502': { description: The built-in Git repository could not be re-created } /projects/{id}/sessions: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Projects] summary: List sessions for a project description: | All sessions of the project (any owner), newest first. Requires project viewer access. parameters: - { name: status, in: query, description: Filter by session status, schema: { type: string } } - { name: limit, in: query, description: Values above 500 are clamped to 500, schema: { type: integer, default: 100 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } - { name: include_deleted, in: query, description: Include deleted sessions (and sessions of a deleted project), schema: { type: boolean, default: false } } responses: '200': description: Sessions content: application/json: schema: type: object properties: sessions: type: array items: { $ref: '#/components/schemas/Session' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Projects] summary: Create a session under a project description: | Same as `POST /sessions`, with the project taken from the path; a `project_id` in the body must match it. The request waits for the planner and answers with its outcome: normally the created session; `requires_clarification: true` when the planner needs answers first (`message`, `questions`); `plan_only: true` for a planning session that completes with the plan as its result; `chat_response: true` when the request was answered directly (`message`). The body can also be `multipart/form-data` with a `request` part holding this JSON and `files` parts carrying attachments. Natural-language input (`natural_language`, or `title`/`description`), a `conversation`, or attached files are required. Counts against the organization's active-session cap and is rate-limited to 20 requests per minute per client IP. Requires project editor access; a sandbox token only for its own project. requestBody: required: true content: application/json: schema: type: object properties: project_id: { type: string, format: uuid, description: Optional; must equal the path id } title: { type: string, maxLength: 500 } description: { type: string } natural_language: { type: string, description: The request in plain language } conversation: type: array description: Earlier planning turns, for a follow-up message items: type: object properties: role: { type: string } content: { type: string } session_type: { type: string, enum: [coding, planning, review, testing, research, publishing] } priority: { type: integer, minimum: 0, maximum: 10 } model_provider: { type: string } model_name: { type: string } disable_subsessions: { type: boolean } plan_approval_mode: { type: string, enum: [required, auto], default: required } target_stack: { type: string, enum: [web, mobile, desktop], description: Platform for rebuilding a design from uploaded screenshots } agent_profile_id: { type: string, format: uuid, description: Pin an active agent profile that covers this project; empty lets Crios choose } skill_ids: { type: array, maxItems: 16, items: { type: string, format: uuid }, description: Enabled skills to pin in addition to the project's attached skills } draft_session_id: { type: string, format: uuid, description: Reuse one session row across repeated sends from the same composer } responses: '200': description: Planner outcome (see description) content: application/json: schema: allOf: - { $ref: '#/components/schemas/Session' } - type: object properties: session_id: { type: string, format: uuid, description: Present on chat responses } requires_clarification: { type: boolean } plan_only: { type: boolean } chat_response: { type: boolean } message: { type: string } questions: { type: array, items: { type: string } } conversation: type: array items: type: object properties: role: { type: string } content: { type: string } attachments_received: { type: integer } '400': { description: "Validation failed, project_id does not match the path, or an invalid agent profile, skill selection or conversation" } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '429': { description: "Session-creation rate limit exceeded, or the organization's active-session cap is reached: the deployment's (error `too many active sessions`) or the organization's own max_sandboxes (error `concurrent sandbox limit reached`); the body then carries error, details, active and limit" } '502': { description: Session planning did not complete } /projects/{id}/memory/query: parameters: [{ $ref: '#/components/parameters/ProjectId' }] post: tags: [Projects] summary: Query project memory (RAG) description: | Semantic search over the project's indexed memory. Viewers may call it: the POST carries a query and changes nothing. A sandbox token only for its own project. Requires project viewer access. The `knowledge` collection covers the project's own knowledge and the organization-wide knowledge of the project's organization, never another organization's. requestBody: required: true content: application/json: schema: type: object required: [query] properties: query: { type: string } collections: type: array items: { type: string, enum: [code_chunks, knowledge, session_context, conventions] } description: Defaults to all four limit: { type: integer, default: 10, description: Values above 25 are clamped to 25 } responses: '200': description: Matches, best first content: application/json: schema: type: object properties: query: { type: string } count: { type: integer } results: type: array items: type: object properties: score: { type: number } content: { type: string } doc_type: { type: string } file_path: { type: string, description: Omitted when empty } title: { type: string, description: Omitted when empty } language: { type: string, description: Omitted when empty } session_id: { type: string, description: Omitted when empty } '400': { description: "Missing query, invalid body, or unknown collection" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or deleted } '503': { description: Project memory is not enabled on this deployment } /projects/{id}/memory/reindex: parameters: [{ $ref: '#/components/parameters/ProjectId' }] post: tags: [Projects] summary: Reindex project memory description: | Re-indexes the project's repository in the background (large repositories take minutes). A request while indexing is running queues one follow-up pass. Requires project editor access. responses: '202': description: Reindex started content: application/json: schema: type: object properties: status: { type: string, enum: [reindex_started] } project_id: { type: string, format: uuid } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or deleted } '503': { description: Project memory is not enabled on this deployment } /projects/{id}/memory/status: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Projects] summary: Get project memory index status description: | Ingest accounting for the project plus vector-store point counts. Answers 200 with `enabled: false` when project memory is off. While the vector store is unreachable, `collections` is null and `collections_error` says so. Counts for shared collections are deployment-wide; the project's own knowledge collection is exact. Requires project viewer access. responses: '200': description: Status content: application/json: schema: type: object properties: project_id: { type: string, format: uuid } enabled: { type: boolean } last_ingest_at: { type: string, format: date-time, nullable: true } sessions_ingested: { type: integer } sessions_finalized: { type: integer } events_indexed: { type: integer, format: int64 } collections: type: array nullable: true items: type: object properties: name: { type: string } points: { type: integer } collections_error: { type: string, description: Present when the vector store is unavailable } '404': { description: Project not found or deleted } /projects/{id}/snapshots: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Projects] summary: List project snapshots description: Requires project viewer access. responses: '200': description: Snapshots content: application/json: schema: type: object properties: snapshots: type: array items: { $ref: '#/components/schemas/ProjectSnapshot' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Snapshot storage is not available on this deployment } post: tags: [Projects] summary: Create a project snapshot description: | Records a snapshot of the project, optionally tied to a session. `type` defaults to `project` and `ttl_seconds` to 86400. Requires project editor access. requestBody: required: true content: application/json: schema: type: object properties: name: { type: string } type: { type: string, enum: [project, checkpoint, custom], default: project } session_id: { type: string, format: uuid } ttl_seconds: { type: integer, default: 86400 } metadata: { type: object, additionalProperties: { type: string } } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/ProjectSnapshot' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Snapshot storage is not available on this deployment } /projects/{id}/snapshots/{sid}: parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: sid, in: path, required: true, schema: { type: string, format: uuid } } delete: tags: [Projects] summary: Delete a snapshot description: Requires project editor access. responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Snapshot storage is not available on this deployment } /projects/{id}/snapshots/{sid}/restore: parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: sid, in: path, required: true, schema: { type: string, format: uuid } } post: tags: [Projects] summary: Restore a snapshot description: | Pulls the snapshot back from the snapshot registry into local snapshot storage and answers `status: restoring`. Requires project editor access. responses: '200': description: Restore initiated content: application/json: schema: type: object properties: status: { type: string, enum: [restoring] } project_id: { type: string, format: uuid } snapshot_id: { type: string, format: uuid } message: { type: string } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Snapshot storage is not available on this deployment } # ==================== ORGANIZATIONS ==================== /organizations/{id}: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: Get an organization description: | Any org member. `{id}` must be the caller's active organization (403 otherwise); the handler always reads the active org. responses: '200': { description: Organization, content: { application/json: { schema: { $ref: '#/components/schemas/Organization' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /organizations/{id}/members: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: List members description: | Any org member. `{id}` must be the caller's active organization. Members of the organization with the role they hold there, newest membership first. `created_at` is the date the user joined this organization, not the account's creation date. responses: '200': description: Members content: application/json: schema: type: object properties: members: type: array items: { $ref: '#/components/schemas/OrgMember' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Organizations] summary: Create a member account description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Creates a NEW user account with the given password and makes it a member of the organization; an email that already has an account is refused with 409 (invite existing users instead, see `POST /organizations/{id}/invitations`). Only an owner may assign the `owner` role. Subject to the member limit: the org's `max_users` override, else the license's per-org member limit, counting members plus pending invitations (instance admins are exempt). requestBody: required: true content: application/json: schema: type: object required: [email, password] properties: email: { type: string, format: email, description: Lower-cased and trimmed } name: { type: string } password: { type: string, format: password } role: { type: string, enum: [owner, admin, member, viewer], default: member } responses: '200': description: Member created content: application/json: schema: type: object properties: id: { type: string, format: uuid } email: { type: string } name: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } '400': { $ref: '#/components/responses/BadRequest' } '403': description: Not an org admin, organization mismatch, a non-owner assigning `owner`, or the member limit is reached (`code` = `org_member_limit`) content: application/json: schema: { $ref: '#/components/schemas/OrgMemberLimitError' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: A user with this email already exists } /organizations/{id}/members/{memberID}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: memberID, in: path, required: true, schema: { type: string, format: uuid } } patch: tags: [Organizations] summary: Change a member's role description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Changes the role the user holds in this organization (their role in other organizations is untouched); it applies to the member's next request. Only an owner may grant the `owner` role or change an owner's role; anyone else gets 403 `{"error", "code": "owner_required"}`. The organization's last owner cannot be demoted (including self-demotion). requestBody: required: true content: application/json: schema: type: object required: [role] properties: role: { type: string, enum: [owner, admin, member, viewer] } responses: '200': { description: Updated (empty body) } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: 'Not an org admin, or `{"error", "code": "owner_required"}` for a non-owner granting or changing owner' } '404': { description: Member not found in this organization } '409': { description: Cannot demote the only owner of an organization } delete: tags: [Organizations] summary: Remove a member description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Removes the membership only; the account survives and keeps any other memberships (if this was the user's active organization it is re-pointed to another membership). The spectator links the member minted for this organization's sessions are revoked, and their tokens for this organization stop working (401 `org_membership_revoked`). Callers cannot remove themselves, only an owner may remove an owner (403 `{"error", "code": "owner_required"}`), and the last owner cannot be removed. Deleting accounts is an instance-admin action (`DELETE /admin/users/{id}`). responses: '204': { description: Removed } '400': { description: Cannot remove yourself } '403': { description: 'Not an org admin, or `{"error", "code": "owner_required"}` for a non-owner removing an owner' } '404': { description: Member not found in this organization } '409': { description: Cannot remove the only owner of an organization } /organizations/{id}/usage: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: Get the organization's usage totals description: | Any org member. `{id}` must be the caller's active organization. All-time totals from the durable usage ledger (daily rollups plus the calls not yet rolled up, the same source as `GET /costs/summary`) and the number of active sessions. A session counts toward its project's organization; only a session without a project counts toward its owner's current organization. The per-user/project/model console is `GET /organizations/{id}/usage/summary` (org admin only). responses: '200': description: Usage totals content: application/json: schema: type: object properties: total_cost_usd: { type: number } total_tokens: { type: integer, format: int64 } request_count: { type: integer, format: int64, description: Model calls } active_sessions: { type: integer, description: 'Sessions in an active status: pending, queued, starting, planning, working, recovering, or the legacy running' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The usage could not be read } # ==================== USERS ==================== /users/me: get: tags: [Users] summary: Get the current user description: | The caller's own profile, including every organization membership (suspended organizations are left out), the stored UI language and theme preferences, and the stored layout of each list (`view_prefs`). Reachable with any token kind, including fine-grained or project-bound personal API tokens (token introspection). responses: '200': description: The current user content: application/json: schema: { $ref: '#/components/schemas/CurrentUser' } '401': { $ref: '#/components/responses/Unauthorized' } '500': { description: Failed to load the user } patch: tags: [Users] summary: Update the current user description: | Updates only the fields present in the body; unknown keys are ignored, and a key whose value has the wrong JSON type is ignored too, except `view_prefs` (below). The whole body is validated before anything is saved, so a 400 means nothing was written. - `first_name` / `last_name`: when either is present, both are saved (a missing one keeps its current value) and `name` becomes "first last" when that is non-empty. `name` is then ignored. - `name`: used only when neither `first_name` nor `last_name` is present. - `language`: one of the ten supported UI languages, or `""` to clear the choice (the UI falls back to browser-language detection). - `theme`: `light`, `dark` or `system`, or `""` to clear it. `""` and `system` both mean "follow the operating system". - `view_prefs`: the layout of one or more lists, as an object keyed by list (`projects`, `workflows`, `agents`, `skills`, `knowledge`) whose values are `cards` or `rows`. It is merged into the stored map in one statement: lists left out keep their stored value, and `""` deletes a list's entry, so the UI goes back to picking the layout from the number of records. Values are trimmed. A wrong type is not ignored here: a `view_prefs` that is not an object (`null` included) is rejected with `view_prefs must be an object`, an unknown list with `unsupported view feature`, a value that is not a string with `view_prefs values must be strings`, and any other value with `unsupported view mode`. The whole object is checked before any of it is saved; an empty object changes nothing. Fields are written one after another, `view_prefs` last, not in one transaction: when a later field is rejected with 400 (for example an unsupported theme), the fields before it have already been saved. Every org role, viewers included, may update their own profile. Personal API tokens and sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object properties: first_name: { type: string, maxLength: 100 } last_name: { type: string, maxLength: 100 } name: { type: string, minLength: 1, maxLength: 255, description: Display name; trimmed } has_completed_onboarding: { type: boolean } language: type: string enum: ['', en, zh-CN, hi, de, fr, ja, es, pt-BR, tr, ko] theme: type: string enum: ['', light, dark, system] view_prefs: type: object description: 'The lists to change, keyed by list; `""` deletes a list''s stored layout' properties: projects: { type: string, enum: ['', cards, rows] } workflows: { type: string, enum: ['', cards, rows] } agents: { type: string, enum: ['', cards, rows] } skills: { type: string, enum: ['', cards, rows] } knowledge: { type: string, enum: ['', cards, rows] } additionalProperties: false responses: '200': description: Updated; the full current-user profile content: application/json: schema: { $ref: '#/components/schemas/CurrentUser' } '400': description: 'Invalid JSON, a name out of range, an unsupported language or theme, or an invalid `view_prefs` (not an object, an unknown list, a value that is not a string, or an unsupported mode)' content: application/json: schema: { $ref: '#/components/schemas/Error' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to update the user } /users/me/password: post: tags: [Users] summary: Change password description: | Verifies the current password, enforces the password-strength rules, stores the new hash and sends a best-effort "password changed" notice. The change then signs out every session of the account: all tokens issued to the user, including the sandbox tokens of running sessions, are revoked (this needs Redis), every personal API token the user holds is revoked in every organization (as by DELETE /users/me/api-tokens/{id}), and a fresh pair for the caller comes back as `access_token` and `refresh_token`, which the client swaps in. The pair is omitted when the revocation or the new tokens fail; the password change still stands and the user signs in again. Accounts provisioned through SSO have no password and get 400. Viewers may call it. Personal API tokens and sandbox tokens get 403. Shares the strict auth rate limiter (10 requests per minute per client IP). requestBody: required: true content: application/json: schema: type: object required: [current_password, new_password] properties: current_password: { type: string, format: password } new_password: { type: string, format: password } responses: '200': description: Password changed content: application/json: schema: type: object properties: status: { type: string, enum: [password changed] } access_token: { type: string, description: 'Fresh access token for this session; omitted when rotation failed' } refresh_token: { type: string, description: 'Fresh refresh token; omitted when rotation failed' } '400': { description: 'Invalid body, weak new password, or an SSO account without password login', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Current password is incorrect, or the caller is a personal API token or sandbox token', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': { description: 'Rate limit exceeded; the body also carries retry_after', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to change the password } /users/me/totp: get: tags: [Users] summary: Get TOTP status description: Two-factor state for the Settings security section. responses: '200': description: TOTP status content: application/json: schema: { $ref: '#/components/schemas/UserTOTPStatus' } '401': { $ref: '#/components/responses/Unauthorized' } '500': { description: Failed to load the MFA status } /users/me/totp/setup: post: tags: [Users] summary: Begin TOTP setup description: | Generates a pending TOTP secret (replacing any earlier unconfirmed one) and returns it with the `otpauth://` provisioning URI that the UI renders as a QR code. Confirm it with `POST /users/me/totp/enable`. Viewers may call it. Personal API tokens and sandbox tokens get 403. responses: '200': description: Pending secret and provisioning URI content: application/json: schema: type: object properties: secret: { type: string, description: Base32 TOTP secret } provisioning_uri: { type: string, description: 'otpauth:// URI (issuer "Crios")' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: Two-factor authentication is already enabled, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to start two-factor setup } /users/me/totp/enable: post: tags: [Users] summary: Enable TOTP description: | Confirms the pending setup with a current 6-digit code and turns TOTP on. The response carries 8 one-time backup codes, shown exactly once. Viewers may call it. Personal API tokens and sandbox tokens get 403. Shares the strict auth rate limiter (10 requests per minute per client IP). requestBody: required: true content: application/json: schema: type: object required: [code] properties: code: { type: string, description: Current TOTP code } responses: '200': description: Enabled content: application/json: schema: type: object properties: totp_enabled: { type: boolean, enum: [true] } backup_codes: { type: array, items: { type: string }, description: 8 one-time recovery codes } '400': { description: "code is required, or the code is wrong (`code: invalid_totp_code`). A wrong code answers 400, not 401, so a client that treats 401 as an expired session keeps the user signed in", content: { application/json: { schema: { $ref: '#/components/schemas/AuthCodedError' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: 'Already enabled, or no pending setup (call /users/me/totp/setup first)', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': { description: 'Rate limit exceeded; the body also carries retry_after', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to enable two-factor authentication } /users/me/totp/disable: post: tags: [Users] summary: Disable TOTP description: | Turns TOTP off after re-proving possession with a current TOTP code or an unused backup code, and deletes all remaining backup codes. Refused with 403 `{"error", "code": "mfa_required_by_org"}` while ANY organization the user belongs to requires MFA (not only the active one); when that cannot be checked it answers 500 and changes nothing. Viewers may call it. Personal API tokens and sandbox tokens get 403. Shares the strict auth rate limiter. requestBody: required: true content: application/json: schema: type: object required: [code] properties: code: { type: string, description: Current TOTP code or an unused backup code } responses: '200': description: Disabled content: application/json: schema: type: object properties: totp_enabled: { type: boolean, enum: [false] } '400': { description: "code is required, or neither a current TOTP code nor an unused backup code (`code: invalid_totp_code`; 400, not 401)", content: { application/json: { schema: { $ref: '#/components/schemas/AuthCodedError' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'One of the user''s organizations requires MFA (`code: mfa_required_by_org`), or the caller is a personal API token or a sandbox token', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': { description: 'Rate limit exceeded; the body also carries retry_after', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to disable two-factor authentication } /users/me/totp/backup-codes: post: tags: [Users] summary: Regenerate TOTP backup codes description: | Replaces all backup codes (used and unused) with 8 new ones after re-proving possession with a current TOTP code. A backup code is not accepted here. Viewers may call it. Personal API tokens and sandbox tokens get 403. Shares the strict auth rate limiter. requestBody: required: true content: application/json: schema: type: object required: [code] properties: code: { type: string, description: Current TOTP code } responses: '200': description: New backup codes, shown exactly once content: application/json: schema: type: object properties: backup_codes: { type: array, items: { type: string } } '400': { description: "code is required, or the TOTP code is wrong (`code: invalid_totp_code`; 400, not 401)", content: { application/json: { schema: { $ref: '#/components/schemas/AuthCodedError' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '429': { description: 'Rate limit exceeded; the body also carries retry_after', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to regenerate backup codes } /users/me/avatar: put: tags: [Users] summary: Upload current-user avatar description: | Stores a profile image of at most 2 MiB (clients downscale first). The type is sniffed from the bytes: JPEG, PNG, WebP or GIF. Viewers may call it. Personal API tokens and sandbox tokens get 403. requestBody: required: true content: multipart/form-data: schema: type: object required: [avatar] properties: avatar: { type: string, format: binary, description: The image file (form field "avatar") } responses: '200': description: Stored content: application/json: schema: type: object properties: avatar_updated_at: { type: string, format: date-time } '400': { description: 'Invalid multipart form, or no "avatar" file part', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '413': { description: 'Image larger than 2 MiB, or a multipart body larger than 3 MiB', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '415': { description: 'Unsupported image type (allowed: jpeg, png, webp, gif)', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to store the avatar } delete: tags: [Users] summary: Delete current-user avatar description: Removes the profile image. Viewers may call it. Personal API tokens and sandbox tokens get 403. responses: '200': description: Removed (also when no avatar was set) content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to delete the avatar } /users/{id}/avatar: parameters: [{ name: id, in: path, required: true, description: "User id (UUID), or me for the caller's own avatar", schema: { type: string } }] get: tags: [Users] summary: Get a user's avatar description: | Serves a user's profile image (avatars render in the sidebar, settings and member tables). The caller may read their own avatar (pass `me` as the id), the avatar of anyone they share an organization with (any membership, not only the active one), and, as an instance admin in their own signed-in session, anyone's (the Admin → Users table). Any other user answers 404, the same as a user without an avatar, so ids from another organization cannot be probed. Responses carry an `ETag` and `Cache-Control: private, max-age=86400`; a matching `If-None-Match` returns 304. parameters: - { name: If-None-Match, in: header, required: false, schema: { type: string } } responses: '200': description: The image bytes, with the stored content type headers: ETag: { schema: { type: string } } Cache-Control: { schema: { type: string } } content: image/jpeg: { schema: { type: string, format: binary } } image/png: { schema: { type: string, format: binary } } image/webp: { schema: { type: string, format: binary } } image/gif: { schema: { type: string, format: binary } } '304': { description: Not modified (If-None-Match matched the ETag) } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'The user has no avatar, or shares no organization with the caller (instance admins excepted)', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to load the avatar } # ==================== SANDBOXES ==================== /sandboxes: get: tags: [Sandboxes] summary: List sandboxes description: | Access-scoped list. With `session_id`: the sandboxes this orchestrator currently tracks for a session the caller can view (live runtime fields, unordered). With `project_id`: the recorded sandboxes of a project the caller can view. Without a filter: every recorded sandbox the caller can reach (their projects, their own sessions, and the sandboxes without either that they created in their active organization; org owners and admins see their whole organization); `active=true` narrows that list to live sandboxes of non-terminal sessions. Recorded lists are newest first. Project-bound tokens only see their own project. parameters: - { name: session_id, in: query, schema: { type: string, format: uuid } } - { name: project_id, in: query, schema: { type: string, format: uuid } } - { name: active, in: query, schema: { type: boolean }, description: Unfiltered list only } responses: '200': description: Sandboxes content: application/json: schema: type: object properties: sandboxes: type: array items: oneOf: - { $ref: '#/components/schemas/SandboxRecord' } - { $ref: '#/components/schemas/SandboxInfo' } '404': { description: The session or project is not visible to the caller } post: tags: [Sandboxes] summary: Create a sandbox description: | Provisions a sandbox pod directly. With `project_id` the caller needs editor access to the project, the project's repository and settings are injected, `cpu`/`memory`/`disk` default to the project's configured values and are clamped to its maxima. A sandbox token must name its own project. With `session_id` the caller needs editor access to that session (the rule of the /sessions/{id} routes), and `project_id` must be the session's own project (omitted for a session without one); the new sandbox is then attached to the session (`auto_start` also starts the agent and marks the session running). Subject to the organization's active-session cap unless the session, in a project, already holds an active slot (pending, queued, starting, planning, working, running or recovering). requestBody: required: true content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } project_id: { type: string, format: uuid } sandbox_type: { type: string, enum: [omni, coding, browser, android, desktop], default: coding, description: 'omni is the current type; the others are older names that all run the omni image' } type: { type: string, description: Alias of sandbox_type } session_type: { type: string } session_description: { type: string } agent_mode: { type: string } auto_start: { type: boolean } cpu: { type: string, description: 'Kubernetes quantity, e.g. 2 or 500m' } memory: { type: string, description: 'Kubernetes quantity, e.g. 4Gi' } disk: { type: string, description: 'Kubernetes quantity, e.g. 20Gi' } ttl_seconds: { type: integer, default: 3600, maximum: 86400 } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/SandboxInfo' } '400': { description: 'Invalid body, unsupported sandbox_type, an invalid cpu/memory/disk quantity, or a project_id that is not the session''s project' } '403': { description: 'Viewer, insufficient project or session access, or a sandbox token that does not name its own project' } '404': { description: Project or session not found or not visible to the caller } '429': { description: The organization is at its active-session cap } /sandboxes/{id}: parameters: [{ name: id, in: path, required: true, schema: { type: string } }] get: tags: [Sandboxes] summary: Get a sandbox description: | Live runtime view of a sandbox this orchestrator currently tracks; after an orchestrator restart an untracked sandbox answers 404. In this response `project_id` is always empty and `ttl_seconds` is 0. Requires view access to the sandbox's project (or its session when it has no project). A sandbox with neither belongs to the organization it was created in: its creator and that organization's owners and admins reach it while acting in it, and an older one with no recorded organization is left to instance admins. responses: '200': description: Sandbox content: application/json: schema: { $ref: '#/components/schemas/SandboxInfo' } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Sandboxes] summary: Delete a sandbox description: Deletes the sandbox pod and marks its record stopped. Requires editor access to the sandbox's project (or session); a sandbox with neither follows the rule of GET /sandboxes/{id}. responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sandboxes/{id}/exec: parameters: [{ name: id, in: path, required: true, schema: { type: string } }] post: tags: [Sandboxes] summary: Execute a command in a sandbox (not implemented) description: | Not implemented: always answers 501 and runs nothing, whatever the sandbox. Until 2026-09 it answered 200 with an echo of the command (`[Sandbox ] Executed: `) without running it. responses: '501': { description: Not implemented, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } /sandboxes/{id}/checkpoint: parameters: [{ name: id, in: path, required: true, schema: { type: string } }] post: tags: [Sandboxes] summary: Create a sandbox checkpoint (not implemented) description: | Not implemented: always answers 501. Sandbox checkpoints used to be in-memory handles in the orchestrator that captured nothing of the workspace and were lost on a restart. responses: '501': { description: Not implemented, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } /sandboxes/{id}/checkpoints: parameters: [{ name: id, in: path, required: true, schema: { type: string } }] get: tags: [Sandboxes] summary: List sandbox checkpoints (not implemented) description: Not implemented; always answers 501, like the other checkpoint routes. responses: '501': { description: Not implemented, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } /sandboxes/{id}/checkpoints/{cid}/restore: parameters: - { name: id, in: path, required: true, schema: { type: string } } - { name: cid, in: path, required: true, schema: { type: string } } post: tags: [Sandboxes] summary: Restore a sandbox checkpoint (not implemented) description: | Not implemented: always answers 501. A restore used to only mark the sandbox `restoring` in the orchestrator's memory. responses: '501': { description: Not implemented, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } # ==================== PLAYBOOKS ==================== /playbooks: get: tags: [Playbooks] summary: List playbooks description: | The playbooks of the caller's organization that the caller may read, sorted by name: every org-wide playbook plus the playbooks of the projects the caller can view (organization owners and admins can view every project). Only active playbooks unless `include_inactive=true`. `project_id` narrows the list to that project's playbooks plus the org-wide ones. parameters: - { name: project_id, in: query, schema: { type: string, format: uuid } } - { name: scope, in: query, schema: { type: string, enum: [org, project, session_type] } } - { name: include_inactive, in: query, schema: { type: boolean, default: false }, description: Also list deactivated playbooks } responses: '200': description: Playbooks content: application/json: schema: type: object properties: playbooks: type: array items: { $ref: '#/components/schemas/Playbook' } injection_enabled: type: boolean description: | Whether this deployment adds playbooks to sessions at all (the orchestrator's CRIOS_PLAYBOOK_INJECTION, off by default). While false, playbooks are stored and reviewed but no session receives them, active or not. post: tags: [Playbooks] summary: Create a playbook description: | `scope` defaults to `project`. An `org` playbook takes neither `project_id` nor `session_type`; a `project` playbook requires `project_id` and no `session_type`; a `session_type` playbook requires both. `project_id` must belong to the caller's organization, and the caller needs edit access to that project (404 without any access, 403 with view access only). The playbook starts active at version 1. A sandbox token is refused (403): it lists and reads playbooks and suggestions, and changes none of them. requestBody: required: true content: application/json: schema: type: object required: [name, content] properties: name: { type: string } description: { type: string } scope: { type: string, enum: [org, project, session_type], default: project } project_id: { type: string, format: uuid, nullable: true } session_type: { type: string, nullable: true } content: { type: string } responses: '201': description: The created playbook content: application/json: schema: { $ref: '#/components/schemas/Playbook' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /playbooks/{id}: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] get: tags: [Playbooks] summary: Get a playbook description: A project's playbook needs view access to the project; without it the answer is 404. responses: '200': { description: Playbook, content: { application/json: { schema: { $ref: '#/components/schemas/Playbook' } } } } '404': { $ref: '#/components/responses/NotFound' } patch: tags: [Playbooks] summary: Update a playbook description: | Partial update. Before a change to `name`, `description` or `content`, the current state is saved to the version history; a `content` change also increments `version`. `is_active` switches the playbook's injection into sessions on or off without a new version. A project's playbook needs edit access to the project. A sandbox token is refused (403). requestBody: required: true content: application/json: schema: type: object properties: name: { type: string } description: { type: string } content: { type: string } is_active: { type: boolean } responses: '200': description: The updated playbook content: application/json: schema: { $ref: '#/components/schemas/Playbook' } '400': { description: 'The body is not JSON, or it blanks `name` or `content` (required on create too). Nothing is written: the snapshot and every field are one transaction.', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Playbooks] summary: Delete a playbook description: A project's playbook needs edit access to the project. A sandbox token is refused (403). responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /playbooks/{id}/versions: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] get: tags: [Playbooks] summary: Get playbook version history description: | Earlier states of the playbook, newest first. Each entry is a snapshot taken before an update or a revert; the live state is the playbook itself, at `current_version`. A project's playbook needs view access to the project. responses: '200': description: Version history content: application/json: schema: type: object properties: playbook_id: { type: string, format: uuid } current_version: { type: integer } versions: type: array items: { $ref: '#/components/schemas/PlaybookVersion' } '404': { $ref: '#/components/responses/NotFound' } /playbooks/{id}/revert/{ver}: parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: ver, in: path, required: true, schema: { type: integer } } post: tags: [Playbooks] summary: Revert a playbook to a prior version description: | Restores the name, description and content of history entry `ver`. The current state is saved to the history first, and the playbook moves to a new, higher version number; history is never rewritten. A project's playbook needs edit access to the project. A sandbox token is refused (403). responses: '200': description: The reverted playbook content: application/json: schema: { $ref: '#/components/schemas/Playbook' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Playbook or version not found, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } /playbook-suggestions: get: tags: [Playbooks] summary: List playbook suggestions (review queue) description: | Failure→fix pairs captured from sessions that recovered from a failure, newest first, for the caller's organization. Defaults to the pending review queue. Crios captures no new ones since the Team Playbook replaced the Playbooks page: the list holds those captured before. parameters: - { name: status, in: query, schema: { type: string, enum: [pending, approved, rejected, auto_synthesized, all], default: pending } } - { name: limit, in: query, schema: { type: integer, default: 50, minimum: 1, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0, minimum: 0 } } responses: '200': description: Suggestions content: application/json: schema: type: object properties: suggestions: type: array items: { $ref: '#/components/schemas/PlaybookSuggestion' } /playbook-suggestions/rollup: get: tags: [Playbooks] summary: Roll up suggestions by failure signature description: | Groups the suggestions created in the last `days` days by `correlation_key`, ordered by the number of distinct sessions and then by occurrences, so the most widespread failure signatures come first. parameters: - { name: days, in: query, schema: { type: integer, default: 7, minimum: 1, maximum: 365 } } - { name: status, in: query, schema: { type: string, enum: [pending, approved, rejected, auto_synthesized, all], default: pending } } responses: '200': description: Groups content: application/json: schema: type: object properties: window_days: { type: integer } status: { type: string } groups: type: array items: { $ref: '#/components/schemas/PlaybookSuggestionGroup' } /playbook-suggestions/{id}/approve: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Playbooks] summary: Approve a suggestion (creates a playbook) description: | Creates an active playbook from a pending suggestion and marks the suggestion `approved`, in one transaction. `scope` is required and follows the playbook scope rules. `name` defaults to "Captured: " and `content` to the suggested rule text. A `project_id` must belong to the caller's organization, and the caller needs edit access to that project (404 without any access, 403 with view access only). When the failure→fix knowledge base is configured, the approved rule is also added to it. A sandbox token is refused (403). requestBody: required: true content: application/json: schema: type: object required: [scope] properties: scope: { type: string, enum: [org, project, session_type] } project_id: { type: string, format: uuid } session_type: { type: string } name: { type: string } content: { type: string } responses: '201': description: Approved content: application/json: schema: type: object properties: suggestion_id: { type: string, format: uuid } playbook_id: { type: string, format: uuid } status: { type: string, enum: [approved] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Suggestion or project not found, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '409': description: The suggestion is not pending content: application/json: schema: { $ref: '#/components/schemas/PlaybookSuggestionConflict' } /playbook-suggestions/{id}/reject: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Playbooks] summary: Reject a suggestion description: Marks a pending suggestion `rejected`. No request body. A sandbox token is refused (403). responses: '200': description: Rejected content: application/json: schema: type: object properties: suggestion_id: { type: string, format: uuid } status: { type: string, enum: [rejected] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: The suggestion is not pending content: application/json: schema: { $ref: '#/components/schemas/PlaybookSuggestionConflict' } /failure-kb/query: post: tags: [Playbooks] summary: Query the failure→fix knowledge base description: | "Have I seen this failure before?" Returns the failure→fix rules most similar to `query`, best match first: the rules the caller's organization approved and the deployment's shared seeded rules, never another organization's. `session_id` is filled only for the organization's own rules and only for organization owners and admins; `suggestion_id` only for its own rules. Read-shaped, so viewers may call it. Returns 503 when the failure knowledge base is not configured. requestBody: required: true content: application/json: schema: type: object required: [query] properties: query: { type: string, description: Failure description to match } limit: { type: integer, default: 5, maximum: 20, description: 'Maximum number of rules; values above 20 are capped' } responses: '200': description: Matching rules content: application/json: schema: type: object properties: query: { type: string } results: type: array items: { $ref: '#/components/schemas/PlaybookFailureKBMatch' } '400': { $ref: '#/components/responses/BadRequest' } '503': { description: Failure knowledge base not configured, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } # ==================== KNOWLEDGE ==================== /knowledge: get: tags: [Knowledge] summary: List knowledge entries description: | Lists the knowledge library of the caller's organization, sorted by name: every org-wide entry plus the entries of the projects the caller can view (organization owners and admins can view every project). Without `kind`, documents and prompts are both returned. `project_id` narrows the list to that project's entries plus the org-wide ones. `pinned_knowledge_ids` carries every knowledge entry the caller has pinned; the filters do not narrow it. parameters: - { name: kind, in: query, schema: { type: string, enum: [document, prompt] }, description: Entry kind; omit to list both } - { name: project_id, in: query, schema: { type: string, format: uuid }, description: That project's entries plus org-wide entries } - { name: scope, in: query, schema: { type: string, enum: [org, project] } } - { name: folder, in: query, schema: { type: string }, description: Exact folder match } responses: '200': description: Entries content: application/json: schema: type: object properties: entries: type: array items: { $ref: '#/components/schemas/KnowledgeEntry' } pinned_knowledge_ids: type: array items: { type: string, format: uuid } description: IDs of the knowledge entries the caller has pinned '400': { $ref: '#/components/responses/BadRequest' } post: tags: [Knowledge] summary: Create a knowledge entry description: | Creates a document (the default) or a prompt in the caller's organization. `scope` defaults to `org`, and an `org` entry ignores `project_id`. A `project` entry needs a `project_id` that belongs to the caller's organization and edit access to that project (404 without any access, 403 with view access only). `variables` are accepted only on a prompt. A sandbox token is refused (403): it lists, reads and queries the knowledge base, and writes none of it. Creating a prompt records its version 1. Documents are indexed for retrieval; prompts are never indexed. requestBody: required: true content: application/json: schema: type: object required: [name, content] properties: name: { type: string } content: { type: string } kind: { type: string, enum: [document, prompt], default: document } scope: { type: string, enum: [org, project], default: org } project_id: { type: string, format: uuid, nullable: true, description: Required when scope is project } folder: { type: string, nullable: true, description: 'Folder path; "/" separates nesting levels' } variables: type: array maxItems: 64 items: { type: string, pattern: '^[a-zA-Z_][a-zA-Z0-9_]*$' } description: Prompt only. The template variable names the prompt expects; blanks and duplicates are dropped, order is kept. responses: '201': description: Created. The response omits the timestamps; `version` is present for a prompt. content: application/json: schema: { $ref: '#/components/schemas/KnowledgeEntry' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /knowledge/{id}: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] get: tags: [Knowledge] summary: Get a knowledge entry description: A project's entry needs view access to the project; without it the answer is 404. responses: '200': { description: Entry, content: { application/json: { schema: { $ref: '#/components/schemas/KnowledgeEntry' } } } } '404': { $ref: '#/components/responses/NotFound' } patch: tags: [Knowledge] summary: Update a knowledge entry description: | Nobody can edit a Team Playbook entry (one with `org_agent_skill_id`): every PATCH of one answers 409 with code `org_agent_knowledge`, whatever the body. Partial update; omitted fields keep their value. `scope` and `project_id` cannot be changed. `kind` may change: a document that becomes a prompt is removed from the retrieval index, and a prompt that becomes a document is indexed. For a prompt, a change to `content` or `variables`, or the switch from document to prompt, records a new version; a rename or folder move does not. `variables` are rejected on a document. A project's entry needs edit access to the project. A sandbox token is refused (403). requestBody: required: true content: application/json: schema: type: object properties: name: { type: string } content: { type: string } folder: { type: string } kind: { type: string, enum: [document, prompt] } variables: type: array maxItems: 64 items: { type: string, pattern: '^[a-zA-Z_][a-zA-Z0-9_]*$' } description: Replaces the declared list (prompt only; same rules as on create) responses: '200': description: The updated entry content: application/json: schema: { $ref: '#/components/schemas/KnowledgeEntry' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: "A Team Playbook entry, which nobody can edit (code org_agent_knowledge)", content: { application/json: { schema: { $ref: '#/components/schemas/KnowledgeCodedError' } } } } delete: tags: [Knowledge] summary: Delete a knowledge entry description: A project's entry needs edit access to the project. A sandbox token is refused (403). responses: '204': { description: "Deleted. A Team Playbook entry (one with `org_agent_skill_id`) stays deleted: Crios doesn't write it again until its playbook leaves enabled (a disable or an archive) and is enabled again" } '403': { description: "No edit access to the entry's project; a Team Playbook entry, when the caller is not an organization owner or admin, who alone can delete one (code org_agent_knowledge); or a sandbox token, which can only read and query the knowledge base", content: { application/json: { schema: { $ref: '#/components/schemas/KnowledgeCodedError' } } } } '404': { $ref: '#/components/responses/NotFound' } /knowledge/query: post: tags: [Knowledge] summary: Search knowledge (RAG) description: | Ranks the knowledge documents of the caller's organization that apply to a project: the project's own entries plus the org-wide ones. Uses semantic search when retrieval is enabled, and keyword matching when it is not or when the vector search fails. Returns distinct entries, best match first. Prompt entries are never returned. Read-shaped, so viewers may call it, but the caller needs view access to `project_id` (404 without it). requestBody: required: true content: application/json: schema: type: object required: [project_id] properties: query: { type: string, description: Search text } project_id: { type: string, format: uuid } limit: { type: integer, default: 5, description: Maximum number of entries } responses: '200': description: Matches content: application/json: schema: type: object properties: query: { type: string } results: type: array items: { $ref: '#/components/schemas/KnowledgeSearchResult' } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /knowledge/folders: get: tags: [Knowledge] summary: List knowledge folders description: | Folders are derived from the `folder` values of a project's entries in the caller's organization. Without `parent`, returns the distinct top-level segments; with `parent`, the direct children of that folder as full paths (`parent/child`), sorted by path. Needs view access to `project_id`. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: parent, in: query, schema: { type: string }, description: Folder whose direct children to list } responses: '200': description: Folder paths content: application/json: schema: type: object properties: folders: type: array items: { type: string } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Knowledge] summary: Create a knowledge folder description: | Folders are implicit, so nothing is stored. The call echoes `path` and counts the project's entries already filed under it (exact match). A folder exists once an entry is saved with that `folder` value. A `project_id` needs edit access to that project. A sandbox token is refused (403). requestBody: required: true content: application/json: schema: type: object required: [path] properties: project_id: { type: string, format: uuid } path: { type: string } responses: '200': description: Folder acknowledged content: application/json: schema: type: object properties: path: { type: string } entry_count: { type: integer } created: { type: boolean, description: 'Always false: folders are implicit and nothing is stored' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Knowledge] summary: Delete a knowledge folder description: | Deletes the project's entries whose `folder` equals `path` exactly (sub-folders are not touched) and removes them from the retrieval index. With `move_to`, the entries are first moved to that folder and are therefore kept. The move and the delete run in one transaction: if the move fails, nothing is deleted and the call answers 500. Needs edit access to `project_id`. A sandbox token is refused (403). parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: path, in: query, required: true, schema: { type: string }, description: Folder to delete } - { name: move_to, in: query, schema: { type: string }, description: Folder to move the entries to instead of deleting them } responses: '200': description: Deleted content: application/json: schema: type: object properties: deleted: { type: integer, format: int64, description: Number of entries deleted } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '500': { description: The move or the delete failed; nothing was deleted, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } # ==================== REVIEW ==================== /review/self: post: tags: [Review] summary: Self-review a diff against a playbook description: | LLM review of `diff` against the optional `playbook_content`, routed and billed with the caller's organization model configuration. File and line counts are computed from the diff. Nothing is persisted. requestBody: required: true content: application/json: schema: type: object properties: diff: { type: string, description: Unified diff } playbook_content: { type: string } responses: '200': description: Review result content: application/json: schema: { $ref: '#/components/schemas/ReviewResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The review model call failed } /review/security: post: tags: [Review] summary: Security-check code description: LLM security review of `code`, routed and billed with the caller's organization model configuration. Nothing is persisted. requestBody: required: true content: application/json: schema: type: object properties: code: { type: string } responses: '200': description: Security findings content: application/json: schema: type: object properties: issues: type: array items: { $ref: '#/components/schemas/ReviewIssue' } count: { type: integer } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The security-check model call failed } /review/pr: post: tags: [Review] summary: Review a pull-request diff description: | Human-style LLM review of a pull-request `diff` against the optional `project_playbook`. Adds a merge-confidence `rating` (0–100) and a `risk_level` to the review result. Routed and billed with the caller's organization model configuration; nothing is posted to the git host. requestBody: required: true content: application/json: schema: type: object properties: diff: { type: string, description: Unified diff } project_playbook: { type: string } responses: '200': description: PR review content: application/json: schema: { $ref: '#/components/schemas/ReviewResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The review model call failed } /review/diff-stats: post: tags: [Review] summary: Compute diff statistics description: Counts files and added/removed lines in a unified diff, without a model call. requestBody: required: true content: application/json: schema: type: object properties: diff: { type: string } responses: '200': description: Diff statistics content: application/json: schema: type: object properties: files_changed: { type: integer } lines_added: { type: integer } lines_removed: { type: integer } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } /review/auto-fix: post: tags: [Review] summary: Run the auto-fix loop over a diff description: | Repeatedly self-reviews `diff` and applies the model's suggested fixes, up to `max_iterations` rounds (default 3), stopping early when a round finds no issues or no fixable suggestion. Routed and billed with the caller's organization model configuration. Nothing is written to a repository. requestBody: required: true content: application/json: schema: type: object properties: diff: { type: string } playbook_content: { type: string } max_iterations: { type: integer, default: 3, description: Values of 0 or less use the default } responses: '200': description: Auto-fix result content: application/json: schema: type: object properties: original_diff: { type: string } fixed_diff: { type: string } iterations: { type: integer } all_issues: type: array items: { $ref: '#/components/schemas/ReviewIssue' } issues_resolved: { type: integer } fixed_files: { type: array, items: { type: string } } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The auto-fix model calls failed } # ==================== PREVIEW (top-level) ==================== /preview/start: post: tags: [Preview] summary: Start a host dev-server preview description: | Host-side dev-server preview (not the sandbox iframe preview of GET /sessions/{id}/preview): runs the framework's dev server for `work_dir` on the orchestrator host, with a scrubbed environment. `work_dir` must resolve under the operator's CRIOS_PREVIEW_ROOT (relative paths are joined to it); when that root is unset the feature is off and every start answers 403. A second start for the same session replaces the running preview. Requires editor access to the session (404 otherwise). requestBody: required: true content: application/json: schema: type: object required: [session_id, work_dir] properties: session_id: { type: string, format: uuid } work_dir: { type: string } responses: '200': description: Started content: application/json: schema: type: object properties: status: { type: string, enum: [started] } session_id: { type: string, format: uuid } config: { $ref: '#/components/schemas/PreviewServerConfig' } '400': { description: 'Invalid body, or session_id or work_dir missing' } '403': { description: 'work_dir not allowed (outside CRIOS_PREVIEW_ROOT, or the root is unset), or a viewer' } '404': { description: No editor access to the session } /preview/stop: post: tags: [Preview] summary: Stop a host dev-server preview description: | Stops the session's host dev-server preview; stopping one that is not running is a no-op. The session is taken from the `session_id` query parameter (a request body is ignored). Requires editor access to the session (404 otherwise). parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Stopped content: application/json: schema: type: object properties: status: { type: string, enum: [stopped] } '400': { description: session_id missing } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No editor access to the session } /preview/status: get: tags: [Preview] summary: Get a host dev-server preview's config description: The running preview's configuration. The keys are capitalized (Go field names). parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Preview configuration content: application/json: schema: { $ref: '#/components/schemas/PreviewServerConfig' } '400': { description: session_id missing } '404': { description: 'No access to the session, or no preview is running for it' } /preview/stream: get: tags: [Preview] summary: Stream a host dev-server preview (WebSocket) description: | WebSocket upgrade, not SSE. Proxies messages between the client and the running dev server's `/_stream` socket in both directions. A text frame `ping` is answered with `pong`. If the dev server's socket cannot be reached, one JSON frame `{"type": "error", "message": "failed to connect to preview server"}` is sent and the connection closes. Requires view access to the session. parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '101': { description: Switching protocols to WebSocket } '400': { description: session_id missing } '404': { description: 'No access to the session, or no preview is running for it' } /preview/detect-framework: get: tags: [Preview] summary: Detect a work directory's framework description: | Inspects `work_dir` (config files, then package.json dependencies, then directory layout) and returns the framework and the dev-server command a preview would run. `work_dir` must resolve under CRIOS_PREVIEW_ROOT. Requires view access to the session. parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: work_dir, in: query, required: true, schema: { type: string } } responses: '200': description: Detection result content: application/json: schema: type: object properties: framework: { type: string, enum: [next, vite, react-scripts, vue, svelte, angular, react, vanilla] } command: { type: string } command_args: { type: array, items: { type: string } } hmr_enabled: { type: boolean, description: False only for vanilla } '400': { description: session_id or work_dir missing } '403': { description: 'work_dir not allowed (outside CRIOS_PREVIEW_ROOT, or the root is unset)' } '404': { description: No access to the session } /preview/refresh: post: tags: [Preview] summary: Restart a host dev-server preview description: | Stops and restarts the session's running dev server. The session comes from the body's `session_id`, else from the `session_id` query parameter. Requires editor access to the session (404 otherwise). A session without a running preview answers 409. parameters: - { name: session_id, in: query, schema: { type: string, format: uuid }, description: Used when the body carries no session_id } requestBody: required: false content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } responses: '200': description: Restarted content: application/json: schema: type: object properties: status: { type: string, enum: [refreshed] } session_id: { type: string, format: uuid } '400': { description: session_id missing } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No editor access to the session } '409': { description: No preview is running for the session } '500': { description: The restart failed } /preview/config: get: tags: [Preview] summary: Get a host dev-server preview's config description: Same response as GET /preview/status. The keys are capitalized (Go field names). parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Preview configuration content: application/json: schema: { $ref: '#/components/schemas/PreviewServerConfig' } '400': { description: session_id missing } '404': { description: 'No access to the session, or no preview is running for it' } patch: tags: [Preview] summary: Update a host dev-server preview's config description: | Changes the framework and/or port of the session's running preview; a port change restarts a running dev server. Zero or empty values leave a setting unchanged. Requires editor access to the session (404 otherwise). A session without a running preview answers 409. requestBody: required: true content: application/json: schema: type: object required: [session_id] properties: session_id: { type: string, format: uuid } framework: { type: string } port: { type: integer } responses: '200': description: Updated content: application/json: schema: type: object properties: status: { type: string, enum: [updated] } session_id: { type: string, format: uuid } config: { $ref: '#/components/schemas/PreviewServerConfig' } '400': { description: Invalid body or session_id missing } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No editor access to the session } '409': { description: No preview is running for the session } '500': { description: The update failed } # ==================== LLM GATEWAY ==================== /llm/chat: post: tags: [LLM] summary: LLM gateway chat completion description: | The sandbox agent's model gateway (it holds no provider keys). The `session_id` query parameter must name a session the caller created (for a session in a project, only while the caller is still a member of the project's organization) or one in the caller's organization; paused, completed, failed and cancelled sessions get 403, which stops spend. The session's project organization decides routing and billing. By default provider and model are re-resolved from the session type (the request's `session_type`, else the session's), so routing changes reach running sandboxes. `request.override_routing: true` keeps the given provider and model. Providers on a local or private endpoint need the local-LLM license feature. Streaming: with `request.stream: true` and `Accept: text/event-stream` the response is SSE. Each `data:` line is a JSON event: first `{resolved_provider, resolved_model}`, then deltas `{content, reasoning, tool_calls, usage}`, then `{done: true, response}` or `{error, details}`, and finally `data: [DONE]`. A `: ping` comment is sent every 15 s. parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/LLMGatewayChatRequest' } responses: '200': description: Completion (JSON), or an SSE stream when requested content: application/json: schema: { $ref: '#/components/schemas/LLMGatewayChatResponse' } text/event-stream: schema: { type: string } '400': { description: 'Invalid body, missing provider, model, messages or session_id, or provider "gateway"' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Session not authorized for the caller, session paused or finished, local-LLM feature not licensed, or viewer role' } '502': description: Upstream provider call failed content: application/json: schema: type: object properties: error: { type: string } details: { type: string } resolved_provider: { type: string } resolved_model: { type: string } '503': { description: Model router is not configured } /llm/routing: get: tags: [LLM] summary: Read-only routing snapshot description: | The session-type routing table exactly as the orchestrator resolves it for the caller's organization. A project-bound token (a sandbox token or a project-bound personal API token) gets its project's routing overrides applied. The sandbox agent reads it at startup (it has no database access). responses: '200': description: Routing snapshot content: application/json: schema: type: object properties: routings: type: array items: { $ref: '#/components/schemas/LLMGatewayRouting' } '401': { $ref: '#/components/responses/Unauthorized' } '503': { description: Model router is not configured } # ==================== COSTS ==================== /costs/session/{id}: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Costs] summary: Get session cost description: | LLM spend recorded for one session. Visible to anyone who can view the session (its creator, an org admin, or a member with view access to its project); everyone else gets 404. responses: '200': description: Session totals content: application/json: schema: { $ref: '#/components/schemas/CostSessionTotal' } '404': { $ref: '#/components/responses/NotFound' } /costs/project/{id}: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Costs] summary: Get project cost description: | LLM spend and session counts for one project. Requires at least view access to the project; otherwise 404. responses: '200': description: Project totals content: application/json: schema: { $ref: '#/components/schemas/CostProjectTotal' } '404': { $ref: '#/components/responses/NotFound' } /costs/summary: get: tags: [Costs] summary: Get the organization's cost summary description: | All-time LLM spend and session counts for the caller's active organization. A session without a project counts toward its owner's current organization. Readable by every member, viewers included. responses: '200': description: Organization totals content: application/json: schema: { $ref: '#/components/schemas/CostSummary' } /costs/daily: get: tags: [Costs] summary: Get daily usage description: | One row per calendar day for the last `days` days of the caller's active organization, oldest first. Days without activity are included with zero values. Readable by every member, viewers included. parameters: - { name: days, in: query, schema: { type: integer, default: 7, minimum: 1, maximum: 90 }, description: 'Window in days; values above 90 are capped at 90, and a missing, non-numeric or non-positive value means 7' } responses: '200': description: Daily points content: application/json: schema: type: array items: { $ref: '#/components/schemas/CostDailyPoint' } /costs/top-projects: get: tags: [Costs] summary: List the highest-spend projects description: | Projects of the caller's organization with recorded spend, highest first. Org admins see every project; other members see only projects they can view. Soft-deleted projects keep their historical spend and are flagged with `deleted`. parameters: - { name: limit, in: query, schema: { type: integer, default: 5, minimum: 1, maximum: 100 }, description: 'Values above 100 are capped at 100; a missing, non-numeric or non-positive value means 5' } responses: '200': description: Projects by spend content: application/json: schema: type: array items: { $ref: '#/components/schemas/CostTopProject' } /costs/stream: get: tags: [Costs] summary: Stream a session's cost (SSE) description: | Server-sent events for one session. Requires view access to the session (404 otherwise). Every 5 seconds the server writes one unnamed event, `data: `, until the client disconnects. The totals are the session's recorded spend, the same numbers as `GET /costs/session/{id}`; when they cannot be read, that tick sends no event. parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: 'Event stream; each event data is a CostStreamEvent' content: text/event-stream: schema: { type: string } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } # ==================== ORG SETTINGS (member read) ==================== /org-settings: get: tags: [Organizations] summary: Get org-wide settings (member-readable) description: | Any org member. Settings of the caller's active organization; every client reads them to render the session feed and login rules. responses: '200': description: Org settings content: application/json: schema: { $ref: '#/components/schemas/OrgSettings' } # ==================== CONNECTORS (member) ==================== /connectors/github/repos: get: tags: [Connectors] summary: List GitHub repos visible to the shared connection description: | For the project repo picker: organization members, admins and owners may call it, viewers and session (sandbox) tokens get 403. Uses the organization's GitHub credential (App installation token, OAuth device-flow token, or PAT). With a GitHub App only the repositories granted to the installation are listed. At most 300. responses: '200': description: Repos content: application/json: schema: type: object properties: repos: type: array items: { $ref: '#/components/schemas/ConnectorRepo' } count: { type: integer } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'A viewer, or a session (sandbox) token' } '409': { description: GitHub is not connected (connect it in Organization → Connectors) } '502': { description: Upstream GitHub listing failed } # ==================== SLACK CHANNELS ==================== /slack/channels/link: get: tags: [Integrations] summary: Get a project's Slack channel link description: | Needs viewer access to the project. A project that is missing, deleted, in another organization or not visible to the caller is a 404, like the `/projects/{id}` routes; a token bound to another project gets 403. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Channel link content: application/json: schema: { $ref: '#/components/schemas/SlackChannelLink' } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: A token bound to another project } '404': { description: 'Project not found or not visible to the caller, or no channel linked' } post: tags: [Integrations] summary: Link a Slack channel to a project description: | Creates or replaces the project's channel link (one channel per project, and a channel can link to only one project). Needs manage access to the project: its owner, or an organization owner or admin. Editors and viewers receive 403; a project that is missing, deleted, in another organization or not visible to the caller is a 404. The link routes the project's notifications to the channel and lets the channel's `@Crios` commands and thread replies act on the project's sessions. The channel must be one the organization's Slack can see: Crios asks Slack's `conversations.info` with the bot token of the organization's Slack connector and of the Slack installs its members connected, which needs the `channels:read` scope (`groups:read`, and the bot in the channel, for a private one). A channel no token sees, and one linked to another organization's project, is a 404. requestBody: required: true content: application/json: schema: type: object required: [project_id, channel_id] properties: project_id: { type: string, format: uuid } channel_id: { type: string, description: Slack channel ID } channel_name: { type: string } notification_type: { type: string, default: all, description: Free-form label stored with the link } responses: '200': description: Linked content: application/json: schema: { $ref: '#/components/schemas/SlackChannelLink' } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: 'Below manage access, or a token bound to another project' } '404': { description: 'Project not found or not visible to the caller, or a channel the organization''s Slack cannot see or another organization linked' } '409': { description: 'The channel is already linked to another project of the organization, the organization has no Slack token, or its tokens lack channels:read' } '502': { description: Slack could not be asked about the channel } delete: tags: [Integrations] summary: Unlink a project's Slack channel description: | Removes the project's channel link. The project is named in the query string, not a body. Succeeds even when no link existed (`deleted` is then false). Needs manage access to the project, as linking does: editors and viewers receive 403, and an invisible project is a 404. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Result content: application/json: schema: type: object properties: deleted: { type: boolean, description: True when a link was removed } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: 'Below manage access, or a token bound to another project' } '404': { description: Project not found or not visible to the caller } # ==================== INTEGRATIONS (agent-facing proxies) ==================== /integrations/slack/notify: post: tags: [Integrations] summary: Send a Slack notification (org-scoped proxy) description: | Posts a message for a project; the credentials stay in the orchestrator. The sandbox calls it with its session token, and a project-bound sandbox token may only post for its own project. When the project has a linked, enabled Slack hub account the post goes through it; otherwise the organization's Slack connector is used. The channel falls back to the project's configured or linked channel. Limited to about 30 posts per minute per organization (burst 10). requestBody: required: true content: application/json: schema: type: object required: [project_id, text] properties: project_id: { type: string, format: uuid } channel: { type: string, description: 'Overrides the project''s default channel' } text: { type: string } responses: '200': description: Posted content: application/json: schema: type: object properties: ok: { type: boolean } channel: { type: string } result: { type: string, description: Present when the hub account posted } '400': { description: 'project_id and text are required, or no channel is configured' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Sandbox token bound to another project, or viewer role' } '404': { description: 'Project not found in the caller''s organization' } '429': { description: 'Per-organization rate limit (Retry-After: 2)' } '500': { description: 'Project check failed (a malformed project_id also lands here)' } '502': { description: Slack rejected the post } '503': { description: 'Slack not configured, or notifications disabled for the project' } /integrations/jira: post: tags: [Integrations] summary: Dispatch a Jira action (org-scoped proxy) description: | Runs one Jira action for a project; the credentials stay in the orchestrator. A project with a Jira project mapping runs through the mapped hub account, as the member who mapped it, in every session of the project; otherwise the organization's Jira connector is used; on that hub path failures follow the integrations hub status mapping with an `{error, code}` body whose `error` carries the hub's message and recovery, except that Jira refusing the mapped account (`code: auth`) answers 409, not 401. Issue descriptions and comments get a footer naming the Crios user who sent them. Limited to about 30 calls per minute per organization (burst 10). Actions and their required fields: `search` (optional `status`), `get` (`issue_key`), `create` (`summary`; `issue_type` defaults to Task), `comment` (`issue_key`, `comment`), `assign` (`issue_key`, `assignee`), `transition` (`issue_key`, `transition_id`) and `transitions` (`issue_key`). Every action works in one Jira project: the mapped project, or the project the organization's Jira connector names in its Project ID (a project key, or a numeric id whose key is looked up in Jira). An `issue_key` must be a key of that project. When the connector's Project ID names no Jira project (a Crios project's id there routes captured tickets instead), a project without a mapping is refused every action. requestBody: required: true content: application/json: schema: type: object required: [project_id, action] properties: project_id: { type: string, format: uuid } action: { type: string, enum: [search, get, create, comment, assign, transition, transitions] } issue_key: { type: string } status: { type: string } summary: { type: string } description: { type: string } issue_type: { type: string } comment: { type: string } transition_id: { type: string } assignee: { type: string } responses: '200': description: Action result content: application/json: schema: type: object properties: ok: { type: boolean } result: { type: string, description: Human-readable result text } '400': { description: 'Missing project_id or action, unknown action, a field the action requires, an issue_key that is not a key of the project''s Jira project, or (without a mapping) a connector Project ID that names no Jira project' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Project not found in the caller''s organization' } '409': { description: 'Hub path: Jira refused the mapped account (code auth: its member reconnects it), or another hub conflict' } '429': { description: 'Per-organization rate limit exceeded (Retry-After: 2)' } '500': { description: 'Project check or mapping lookup failed (a malformed project_id also lands here)' } '502': { description: 'Jira request failed, including looking up the key of a numeric Project ID' } '503': { description: Jira is not configured } # ==================== MCP SERVERS ==================== /mcp-servers: get: tags: [MCP] summary: List the organization's MCP servers description: | Org-shared MCP servers of the caller's active organization, ordered by name. Readable by every member. A person's own MCP connections are not listed here. Auth secrets are never returned; `has_auth` says whether one is stored. responses: '200': description: MCP servers content: application/json: schema: type: object properties: servers: type: array items: { $ref: '#/components/schemas/MCPServer' } '401': { $ref: '#/components/responses/Unauthorized' } post: tags: [MCP] summary: Register an MCP server description: | Requires org admin (owner or admin role). Session sandbox tokens are refused. `transport` must be `http` (needs `endpoint`): a `stdio` server is refused with 400 for every caller, because listing its tools would mean running its `command` in the orchestrator. A static auth header needs `auth_header_name` with `auth_header_value`; the value is stored in Vault and never returned. When the header is `Authorization` and the value contains no space, `Bearer ` is prepended when it is sent. Names are unique within the organization. `headers` is a list of further headers (see MCPHeader): a `secret` header takes its value from `header_secrets` (by header name, write-only, stored in Vault), and one with no value is refused; a `connection` header reads a secret the registering admin holds. `instructions` (at most 4000 bytes) is appended to the server's tool advertisement; `icon` is a PNG, JPEG or WebP data URL of at most 64 KiB. An invalid header list, a `header_secrets` entry that names no secret header, or secret storage being unavailable for a secret header is a 400. requestBody: required: true content: application/json: schema: type: object required: [name, transport] properties: name: { type: string } transport: { type: string, enum: [http], description: '`stdio` is refused with 400' } endpoint: { type: string, description: The server's streamable HTTP endpoint } auth_header_name: { type: string } auth_header_value: { type: string, description: Write-only; stored in Vault } allowed_tools: type: array items: { type: string } description: 'Tools the proxy may call; "*" allows every tool' enabled: { type: boolean, default: true } headers: { type: array, items: { $ref: '#/components/schemas/MCPHeader' } } header_secrets: { type: object, additionalProperties: { type: string }, description: 'Write-only values of secret headers, by header name; blank values are ignored' } instructions: { type: string, description: At most 4000 bytes after trimming } icon: { type: string, description: 'A data:image/png, data:image/jpeg or data:image/webp base64 URL of at most 64 KiB' } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/MCPServer' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: An MCP server with that name already exists } '422': { description: 'A `connection` header reads a project connection that may not be sent to the endpoint of this server (`code` `mcp_header_*`, the header in `header`; see MCPHeaderRef); nothing was saved', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '503': { description: 'Secret storage is unavailable, so an auth header cannot be stored' } /mcp-servers/{id}: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] get: tags: [MCP] summary: Get an MCP server description: | Readable by every member for org-shared servers. A person's own MCP connection is returned only to its owner; for everyone else, admins included, it is 404. responses: '400': { $ref: '#/components/responses/BadRequest' } '200': description: MCP server content: application/json: schema: { $ref: '#/components/schemas/MCPServer' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } patch: tags: [MCP] summary: Update an MCP server description: | Requires org admin (owner or admin role). Session sandbox tokens are refused. Only supplied fields change; `transport` cannot be changed. The merged server is validated like a create. A non-empty `auth_header_value` replaces the stored secret and an empty string deletes it; `auth_header_name` cannot be cleared while a secret is stored. On a `stdio` server registered before 2026-09-27, a `command` or `args` that differs from the stored value is refused with 400; its name, `enabled` flag and `allowed_tools` can still change. `headers`, `instructions` and `icon` are validated as on create (400 when invalid) and echoed in the response, but this route does not store them, nor `header_secrets`: the saved server keeps its previous values. requestBody: required: true content: application/json: schema: type: object properties: name: { type: string } endpoint: { type: string } command: { type: string } args: { type: array, items: { type: string } } auth_header_name: { type: string } auth_header_value: { type: string, description: 'Write-only; "" deletes the stored secret' } allowed_tools: { type: array, items: { type: string } } enabled: { type: boolean } headers: { type: array, items: { $ref: '#/components/schemas/MCPHeader' }, description: Validated but not stored (see above) } header_secrets: { type: object, additionalProperties: { type: string }, description: 'Checked against the headers, never stored (see above)' } instructions: { type: string, description: Validated but not stored (see above) } icon: { type: string, description: Validated but not stored (see above) } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/MCPServer' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: An MCP server with that name already exists } '422': { description: 'A `connection` header reads a project connection that may not be sent to the endpoint of this server (`code` `mcp_header_*`, the header in `header`; see MCPHeaderRef); nothing was changed', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '503': { description: 'Secret storage is unavailable, so an auth header cannot be stored' } delete: tags: [MCP] summary: Delete an MCP server description: | Requires org admin (owner or admin role). Session sandbox tokens are refused. Also deletes the stored auth secret. A person's own MCP connection is deleted only for its owner (who normally uses `DELETE /mcp/connections/{id}`); for everyone else, admins included, it is 404, like `GET`. responses: '400': { $ref: '#/components/responses/BadRequest' } '204': { description: Deleted } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /mcp-servers/{id}/probe: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [MCP] summary: Test an MCP server connection description: | Requires org admin (owner or admin role). Session sandbox tokens are refused. Runs the MCP handshake and `tools/list` from the orchestrator, records `last_probe_at`/`last_probe_status`, and on success caches the tools as `discovered_tools`. Only `http` servers can be probed: a `stdio` server is refused with 400 before anything is started, so its command never runs in the orchestrator. Probes and proxied calls share a per-organization rate limit (1 per second, bursts of 20). responses: '200': description: Probe succeeded content: application/json: schema: { $ref: '#/components/schemas/MCPProbeResult' } '400': description: The server uses the stdio transport content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '422': { description: 'A `connection` header reads a project connection that may not be sent to the endpoint of this server (`code` `mcp_header_*`, the header in `header`; see MCPHeaderRef); the server was not contacted', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': description: Organization rate limit exceeded (Retry-After is 1 second) content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '500': description: The server's credentials could not be resolved content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '502': description: The server was unreachable or the handshake or tool listing failed content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } /mcp-proxy/{id}/call: parameters: [{ name: id, in: path, required: true, description: "MCP server or connection id (UUID), or crios-platform for the platform's own tools", schema: { type: string } }] post: tags: [MCP] summary: Call a tool through an MCP server description: | Runs one tool on an `http` MCP server from the orchestrator, so the server's credentials never reach the caller; `stdio` servers are refused. The server must be enabled and the tool must be on its `allowed_tools` list (`*` allows every tool); on a person's own connection that list follows its access level. Where the catalog vendor supports it, the proxy also sends the connection's allowed toolsets, read-only mode or tool list to the server as the vendor's request headers or endpoint query parameters. The server's header list is resolved for every call. `{id}` is an org-shared server, the caller's own MCP connection, or `crios-platform` for the deployment's platform MCP server (404 when the deployment has none). Platform calls are forwarded with the caller's own bearer token and may use only the platform tool set; a `wf_` tool runs the project's active workflow of that name in production mode and needs a project-bound session token. Tool output is capped at 16 KiB (suffixed `…(truncated)` when cut). Viewers receive 403. Shares the per-organization rate limit with probes. requestBody: required: true content: application/json: schema: type: object required: [tool] properties: tool: { type: string } arguments: { type: object, additionalProperties: true } session_id: { type: string, format: uuid, description: 'crios-platform only: the calling session, used to attribute workflow_generate spend' } responses: '200': description: The tool ran; ok is false when the server reported a tool error content: application/json: schema: { $ref: '#/components/schemas/MCPProxyResult' } '400': description: Invalid body, missing tool, a stdio server, or an ambiguous wf_ workflow name content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '401': { $ref: '#/components/responses/Unauthorized' } '403': description: Viewer, disabled server, tool not allowed, or a wf_ tool without a project-bound session token content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '404': { $ref: '#/components/responses/NotFound' } '422': { description: 'A `connection` header reads a project connection that may not be sent to the endpoint of this server (`code` `mcp_header_*`, the header in `header`; see MCPHeaderRef); the call was not sent', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': description: Organization rate limit exceeded (Retry-After is 1 second) content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '500': description: The server's credentials or the project's workflows could not be resolved content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '502': description: The server was unreachable or the call failed in transport content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } # ==================== INTAKE ==================== /intake: get: tags: [Intake] summary: List the organization's intake tickets description: | The org-wide intake inbox, newest first, including tickets not yet assigned to a project. Requires org admin (owner or admin role); project members use `GET /projects/{id}/intake`. Tickets that resolved to no organization belong to no tenant: they are listed only to instance admins, and every other caller of the `/intake` routes gets 404 for them. parameters: - { name: status, in: query, schema: { type: string, enum: [received, dispatching, working, pr_ready, done, failed, dismissed, unresolved] }, description: Filter by intake_status } - { name: source, in: query, schema: { type: string, enum: [github_issue, jira_ticket, slack_message] }, description: Filter by source } - { name: limit, in: query, schema: { type: integer, default: 50, maximum: 200 }, description: 'Values above 200 are capped; a missing or non-positive value means 50' } - { name: offset, in: query, schema: { type: integer, default: 0, minimum: 0 } } responses: '200': description: Tickets page with totals content: application/json: schema: { $ref: '#/components/schemas/IntakeTicketList' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } /intake/{id}: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] get: tags: [Intake] summary: Get an intake ticket description: | The full ticket, including the original webhook payload. Org admins can read every ticket of the organization; other members only tickets of projects they can view (404 otherwise, also for unassigned tickets). A ticket with no organization is readable by instance admins only. responses: '200': description: Ticket content: application/json: schema: { $ref: '#/components/schemas/ExternalTicket' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } /intake/{id}/retry: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Intake] summary: Retry dispatch of a ticket description: | Re-queues a settled ticket (`failed`, `unresolved`, `dismissed`, `done` or `pr_ready`) as `received`, clearing its error and attempt count. Tickets still in flight return 409. Org admins may retry any ticket; other members need editor access to the ticket's project, and unassigned tickets are org-admin only. Viewers receive 403. responses: '200': description: Re-queued content: application/json: schema: { $ref: '#/components/schemas/IntakeTicketTransition' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: The ticket is in a status that cannot be retried } /intake/{id}/dismiss: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Intake] summary: Dismiss a ticket description: | Marks the ticket `dismissed` to clear it from the inbox. A session already running for the ticket keeps running. Already-dismissed tickets return 409. Org admins may dismiss any ticket; other members need editor access to the ticket's project, and unassigned tickets are org-admin only. Viewers receive 403. responses: '200': description: Dismissed content: application/json: schema: { $ref: '#/components/schemas/IntakeTicketTransition' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: The ticket is already dismissed } /intake/{id}/assign: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Intake] summary: Assign a ticket to a project description: | Pins the ticket to a project and re-queues it as `received` (allowed from `unresolved`, `received`, `failed` or `dismissed`; other statuses return 409). The caller needs editor access to the target project (404 when it is not visible). Non-admins also need editor access to the ticket's current project, and unassigned tickets are org-admin only. A ticket with no organization can be assigned by an instance admin only, and moves into the caller's organization. Viewers receive 403. requestBody: required: true content: application/json: schema: type: object required: [project_id] properties: project_id: { type: string, format: uuid } responses: '200': description: Assigned and re-queued content: application/json: schema: { $ref: '#/components/schemas/IntakeTicketTransition' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Ticket or target project not found } '409': { description: The ticket is in a status that cannot be assigned } # ==================== SPECTATE (public, token-scoped) ==================== /spectate/{token}/meta: parameters: [{ name: token, in: path, required: true, schema: { type: string } }] get: tags: [Spectate] summary: Public spectator session metadata description: | Public: the share token minted with POST /sessions/{id}/share is the only credential (24 hours by default, 7 days at most, revocable). Returns redacted metadata only; never the owner, the sandbox URL or model routing. Every token failure (unknown, expired, revoked) is the same 404. security: [] responses: '200': description: Customer-safe metadata content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } title: { type: string } description: { type: string } status: { type: string } session_type: { type: string } project: { type: string, description: Project name } created_at: { type: string, format: date-time } '404': { description: 'Invalid or expired share token, or the session no longer exists' } '500': { description: Failed to load metadata } /spectate/{token}/events: parameters: [{ name: token, in: path, required: true, schema: { type: string } }] get: tags: [Spectate] summary: Poll the public spectator event feed description: | Public, token-scoped polling feed (not a stream). Returns customer-safe events oldest first: plan, plan_update, autonomous_progress, goal_checkpoint, review_passed, review_failed, git_branch, git_commit, parallel_batch_complete, agent_message, agent_message_complete, session_completed, session_failed, terminal_status_changed and dev_server_readiness. Tool calls and operator events are never exposed. To page forward, pass the previous response's `next_cursor` as `cursor`: it marks the last event served (its time and id), so every event comes exactly once, including events stored in the same instant. The older `since` still works; `next_since` carries full sub-second precision, but a timestamp alone cannot split events stored in the same instant at a page edge. security: [] parameters: - { name: cursor, in: query, schema: { type: string }, description: 'The previous page''s next_cursor (opaque); wins over since. A malformed cursor answers 400' } - { name: since, in: query, schema: { type: string, format: date-time }, description: RFC 3339 (fractional seconds allowed); only events created after it } - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 250, default: 250 } } responses: '200': description: One page of events content: application/json: schema: type: object properties: events: type: array items: type: object properties: event_type: { type: string } content: { type: string, description: Raw event content (usually a JSON document) } created_at: { type: string, format: date-time, description: Full sub-second precision } next_cursor: { type: string, description: 'Pass as cursor for the next page; absent when the page is empty' } next_since: { type: string, format: date-time, description: 'Timestamp of the last event, full sub-second precision; absent when the page is empty' } '400': { description: Malformed cursor } '404': { description: Invalid or expired share token } '500': { description: Failed to load events } # ==================== WEBHOOK RECEIVERS (inbound, HMAC-verified) ==================== /webhooks/github: post: tags: [Webhooks] summary: Inbound GitHub webhook receiver description: | Legacy shared URL (the one the Connectors tab shows for GitHub). Public; the provider's HMAC signature is the only credential. `X-Hub-Signature-256: sha256=` must verify against an organization's GitHub webhook secret: first the organization whose App id matches `X-GitHub-Hook-Installation-Target-ID`, then each organization's secret, oldest organization first. Fails closed with 503 when no organization has a secret. `issues` and `issue_comment` events feed the External Intake inbox (which starts sessions). `installation` events keep the organization's own GitHub App connection in step: `created` stores the installation of the organization's App while it has none, `deleted` clears the installation it holds; both are audited without an actor. Other events are acknowledged and ignored. Errors are plain text. Rate-limited per client IP. security: [] parameters: - { name: X-GitHub-Event, in: header, required: true, schema: { type: string } } - { name: X-Hub-Signature-256, in: header, required: true, schema: { type: string } } - { name: X-GitHub-Hook-Installation-Target-ID, in: header, schema: { type: string } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } responses: '200': description: Received content: application/json: schema: type: object properties: status: { type: string, enum: [received] } '400': { description: Unreadable body or missing X-GitHub-Event } '401': { description: Invalid signature } '503': { description: No webhook secret configured } /webhooks/jira: post: tags: [Webhooks] summary: Inbound Jira webhook receiver description: | Legacy URL, served for the oldest organization (the one that owned the pre-organization connector). Public; `X-Hub-Signature` (sent by Jira Cloud) or `X-Atlassian-Signature` must carry `sha256=` under that organization's Jira webhook secret. Fails closed with 503 when no secret is configured. Handles `jira:issue_created`, `jira:issue_updated` (transitions, assignee changes), `jira:issue_assigned` and `comment` events; events authored by the Crios Jira identity answer `{"status":"ignored"}`. A body over 25 MiB (Jira's own payload limit) answers 413 before the secret or the signature is checked. Errors are plain text. Rate-limited per client IP. security: [] parameters: - { name: X-Hub-Signature, in: header, schema: { type: string } } - { name: X-Atlassian-Signature, in: header, schema: { type: string } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } responses: '200': description: Received or ignored content: application/json: schema: type: object properties: status: { type: string, enum: [received, ignored] } '400': { description: Unreadable or unparseable body } '401': { description: Invalid signature } '413': { description: "Body over 25 MiB, Jira's own payload limit" } '503': { description: No webhook secret configured } /webhooks/slack: post: tags: [Webhooks] summary: Inbound Slack webhook receiver (events and slash commands) description: | Slack Events API and slash-command endpoint; legacy URL served for the oldest organization. Public; `X-Slack-Signature` (`v0=:">` under the organization's Slack signing secret) and `X-Slack-Request-Timestamp` (within 5 minutes) must verify over the raw body, JSON or form. Fails closed with 503 when no signing secret is configured. A JSON body is an Events API delivery. A `url_verification` request is answered with its `challenge` as text/plain. `event_callback` events are handled (`app_mention` commands and requests, `/crios` channel commands, thread replies that steer the linked project's active session); bot-authored messages are ignored. Success is an empty 200. A form-encoded body is a slash command (`/crios `). The text is parsed like a mention: a command word runs that command, other text is captured as an intake task, and no text shows help. The answer is returned in the response as an ephemeral message, which Slack shows only to the person who ran the command. Errors are plain text. Rate-limited per client IP. security: [] parameters: - { name: X-Slack-Signature, in: header, required: true, schema: { type: string } } - { name: X-Slack-Request-Timestamp, in: header, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } application/x-www-form-urlencoded: schema: type: object required: [command] properties: command: { type: string, description: 'The slash command, e.g. /crios' } text: { type: string, description: 'What follows the command, e.g. "status"' } team_id: { type: string } channel_id: { type: string } user_id: { type: string } trigger_id: { type: string, description: Identifies a task captured by the command } responses: '200': description: 'Events: accepted (empty body), or the url_verification challenge as text/plain. Slash commands: the ephemeral answer.' content: text/plain: schema: { type: string } application/json: schema: type: object properties: response_type: { type: string, enum: [ephemeral] } text: { type: string } '400': { description: 'Unreadable or unparseable body, or a form without a command' } '401': { description: Invalid or stale signature } '503': { description: No signing secret configured } /webhooks/slack/interactions: post: tags: [Webhooks] summary: Inbound Slack interactivity receiver description: | Slack interactivity endpoint (button clicks, shortcuts); legacy URL served for the oldest organization. Same signature check as the events receiver, computed over the raw form body. Crios posts no interactive messages, so a verified request is acknowledged with an empty 200 and otherwise ignored; the route exists so a Slack app configured with an interactivity URL keeps getting its 200. Errors are plain text. security: [] parameters: - { name: X-Slack-Signature, in: header, required: true, schema: { type: string } } - { name: X-Slack-Request-Timestamp, in: header, required: true, schema: { type: string } } requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object required: [payload] properties: payload: { type: string, description: JSON interaction payload } responses: '200': { description: Acknowledged (empty body); the payload is not acted on } '400': { description: Unreadable body } '401': { description: Invalid or stale signature } '503': { description: No signing secret configured } # ==================== WEBSOCKET ==================== /ws: get: tags: [Sessions] summary: Session event WebSocket (Upgrade) description: | Upgrades to a WebSocket that carries one session's live events. The route has no method filter; clients open it with the usual `GET` upgrade handshake. **Authentication** runs before the upgrade, through the API auth middleware. Browsers cannot set `Authorization` on a WebSocket, so they offer the JWT as a subprotocol: `Sec-WebSocket-Protocol: crios-ws-auth, ` (the server echoes `crios-ws-auth`). The `access_token` or `token` query parameter is also accepted, and other clients may send `Authorization: Bearer`. Personal API tokens are read only from the `Authorization` header and need full access; fine-grained tokens are refused. **Authorization** mirrors the REST session routes. View access subscribes to events; every inbound frame from a caller without write access (for example a project-share viewer) is dropped. At most 64 concurrent sockets per user (429 before the upgrade). Access is re-checked about every 45 s while the socket is open, and the socket ends when its token expires: it closes with code 4401 when the credential is gone (token expired or revoked, account suspended, removed from the organization) and 4403 when the credential is fine but no longer reaches the session (share revoked, project deleted). Refresh the token before reconnecting after 4401; do not retry after 4403. **Server to client:** JSON text frames, one per event: `{"id", "type", "session_id", "content", "timestamp"}`. A protocol ping is sent after 30 s without events. A missing `session_id` or an inaccessible session produces one `{"error": "session_id required" | "session not found"}` frame, then the socket closes. **Client to server:** JSON text frames `{"type", "content", "data"}`, up to 16 MiB: `user_message` (content is the text; steers the agent; the same text again within 30 s is dropped), `input`, `terminal_input` (text in `data` or `content`), `control` (content `{"command": "..."}` or a string), `approval` or `approval_response` (content `{"approved": bool, "comment": string}`; ignored from sandbox tokens), and the take-control relays `browser_input`, `android_input` and `desktop_input`. The sandbox agent also publishes its stream events (tool calls, status changes, plan updates) and sends binary RTP frames for the WebRTC live view. With `media=1` the socket is the agent's RTP-only transport: it accepts binary frames and sends no events. parameters: - { name: session_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: media, in: query, schema: { type: string, enum: ['1'] }, description: RTP-only transport for the sandbox agent } - { name: access_token, in: query, schema: { type: string }, description: JWT for clients that cannot set a header } - { name: token, in: query, schema: { type: string }, description: Alias of access_token } responses: '101': { description: Switching Protocols (WebSocket) } '401': { $ref: '#/components/responses/Unauthorized' } '429': { description: Too many concurrent WebSocket connections for this user } # ==================== ADMIN (instance admin: RequireInstanceAdmin) ==================== /admin/health: get: tags: [Admin] summary: Aggregated deployment health description: | Instance admin only (the payload exposes cluster topology). Probes postgres, pipeline_postgres, redis, qdrant, qdrant_generalized, vault, searxng, gitea and every LLM provider across all organizations (`provider:` components), 8 s timeout per probe, plus the background worker heartbeats. Overall `status` is `down` when postgres is down, `degraded` when any component is down or a worker is stale, else `up`. Results are cached for 60 s. responses: '200': description: Health payload content: application/json: schema: { $ref: '#/components/schemas/AdminHealth' } '403': { $ref: '#/components/responses/Forbidden' } /admin/org-settings: patch: tags: [Admin] summary: Update org-wide settings description: | Instance admin only. Updates the settings of the caller's ACTIVE organization (org admins use `PATCH /organizations/{id}/settings`). Partial update: at least one field is required. Recorded in the audit log. requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/OrgSettingsUpdate' } responses: '200': description: Updated settings content: application/json: schema: { $ref: '#/components/schemas/OrgSettings' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: '`{"error", "code": "allow_signups_not_applicable"}`: allow_signups was changed in an organization whose toggle registration does not read (allow_signups_applies false). Re-sending the stored value is accepted' } /admin/sso: get: tags: [Admin] summary: Get SSO settings description: | Instance admin only. The deployment-wide OIDC single sign-on configuration: the saved settings when present (`source` = `database`), else the environment configuration (`environment`), else defaults (`none`). The client secret is never returned. responses: '200': description: SSO settings content: application/json: schema: { $ref: '#/components/schemas/SSOSettingsState' } '403': { $ref: '#/components/responses/Forbidden' } put: tags: [Admin] summary: Save SSO settings description: | Instance admin only. Replaces the saved settings (send the full object) and applies them live. An empty `client_secret` keeps the stored one. Enabling requires a valid `issuer_url`, a `client_id` and a client secret. `default_role` (for auto-provisioned users) is admin, member or viewer (default member). Scopes are de-duplicated, `openid` is always included, and an empty list means `openid profile email`. Recorded in the audit log. requestBody: required: true content: application/json: schema: allOf: - $ref: '#/components/schemas/SSOSettings' - type: object properties: client_secret: { type: string, description: Write-only; empty keeps the stored secret } responses: '200': description: Saved settings content: application/json: schema: { $ref: '#/components/schemas/SSOSettingsState' } '400': description: Invalid settings content: application/json: schema: type: object properties: error: { type: string } details: { type: string } '403': { $ref: '#/components/responses/Forbidden' } delete: tags: [Admin] summary: Reset SSO settings description: | Instance admin only. Deletes the saved settings; SSO falls back to the environment configuration (or is disabled when there is none). Recorded in the audit log. responses: '200': description: Effective settings after the reset content: application/json: schema: { $ref: '#/components/schemas/SSOSettingsState' } '403': { $ref: '#/components/responses/Forbidden' } /admin/sso/test: post: tags: [Admin] summary: Test an OIDC issuer description: | Instance admin only. Runs OIDC discovery against the issuer (10 s timeout). A failed discovery is still a 200 with `ok: false`. requestBody: required: true content: application/json: schema: type: object required: [issuer_url] properties: issuer_url: { type: string, description: http(s) URL } responses: '200': description: Discovery result content: application/json: schema: type: object properties: ok: { type: boolean } authorization_endpoint: { type: string } token_endpoint: { type: string } error: { type: string, description: Present when ok is false } '400': { description: issuer_url is not a valid http(s) URL } '403': { $ref: '#/components/responses/Forbidden' } /admin/quotas: get: tags: [Admin] summary: Get the active organization's quotas description: | Instance admin only. Budgets of the caller's ACTIVE organization. Every organization's budgets are listed by `GET /admin/organizations`. responses: '200': description: Quotas content: application/json: schema: type: object properties: organization_id: { type: string, format: uuid } token_budget_monthly: { type: integer, format: int64 } token_budget_session: { type: integer, format: int64 } cost_limit_monthly: { type: number } '403': { $ref: '#/components/responses/Forbidden' } /admin/quotas/{orgID}: parameters: [{ name: orgID, in: path, required: true, schema: { type: string, format: uuid } }] patch: tags: [Admin] summary: Update an organization's budgets description: | Instance admin only. Sets any of the given budgets on the organization; omitted or null fields are left unchanged. A budget of 0 means unlimited; a negative budget is refused with 400 before anything is written. An unknown `orgID` is not reported (nothing is updated). Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object properties: token_budget_monthly: { type: integer, format: int64, minimum: 0, description: 0 = unlimited } token_budget_session: { type: integer, format: int64, minimum: 0, description: 0 = unlimited } cost_limit_monthly: { type: number, minimum: 0, description: 0 = unlimited } responses: '404': { description: Organization not found } '200': description: Updated content: application/json: schema: type: object properties: status: { type: string, enum: [quotas_updated] } '400': { description: 'Invalid body, or a negative budget' } '403': { $ref: '#/components/responses/Forbidden' } /admin/quotas/usage: get: tags: [Admin] summary: List every organization's budget usage description: | Instance admin only. Each organization's usage as its monthly budgets count it, which is what the enforcer compares with `token_budget_monthly` and `cost_limit_monthly`: the last 30 days, or since the organization's last usage reset when that is more recent. Powers the budgets table on the admin Usage tab. responses: '200': description: Budget usage per organization content: application/json: schema: type: object properties: window_days: { type: integer, enum: [30] } organizations: type: array items: type: object properties: organization_id: { type: string, format: uuid } window_start: { type: string, format: date, description: First day counted } since_reset: { type: boolean, description: A usage reset moved window_start later than 30 days ago } tokens: { type: integer, format: int64 } cost_usd: { type: number } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The usage could not be read } /admin/quotas/{orgID}/reset: parameters: [{ name: orgID, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Admin] summary: Reset an organization's budget usage description: | Instance admin only. Restarts the organization's budget window now: the usage it has had so far stops counting against its monthly token budget and cost limit, so an organization that hit a budget can work again from the next model call. The budgets themselves and the usage history (the usage reports and exports) are not changed. The window is a rolling 30 days, so a reset stops mattering 30 days later. Recorded in the audit log. responses: '200': description: Reset content: application/json: schema: type: object properties: status: { type: string, enum: [quotas reset] } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No organization with this id } '500': { description: The reset failed } /admin/graded-runs: get: tags: [Admin] summary: List graded runs description: Instance admin only. Harness graded runs across the deployment, newest first. parameters: - { name: limit, in: query, schema: { type: integer, minimum: 1, default: 20 }, description: Values above 200 are clamped } - { name: build_name, in: query, schema: { type: string } } responses: '200': description: Graded runs content: application/json: schema: type: object properties: count: { type: integer } runs: type: array items: { $ref: '#/components/schemas/GradedRun' } '400': { description: limit must be a positive integer } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Admin] summary: Record a graded run description: Instance admin only. Stores one harness run's grade. Recorded in the audit log unless `run_source` is `nightly`. requestBody: required: true content: application/json: schema: type: object required: [build_name] properties: build_name: { type: string } run_source: { type: string, default: local } workflow_run_id: { type: string } session_id: { type: string, format: uuid } harness_git_sha: { type: string } images_tag: { type: string } primary_provider: { type: string } primary_model: { type: string } final_status: { type: string } invariants_pass: { type: integer, minimum: 0 } invariants_fail: { type: integer, minimum: 0 } invariants_skip: { type: integer, minimum: 0 } score: { type: number, minimum: 0, maximum: 100 } dimensions: { type: object, additionalProperties: true } started_at: { type: string, format: date-time } finished_at: { type: string, format: date-time } responses: '201': description: Recorded content: application/json: schema: type: object properties: id: { type: string, format: uuid } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } /admin/graded-runs/trend: get: tags: [Admin] summary: Graded-run score trend description: | Instance admin only. Compares a build's latest score with the median of up to `window` prior runs; `regressed` is true when the latest score is more than 15% below that median. Needs at least 3 prior runs (otherwise `note` explains and the statistics are omitted). parameters: - { name: build, in: query, required: true, description: Build name (`build_name` is accepted as an alias), schema: { type: string } } - { name: window, in: query, schema: { type: integer, minimum: 1, default: 7 }, description: Values above 100 are clamped } responses: '200': description: Trend content: application/json: schema: type: object properties: build: { type: string } window: { type: integer } count: { type: integer } series: type: array description: Newest first items: type: object properties: score: { type: number } created_at: { type: string, format: date-time } run_source: { type: string } prior_runs: { type: integer } regressed: { type: boolean } latest: { type: number } median_prior: { type: number } threshold: { type: number } latest_delta: { type: number } note: { type: string } '400': { description: "build is required, or window is not a positive integer" } '403': { $ref: '#/components/responses/Forbidden' } /admin/behavior-reviews: get: tags: [Admin] summary: List behavior reviews description: Instance admin only. Agent-behavior reviews across the deployment, newest first. parameters: - { name: limit, in: query, schema: { type: integer, minimum: 1, default: 20 }, description: Values above 200 are clamped } - { name: session_type, in: query, schema: { type: string } } responses: '200': description: Behavior reviews content: application/json: schema: type: object properties: count: { type: integer } reviews: type: array items: { $ref: '#/components/schemas/BehaviorReview' } '400': { description: limit must be a positive integer } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Admin] summary: Grade a session's behavior description: | Instance admin only. Scores one session's agent behavior deterministically from its stored transcript and upserts the review (one per session). The score is computed server-side; `rubric` optionally pins weights and tolerances (omitted fields use the defaults). The session feed gets an `agent_execution_review` event. Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object required: [session_id] properties: session_id: { type: string, format: uuid } build_name: { type: string } run_source: { type: string, default: nightly } graded_by: { type: string, default: deterministic } rubric: { type: object, additionalProperties: true } responses: '201': description: Review stored content: application/json: schema: type: object properties: id: { type: string, format: uuid } session_id: { type: string, format: uuid } score: { type: number } dimensions: { type: object, additionalProperties: true } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Session not found } /admin/audit-log: get: tags: [Admin] summary: List audit-log entries description: | Instance admin only. Audit entries across all organizations, newest first. Entries whose actor no longer exists stay visible. `org_id` matches the entry's own organization stamp, so older unstamped entries appear only unfiltered. Malformed IDs simply match nothing. parameters: - { name: days, in: query, schema: { type: integer, minimum: 1, default: 7 }, description: Values above 365 are clamped } - { name: limit, in: query, schema: { type: integer, minimum: 1, default: 100 }, description: Values above 500 are clamped } - { name: org_id, in: query, schema: { type: string, format: uuid } } - { name: actor, in: query, description: Actor user ID or email (case-insensitive), schema: { type: string } } - { name: action, in: query, description: Case-insensitive substring of the action name, schema: { type: string } } - { name: target_type, in: query, schema: { type: string } } responses: '200': description: Audit log content: application/json: schema: type: object properties: days: { type: integer } entries: type: array items: { $ref: '#/components/schemas/AuditLogEntry' } '403': { $ref: '#/components/responses/Forbidden' } /admin/knowledge/org-report: get: tags: [Admin] summary: Knowledge entries whose organization disagrees with their project's description: | Instance admin only. Knowledge entries of the caller's active organization (by entry or by project) whose organization differs from their project's, newest first, capped at 500 (`truncated` is true at the cap). Such rows would be hidden by the organization read filter. responses: '200': description: Mismatched knowledge entries content: application/json: schema: type: object properties: count: { type: integer } truncated: { type: boolean } mismatches: type: array items: { $ref: '#/components/schemas/KnowledgeOrgReportEntry' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Database is unavailable } /admin/llm-costs/daily: get: tags: [Admin] summary: Daily LLM cost breakdown description: | Instance admin only. Cost, tokens and calls per day, provider and model across all organizations, newest day first. Reads the raw per-call log, which is pruned after `CRIOS_LLM_TRANSCRIPT_RETENTION_DAYS` (default 14), so older days come back empty; the usage console keeps durable totals. parameters: - { name: days, in: query, schema: { type: integer, minimum: 1, default: 30 }, description: Values above 365 are clamped } responses: '200': description: Daily costs content: application/json: schema: type: object properties: days: { type: integer } count: { type: integer } rows: type: array items: type: object properties: day: { type: string, description: YYYY-MM-DD } provider: { type: string } model: { type: string } cost_usd: { type: number } input_tokens: { type: integer, format: int64 } output_tokens: { type: integer, format: int64 } cached_input_tokens: { type: integer, format: int64 } calls: { type: integer, format: int64 } '400': { description: days must be a positive integer } '403': { $ref: '#/components/responses/Forbidden' } /admin/sessions/{id}/outcome: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Admin] summary: Get a session's labeled outcome description: Instance admin only. Scoped to sessions of the caller's active organization. responses: '200': description: Outcome content: application/json: schema: { $ref: '#/components/schemas/SessionOutcome' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No outcome recorded } post: tags: [Admin] summary: Label a session's outcome description: | Instance admin only. Records (or replaces) the outcome label used by the cost-per-ship KPI. The session must belong to a project of the caller's active organization. Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object required: [outcome] properties: outcome: { type: string, enum: [shipped, abandoned, dev, unknown], description: Case-insensitive } evidence_type: { type: string } evidence_ref: { type: string } responses: '200': description: Recorded content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } outcome: { type: string, enum: [shipped, abandoned, dev, unknown] } evidence_type: { type: string } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Session not found in the active organization } /admin/kpi/cost-per-ship: get: tags: [Admin] summary: Cost-per-shipped-feature KPI rollup description: | Instance admin only. For the caller's active organization, counts the sessions created in the last `days` days by outcome label (unlabeled sessions count as `unknown`), sums their cost, and divides shipped cost by shipped sessions. parameters: - { name: days, in: query, description: Out-of-range values fall back to 30, schema: { type: integer, minimum: 1, maximum: 365, default: 30 } } responses: '200': description: KPI rollup content: application/json: schema: type: object properties: days: { type: integer } shipped_sessions: { type: integer } abandoned_sessions: { type: integer } dev_sessions: { type: integer } unknown_sessions: { type: integer } shipped_cost_usd: { type: number } abandoned_cost_usd: { type: number } unknown_cost_usd: { type: number } cost_per_ship_usd: { type: number, description: 0 when nothing shipped } '403': { $ref: '#/components/responses/Forbidden' } /admin/users: get: tags: [Admin] summary: List users description: | Instance admin only. Every user account on the deployment, paginated, with each user's memberships across organizations. `organization_id` and `role` describe the user's ACTIVE organization. parameters: - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 200, default: 50 }, description: Values above 200 are clamped } - { name: offset, in: query, schema: { type: integer, minimum: 0, default: 0 } } - { name: q, in: query, description: Case-insensitive substring match on name or email, schema: { type: string } } - { name: role, in: query, description: Role in the user's active organization, schema: { type: string, enum: [owner, admin, member, viewer] } } - { name: status, in: query, schema: { type: string, enum: [active, suspended] } } - { name: org_id, in: query, description: "Only users who are members of this organization (any membership, not just the active one)", schema: { type: string, format: uuid } } - { name: sort, in: query, schema: { type: string, enum: [created_at, last_login_at, name, email, role], default: created_at } } - { name: order, in: query, schema: { type: string, enum: [asc, desc], default: desc } } responses: '200': description: Users page content: application/json: schema: type: object properties: users: type: array items: { $ref: '#/components/schemas/AdminUser' } total: { type: integer, description: Total users matching the filters } limit: { type: integer } offset: { type: integer } '400': { description: "Invalid role, status, sort or order value" } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Admin] summary: Create a user description: | Instance admin only. Creates an account plus its membership in the given organization (default: the caller's active organization). The password must pass the strength check. The organization's member limit is not checked here. Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object required: [email, password] properties: email: { type: string, format: email } password: { type: string, format: password } first_name: { type: string, maxLength: 100 } last_name: { type: string, maxLength: 100 } name: { type: string, description: "Display name; derived from first/last name when those are given, else the email" } organization_id: { type: string, format: uuid, description: Defaults to the caller's active organization } role: { type: string, enum: [owner, admin, member, viewer], default: member } responses: '201': description: Created content: application/json: schema: type: object properties: id: { type: string, format: uuid } email: { type: string } name: { type: string } first_name: { type: string } last_name: { type: string } organization_id: { type: string, format: uuid } role: { type: string, enum: [owner, admin, member, viewer] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Organization not found } '409': { description: A user with this email already exists } /admin/users/{id}: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] patch: tags: [Admin] summary: Update a user description: | Instance admin only. Partial update of profile fields, email, role and password. `role` changes the role in the user's ACTIVE organization (manage other memberships with `/admin/organizations/{id}/members`); you cannot change your own role, and the last owner cannot be demoted. `first_name`/`last_name` rebuild the display name and take precedence over `name`. A new password must pass the strength check and triggers a password-changed email when mail is configured. Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object properties: name: { type: string, minLength: 1, maxLength: 255 } first_name: { type: string, maxLength: 100 } last_name: { type: string, maxLength: 100 } email: { type: string, format: email } role: { type: string, enum: [owner, admin, member, viewer] } password: { type: string, format: password } responses: '200': description: Updated, or nothing to change content: application/json: schema: type: object properties: status: { type: string, enum: [updated, no changes] } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: "Not an instance admin, or changing your own role" } '404': { $ref: '#/components/responses/NotFound' } '409': { description: "Email already in use, the user has no active organization, or demoting the only owner" } delete: tags: [Admin] summary: Delete a user description: | Instance admin only. Deletes the account and all its memberships. You cannot delete yourself. Playbooks, playbook versions, knowledge entries and prompt versions the user wrote, and the project skill overrides they set, are kept with their author cleared (`null`). The delete is refused only while a record that must keep the user still references them, such as an organization's accepted license terms (suspend instead). Recorded in the audit log. responses: '204': { description: Deleted } '403': { description: "Not an instance admin, or deleting your own account" } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'A record that must keep the user, such as accepted license terms, still references them' } /admin/users/{id}/suspend: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Admin] summary: Suspend a user description: | Instance admin only. Requests with the account's tokens are refused (at once on the replica that handled the call, within a short cache TTL on others). You cannot suspend yourself. Recorded in the audit log. responses: '200': description: Suspended content: application/json: schema: type: object properties: status: { type: string, enum: [user suspended] } '403': { description: "Not an instance admin, or suspending your own account" } '404': { $ref: '#/components/responses/NotFound' } /admin/users/{id}/unsuspend: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Admin] summary: Unsuspend a user description: Instance admin only. Recorded in the audit log. responses: '200': description: Unsuspended content: application/json: schema: type: object properties: status: { type: string, enum: [user unsuspended] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /admin/users/{id}/reset-totp: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [Admin] summary: Reset a user's MFA description: | Instance admin only. Clears the user's TOTP secret and backup codes so they can enrol again. Recorded in the audit log. responses: '200': description: Reset content: application/json: schema: type: object properties: status: { type: string, enum: [mfa reset] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /admin/organizations: get: tags: [Admin] summary: List organizations description: Instance admin only. Every organization with its limits and member count, ordered by name. responses: '200': description: Organizations content: application/json: schema: type: object properties: organizations: type: array items: { $ref: '#/components/schemas/AdminOrganization' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Admin] summary: Create an organization description: | Instance admin only. Creates an organization, seeds its default LLM providers, catalog and routing, and applies the optional limits. The slug is derived from the name when omitted (a random suffix is added on collision); an explicit slug must be lowercase letters, digits and dashes. There is no hard delete; suspend instead. Recorded in the audit log. With the Team Playbook's default for new organizations on (`PUT /admin/org-agents/default`), the organization starts with the Team Playbook on, and its `org.create` audit entry says why (`org_agents_by: "new_orgs_default"`). The request can't choose otherwise: an admin who wants it off turns it off after. requestBody: required: true content: application/json: schema: allOf: - $ref: '#/components/schemas/AdminOrgLimits' - type: object required: [name] properties: name: { type: string, minLength: 1, maxLength: 255 } slug: { type: string, maxLength: 100 } responses: '201': description: Created content: application/json: schema: type: object properties: id: { type: string, format: uuid } name: { type: string } slug: { type: string } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: An organization with this slug already exists } '500': { description: "Creation failed, or the organization was created but seeding defaults or applying limits failed" } /admin/secrets/integrations/{name}: parameters: [{ name: name, in: path, required: true, schema: { type: string } }] get: tags: [Admin] summary: Get a legacy integration secret (masked) description: | Instance admin only. Reads the pre-multi-org, instance-wide secret document `crios/{name}`. Per-organization connector settings live under `/organizations/{id}/connectors`; the legacy documents only serve as fallback for the oldest organization. Values are masked except non-secret keys (app_id, installation_id, email, oauth2_id, provider). The `path` query parameter overrides `{name}` for operator cleanup of other legacy documents. parameters: - { name: path, in: query, description: "Explicit document path. Allowed: crios/{github|gitlab|slack|jira|gitea}, crios/cas/{zerossl|google-public-ca}, crios/providers/{provider slug} (legacy instance provider keys)", schema: { type: string } } responses: '200': description: Masked secret document content: application/json: schema: { type: object, additionalProperties: true } '400': { description: "Unknown integration, or a disallowed path" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Secret not found } '503': { description: Vault is not configured } put: tags: [Admin] summary: Set a legacy integration secret description: | Instance admin only. Writes the whole instance-wide document `crios/{name}` (or the `path` override) and reloads that connector's legacy settings in running handlers. Recorded in the audit log. parameters: - { name: path, in: query, description: Explicit document path (same allow-list as GET), schema: { type: string } } requestBody: required: true content: application/json: schema: type: object description: Document fields; shape varies by integration. additionalProperties: true responses: '200': description: Stored content: application/json: schema: type: object properties: status: { type: string, enum: [ok] } '400': { description: "Invalid body, unknown integration, or a disallowed path" } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Vault is not configured } delete: tags: [Admin] summary: Delete a legacy integration secret description: Instance admin only. Deletes the instance-wide document (or the `path` override) and reloads the connector. Recorded in the audit log. parameters: - { name: path, in: query, description: Explicit document path (same allow-list as GET), schema: { type: string } } responses: '204': { description: Deleted } '400': { description: "Unknown integration, or a disallowed path" } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Vault is not configured } /admin/secrets/health: get: tags: [Admin] summary: Check Vault health description: Instance admin only. responses: '200': description: Vault reachable content: application/json: schema: type: object properties: status: { type: string, enum: [healthy] } vault: { type: string, enum: [connected] } '403': { $ref: '#/components/responses/Forbidden' } '503': description: Vault not configured or unreachable content: application/json: schema: type: object properties: status: { type: string, enum: [unhealthy] } error: { type: string } # ==================== MEMBER-PLANE ADDITIONS ==================== /auth/forgot: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Start a self-service password reset description: | Sends a password-reset link when the email maps to a claimable local (password) account. Never reveals whether an account exists: whenever mail is configured it returns the same 200 body regardless of outcome. Returns 503 only when email is unconfigured deployment-wide. Rate-limited by the strict auth limiter. security: [] requestBody: required: true content: application/json: schema: type: object required: [email] properties: email: { type: string, format: email } responses: '200': description: Accepted (identical body whether or not the account exists) content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '400': { $ref: '#/components/responses/BadRequest' } '503': description: Email is not configured on this deployment content: application/json: schema: { $ref: '#/components/schemas/Error' } /auth/reset: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Complete a password reset description: | Burns the single-use reset token, sets the new password, revokes every existing refresh token, and marks the account email-verified. Unknown, already-used, expired, or wrong-purpose tokens all return a generic 400. security: [] requestBody: required: true content: application/json: schema: type: object required: [token, password] properties: token: { type: string, description: Single-use reset token from the emailed link } password: { type: string, format: password, description: New password (strength-validated) } responses: '200': description: Password reset content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '400': { $ref: '#/components/responses/BadRequest' } '500': { description: Failed to reset password } /auth/verify-email: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Verify an email address description: | Burns a single-use "verify" token and marks the account's email address confirmed. Public (the click arrives before any session). Unknown, used, or expired tokens return a generic 400 without revealing which. security: [] requestBody: required: true content: application/json: schema: type: object required: [token] properties: token: { type: string, description: Single-use verification token from the emailed link } responses: '200': description: Email verified content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '400': { $ref: '#/components/responses/BadRequest' } '500': { description: Failed to verify email } # ==================== USERS: EMAIL VERIFICATION ==================== /users/me/resend-verification: post: tags: [Users] summary: Resend the email-verification link description: | Re-sends the confirmation link to the authenticated user (the soft banner's "Resend" button). Idempotent when already verified; 503 when mail is unconfigured (new signups are then auto-verified). Viewers may call it. Personal API tokens and sandbox tokens get 403. Shares the strict auth rate limiter (10 requests per minute per client IP). responses: '200': description: Verification email sent (or already verified) content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '429': { description: 'Rate limit exceeded; the body also carries retry_after', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to send the verification email } '503': description: Email is not configured on this deployment content: application/json: schema: { $ref: '#/components/schemas/Error' } # ==================== USERS: PERSONAL API TOKENS ==================== # The token-scope middleware denies this surface to PAT-authenticated # callers: tokens must not mint or manage tokens. /users/me/api-tokens: get: tags: [Users] summary: List the caller's personal API tokens description: | The caller's tokens in the active organization, newest first. Revoked tokens are included (rendered greyed out so a revocation is visible, not silent). Tokens pinned to another organization stay hidden until the user switches back to it. Personal API tokens and sandbox tokens get 403, even for this read. responses: '200': description: Tokens content: application/json: schema: type: object properties: tokens: type: array items: { $ref: '#/components/schemas/APIToken' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to list API tokens } post: tags: [Users] summary: Create a personal API token description: | Mints a new token for the caller, pinned to the caller's active organization: the token keeps acting in that organization with the owner's role there, whatever organization the UI switches to later. The full secret appears exactly once, in this response; only its hash is stored. At most 25 active (unrevoked, unexpired) tokens per user. Scopes are either exactly ["*"] or a non-empty subset of ":read"/":write" atoms (write implies read) for resources: sessions, projects, memory, llm, sandboxes, integrations, costs, organization, admin. Full access ("*") never includes the admin API, and no token can manage account credentials or other tokens. An optional project_id binds the token to one project the caller can access. Viewers may create tokens; personal API tokens and sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [name, scopes] properties: name: { type: string, maxLength: 100, description: Trimmed; must not be empty } scopes: type: array items: { type: string } description: '["*"] or fine-grained ":read|write" atoms' project_id: { type: string, format: uuid, description: Optional project binding } expires_in_days: { type: integer, minimum: 0, maximum: 730, description: 'Days until expiry; omit or 0 for a non-expiring token' } responses: '201': description: Created; the only response that ever contains the secret content: application/json: schema: type: object properties: token: { type: string, description: 'Full secret ("crios_pat_..."); shown exactly once' } id: { type: string, format: uuid } name: { type: string } token_prefix: { type: string } scopes: { type: array, items: { type: string } } project_id: { type: string, description: Empty string when org-wide } expires_at: { type: string, format: date-time, nullable: true } created_at: { type: string, format: date-time } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'No active organization, or the caller is a personal API token or sandbox token', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { description: Bound project not found (or not accessible) } '409': { description: Token limit reached (25 active tokens) } '500': { description: Failed to create the API token } /users/me/api-tokens/{id}: parameters: - { name: id, in: path, required: true, description: Token ID, schema: { type: string, format: uuid } } delete: tags: [Users] summary: Revoke a personal API token description: Soft-deletes one of the caller's tokens. Unknown ids and other users' tokens both return 404 so token ids cannot be probed. responses: '204': { description: Revoked } '404': { $ref: '#/components/responses/NotFound' } /users/me/token: get: tags: [Users] summary: Describe the presented token description: | The presented credential's own metadata, for any kind of token: what the Crios MCP server's verifier reads instead of `/users/me`, which reports the user's active organization and role while a token stays pinned to the organization it was minted in. For a personal access token or an OAuth access token the fields come from its token row; for a JWT (a browser session, or a sandbox's token) from its claims, with `kind` `jwt`, `scopes` `["*"]` and `token_kind`. `connected_app` says whether the orchestrator treated this very request as an app connected through the Crios MCP server: always for an OAuth token; for a personal access token or a browser token only when the request carries `X-Crios-MCP-Gateway` with the orchestrator's own gateway secret (a secret under 32 characters is never matched); never for a sandbox token. A header the orchestrator does not recognise is ignored without an error, and the token then counts as a plain script's, outside the connected-app rules. The MCP server sends its header on this call too, and its skill draft tools save only when it answers `true`; they then send the save with `X-Crios-Require-Connected-App: 1`, so a secret that changes after this answer refuses the save (403 `connected_app_not_recognised`) rather than letting it through as a script's. This call itself never carries that header. Answered with `Cache-Control: no-store`. responses: '200': description: The token's metadata content: application/json: schema: type: object properties: kind: { type: string, enum: [pat, oauth, jwt] } user: type: object properties: id: { type: string, format: uuid } email: { type: string } organization_id: { type: string, format: uuid } role: { type: string } scopes: { type: array, items: { type: string }, description: 'The token''s scopes; ["*"] for a JWT' } project_id: { type: string, format: uuid, nullable: true, description: The project the token is bound to; null when it is not bound } organization_id: { type: string, format: uuid, description: The organization the token acts in } expires_at: { type: string, format: date-time, nullable: true } connected_app: { type: boolean, description: 'Whether this request reached the API as an app connected through the Crios MCP server (an OAuth token, or a personal access token or browser token with a recognised gateway header). Always present' } client_id: { type: string, description: 'kind oauth: the OAuth client' } grant_id: { type: string, description: 'kind oauth: the consent the token was issued under' } resource: { type: string, description: 'kind oauth: the resource the token was issued for' } token_kind: { type: string, description: 'kind jwt: "" for a browser session, sandbox for a sandbox''s token' } '401': description: Not authenticated, or an unknown or revoked token (`invalid token`) content: application/json: schema: { $ref: '#/components/schemas/Error' } '500': { description: The token could not be read } # ==================== LICENSING ==================== /license/status: get: tags: [Licensing] summary: Get license status description: | Readable by any authenticated user: powers the grace banner and the blocking renew modal. Derived fields only — the raw license key never leaves the server. Payload-derived fields (lid, edition, org_name, customer, features, limits, expires_at, grace_until) are present only when a license payload is loaded; features is additionally omitted when the license carries no explicit feature list (enterprise edition implies every feature); grace_days_left only in state=grace; fingerprint only when available. responses: '200': description: License status content: application/json: schema: { $ref: '#/components/schemas/LicenseStatus' } '503': { description: Licensing not initialized } # ==================== LLM: MEMBER MODEL CATALOG ==================== /llm/models: get: tags: [LLM] summary: List the allowed model catalog description: | Flat list of allowed models across all providers — the non-admin counterpart of the admin catalog endpoints, used by the project settings UI to populate its model pickers. Per-model price fields are present only when a price is resolvable; approximate (slug-matched) prices are flagged so the UI can mark them. responses: '200': description: Model catalog content: application/json: schema: type: object properties: models: type: array items: { $ref: '#/components/schemas/ModelOption' } '503': { description: Model router is not configured } # ==================== INTEGRATIONS + CONNECTORS (member) ==================== /integrations/status: get: tags: [Integrations] summary: Report which agent-facing integrations are configured description: | Booleans only, never secrets. The sandbox agent calls it at boot to decide whether to offer its `jira`, `slack_notify` and `gmail_*` tools. `jira` and `slack` reflect the organization's connectors; with `project_id` (a project of the caller's organization the caller may read: viewer access or better, and for a sandbox token its own project; any other is ignored), `jira` is also true when the project has a hub Jira mapping, and `slack` when it has a linked, enabled hub Slack install, the account `slack_notify` posts through first. `gmail` is per user: true when the caller (for a sandbox token, the session owner) has a connected Gmail account. The proxies stay the call-time authority. parameters: - { name: project_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Per-integration flags content: application/json: schema: type: object properties: jira: { type: boolean } slack: { type: boolean } gmail: { type: boolean } '401': { $ref: '#/components/responses/Unauthorized' } /connectors/available: get: tags: [Connectors] summary: Report which repository providers are available for project creation description: | Booleans only (never secrets). Member-facing: every writer can create a project, and the New Project form needs this to decide which repository kinds to offer. Gitea is the always-on built-in, so always true. responses: '200': description: Per-provider availability flags content: application/json: schema: type: object properties: github: { type: boolean } gitlab: { type: boolean } gitea: { type: boolean } /connectors/github/app/created: get: tags: [Connectors] summary: GitHub App manifest-created redirect (browser callback) description: | GitHub redirects the organization admin's browser here after the App is created from the manifest (started with POST /organizations/{id}/connectors/github/app/manifest). Public: no bearer token survives the cross-site redirect. The HMAC-signed `state` (stage-bound, 15 minutes) names the organization, and the App credentials (App id, private key, webhook secret, bot login) are stored in that organization's GitHub connector, clearing any installation id (an installation belongs to one App). On success it redirects to the App's installation page with a new signed state naming the App; on any failure to `/organization?tab=connectors&github=error`. Rate-limited per client IP. security: [] parameters: - { name: code, in: query, required: true, schema: { type: string }, description: One-time manifest-conversion code from GitHub } - { name: state, in: query, required: true, schema: { type: string }, description: Signed state minted when the flow started } responses: '302': { description: 'Redirect to github.com/apps//installations/new (success), or to /organization?tab=connectors&github=error' } /connectors/github/app/installed: get: tags: [Connectors] summary: GitHub App installed redirect (browser callback) description: | GitHub redirects the browser here after the App is installed and repositories are picked. Public, with the same signed `state` guard (stage `installed`). `setup_action=request` (the installer asked an owner of the GitHub account to approve; GitHub sends no installation id) is checked first and redirects with `github=pending`: the installation webhook stores the installation once an owner approves. Otherwise it stores the installation id in the organization's GitHub connector, only while that still holds the App the state names, and redirects to `/organization?tab=connectors&github=connected`. When another connect stored a newer App meanwhile, nothing is stored and it redirects with `github=replaced`. A redirect without a state (an install made on github.com, such as an owner approving a request) or an unverified `setup_action=update` lands on the connectors tab without a status; a bad state or storage failure with `github=error`. security: [] parameters: - { name: installation_id, in: query, schema: { type: string }, description: Absent when setup_action is request } - { name: setup_action, in: query, schema: { type: string }, description: '"install", "update", or "request" when an owner of the GitHub account still has to approve the installation' } - { name: state, in: query, schema: { type: string } } responses: '302': { description: 'Redirect to /organization?tab=connectors&github=connected|pending|replaced|error, or to /organization?tab=connectors' } /connectors/gitlab/repos: get: tags: [Connectors] summary: List GitLab projects visible to the shared connection description: | For the project repo picker; mirrors the GitHub repos endpoint (same per-item JSON shape, same callers: members, admins and owners). Lists projects the shared token is a member of, most-recently-active first, capped at 300. A failure names the status GitLab answered with, never GitLab's answer. responses: '200': description: Repos content: application/json: schema: type: object properties: repos: type: array items: { $ref: '#/components/schemas/ConnectorRepo' } count: { type: integer } '403': { description: 'A viewer, or a session (sandbox) token' } '409': { description: GitLab not connected } '502': { description: Upstream GitLab listing failed } # ==================== PLAYBOOK SUGGESTIONS: EFFECTIVENESS ==================== /playbook-suggestions/effectiveness: get: tags: [Playbooks] summary: Playbook-effectiveness dashboard description: | For every live playbook that has been injected into at least one session: applied reach, ship/abandon/fail outcome split, and the failure count before vs after the rule entered the prompt — with a helping/dead/inconclusive verdict so an operator can prune dead-weight rules. Always org-scoped from the request context. parameters: - { name: days, in: query, schema: { type: string, default: '30' }, description: 'Window in days (max 365); "all" or "0" = all time' } - { name: project_id, in: query, schema: { type: string, format: uuid }, description: Narrow to one project } responses: '200': description: Effectiveness rows content: application/json: schema: type: object properties: window_days: { type: integer, description: Effective window (0 = all time) } playbooks: type: array items: { $ref: '#/components/schemas/PlaybookEffectiveness' } '400': { $ref: '#/components/responses/BadRequest' } '500': { description: Failed to compute playbook effectiveness } # ==================== PROJECTS: AGENT PROFILES / ENV VARS / SHARES ==================== /projects/{id}/agent-profiles: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Projects] summary: List selectable agent profiles for a project description: | The active agent profiles a session creator may pin for this project (organization-wide plus this project's own). Agent profiles are skills of type `agent_profile`, managed through the Skills API. The lean per-profile shape never includes the system prompt. Requires project viewer access. responses: '200': description: Selectable profiles content: application/json: schema: type: object properties: profiles: type: array items: { $ref: '#/components/schemas/SelectableAgentProfile' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/env-vars: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Projects] summary: List a project's environment variables description: | Values are stored in Vault and injected into sandbox pods at launch and into the project's published apps. Sensitive variables are write-only: their value is omitted on responses. Sandbox tokens are rejected (403). Requires project editor access. responses: '200': description: Environment variables (sensitive values omitted) content: application/json: schema: type: object properties: env_vars: type: array items: { $ref: '#/components/schemas/ProjectEnvVar' } '403': { description: "Below project editor access, or a sandbox token" } '404': { description: Project not found or deleted } '503': { description: Secret storage is not enabled or unavailable } put: tags: [Projects] summary: Replace a project's environment variables description: | Wholesale replace: at most 100 variables, names unique and matching `[A-Za-z_][A-Za-z0-9_]*` (max 128 characters), values up to 32 KB. Sensitive values are write-only: an empty value on a sensitive variable keeps the stored one, a new sensitive variable needs a value, and turning a sensitive variable visible needs a fresh value. Saving also provisions sandbox read access and pushes the new values to the project's live publications, whose pods roll onto them without a republish. Sandbox tokens are rejected (403). Requires project editor access. requestBody: required: true content: application/json: schema: type: object properties: env_vars: type: array maxItems: 100 items: { $ref: '#/components/schemas/ProjectEnvVar' } responses: '200': description: Stored variables (sensitive values omitted) content: application/json: schema: type: object properties: env_vars: type: array items: { $ref: '#/components/schemas/ProjectEnvVar' } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: "Below project editor access, or a sandbox token" } '404': { description: Project not found or deleted } '500': { description: "Variables stored, but provisioning sandbox access failed; retry saving" } '503': { description: Secret storage is not enabled or unavailable } /projects/{id}/shares: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Projects] summary: List a project's shares description: | Share rows (user or group grants), enriched with user and group display fields. Requires project manage access (project owner or org owner/admin), like every route under /shares. responses: '200': description: Shares content: application/json: schema: type: object properties: shares: type: array items: { $ref: '#/components/schemas/ProjectShare' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Projects] summary: Share a project with a user or group description: | Grants a user or group (exactly one of user_id/group_id) viewer or editor access. Sharing an existing target again updates its role in place. The target must belong to the project's organization, and the project owner cannot be a target (400). Sandbox tokens cannot modify shares (403). Requires project manage access (project owner or org owner/admin). requestBody: required: true content: application/json: schema: type: object required: [role] properties: user_id: { type: string, format: uuid, description: Exactly one of user_id or group_id } group_id: { type: string, format: uuid, description: Exactly one of user_id or group_id } role: { type: string, enum: [viewer, editor] } responses: '201': description: Share created (or role updated in place) content: application/json: schema: type: object properties: id: { type: string, format: uuid } role: { type: string, enum: [viewer, editor] } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: "Below project manage access, or a sandbox token" } '404': { description: "Project, or target user/group, not found in organization" } /projects/{id}/shares/{shareID}: parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: shareID, in: path, required: true, schema: { type: string, format: uuid } } patch: tags: [Projects] summary: Change a share's role description: Sandbox tokens cannot modify shares (403). Requires project manage access (project owner or org owner/admin). requestBody: required: true content: application/json: schema: type: object required: [role] properties: role: { type: string, enum: [viewer, editor] } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: "Below project manage access, or a sandbox token" } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Projects] summary: Revoke a share description: | In-flight sessions started by the revoked user survive; new access stops here. Sandbox tokens cannot modify shares (403). Requires project manage access (project owner or org owner/admin). responses: '204': { description: Removed } '403': { description: "Below project manage access, or a sandbox token" } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/org-agents-consent: parameters: [{ $ref: '#/components/parameters/ProjectId' }] put: tags: [Projects] summary: Let the Team Playbook learn from what the caller writes in a project description: | Records the caller's own consent: the Team Playbook may read the project's sessions the caller wrote in, each once everyone else who wrote in it has a consent that counts too. It covers the caller's words alone, never anyone else's, an organization admin's included. Everyone who can open the project reaches it (project viewer access), and a consent counts only while its person can. A consent the caller gave already answers the same again. A session's token and a connected app are refused (403). Audited (`project.org_agents_consent.grant`) when the consent is new. responses: '200': description: The caller's consent content: application/json: schema: type: object properties: org_agents_consent: { $ref: '#/components/schemas/OrgAgentsConsent' } disabled_agents: { type: integer, enum: [0], description: 'Always 0: a consent disables nothing (both writes answer one shape)' } narrowed_agents: { type: integer, enum: [0], description: 'Always 0: a consent narrows nothing' } '403': { description: 'A session''s token, a connected app, or a personal access token without `projects:write` or bound to another project (`{"error"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The organization has the Team Playbook off (`{"error", "code": "org_agents_off"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'Recording the consent failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } delete: tags: [Projects] summary: Stop the Team Playbook learning from what the caller writes in a project description: | Withdraws the caller's own consent, never anyone else's, then runs the Team Playbook's privacy sweep: it takes out of every enabled playbook of the organization what was learned from a session it may no longer read, and turns a playbook off where that can't be separated. Never refused for the organization's Team Playbook flag, and 200 when the caller had no consent too (the sweep runs anyway). A session's token and a connected app are refused (403). Audited (`project.org_agents_consent.revoke`) when a consent was withdrawn. responses: '200': description: The caller's consent, withdrawn content: application/json: schema: type: object properties: org_agents_consent: { $ref: '#/components/schemas/OrgAgentsConsent' } disabled_agents: { type: integer, minimum: 0, description: "Every playbook the privacy sweep disabled in the organization, 0 included: not only those that learned from this project or from the caller's words. A playbook the sweep kept on, on a version without the affected items, is counted in narrowed_agents instead" } narrowed_agents: { type: integer, minimum: 0, description: "Every playbook the privacy sweep kept on in the organization, on a version without what it learned from a session it may no longer read, 0 included: not only those that learned from this project or from the caller's words" } '403': { description: 'A session''s token, a connected app, or a personal access token without `projects:write` or bound to another project (`{"error"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { $ref: '#/components/responses/NotFound' } '500': { description: 'Withdrawing the consent failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'The withdrawal stands, but the privacy sweep failed; withdraw again to finish it. Or this installation can''t run the Team Playbook, and nothing was withdrawn. Both `{"error", "code": "org_agents_unavailable"}`', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } # ==================== PUBLISHING ==================== # One publication per project. publish/republish/unpublish are manage-gated # by EnforceProjectAccess; reading the publication is viewer-gated. Sandbox # tokens cannot publish, republish or unpublish. /projects/{id}/publish: parameters: [{ $ref: '#/components/parameters/ProjectId' }] post: tags: [Publishing] summary: Publish a project to a custom domain description: | Deploys the head of the project's default branch behind `domain` and creates (or resets) the project's single publication. Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot publish (403). The server picks the path: - The repository commits a conforming publish manifest and chart (`deploy/crios-publish.yaml`): those assets are deployed as-is. - The stack is recognized: the app is deployed on the platform-owned chart (`fast_path: true`). - Otherwise a headless publishing agent session prepares the deploy assets (status `planning`, `publish_session_id` set). Only this path counts against the org's active-session cap (429). The first two paths start no session: the status goes straight to `building`, and a failure to create the deployment returns 502. `domain` must be a bare DNS name (at most 253 characters, at least two labels, no scheme, port or path) that no other project's active publication uses. The optional `password` gates the published site; publishing again without it keeps existing protection, and a new password signs out existing visitors. A new publication starts on the organization's default certificate authority; so does a publication that was unpublished while on a custom certificate, which was removed with the app. requestBody: required: true content: application/json: schema: type: object required: [domain] properties: domain: { type: string, maxLength: 253, description: 'Bare DNS name like app.example.com; lowercased, a trailing dot is dropped' } password: { type: string, format: password, minLength: 8, maxLength: 128, description: Optional site password (publish gate) } responses: '201': description: Publication created or reset; the deployment or the publishing session has started content: application/json: schema: { $ref: '#/components/schemas/Publication' } '400': { description: "Invalid body, domain or password; password protection is not configured on this deployment; the project type (CLI, mobile, library, ...) cannot be published as a web app; or the project has no repository yet" } '403': { description: Requires project manage access; sandbox tokens cannot publish } '404': { description: Project not found (or deleted) } '409': { description: "Domain already used by another publication, or a publish is already in progress" } '429': { description: "Too many active sessions in the org (agent-session path only); the body carries error, details, active and limit" } '502': { description: Could not create the deployment in the cluster (session-less paths) } /projects/{id}/publication: parameters: [{ $ref: '#/components/parameters/ProjectId' }] get: tags: [Publishing] summary: Get a project's publication description: | Requires project viewer access. For a `live` publication the response also carries `head_revision` and `update_available` (whether publishing again would ship changes); both are omitted when the repository cannot be checked within a few seconds. A publication stuck in `planning` or `generating` whose publishing session has already failed or been cancelled is settled to `failed` by this read. responses: '200': description: Publication content: application/json: schema: { $ref: '#/components/schemas/Publication' } '404': { description: "Project not found, or no publication for this project" } patch: tags: [Publishing] summary: Update a publication's domain or site password description: | Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot change a publication (403). At least one of `domain`, `password` and `remove_password` is required; `password` and `remove_password` are mutually exclusive. A new domain is pushed to the running deployment, and a publication that was `awaiting_dns`, `issuing_cert` or `live` returns to `awaiting_dns` (with `url` cleared) until DNS for the new name resolves and a certificate is issued. Password changes need no republish: the server that handles the request drops the domain from its site-gate cache, so the change applies there on the next request, and other servers pick it up within about 10 seconds. A new password signs out visitors who entered the old one. requestBody: required: true content: application/json: schema: type: object properties: domain: { type: string, maxLength: 253, description: New bare DNS name } password: { type: string, format: password, minLength: 8, maxLength: 128 } remove_password: { type: boolean } responses: '200': description: Updated publication content: application/json: schema: { $ref: '#/components/schemas/Publication' } '400': { description: "Invalid body, domain or password; nothing to update; password and remove_password together; or password protection is not configured on this deployment" } '403': { description: Requires project manage access; sandbox tokens cannot change a publication } '404': { description: "Project not found, or no publication for this project" } '409': { description: "Publication is unpublished (publish again to change it), or the domain is already used by another publication" } delete: tags: [Publishing] summary: Unpublish a project description: | Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot unpublish (403). Removes the deployed app from the cluster, marks the publication `unpublished` (clearing `url`, `lb_ips` and `conditions`) and cancels a publishing session that is still running, so this also stops a stuck publish. The domain is released for other projects. Idempotent: an already unpublished publication is returned unchanged. If the app cannot be removed from the cluster, nothing changes (502). responses: '200': description: Publication marked unpublished (not 204) content: application/json: schema: { $ref: '#/components/schemas/Publication' } '403': { description: Requires project manage access; sandbox tokens cannot unpublish } '404': { description: "Project not found, or no publication for this project" } '502': { description: 'Could not remove the deployed app from the cluster; nothing was changed, retry' } /projects/{id}/publication/republish: parameters: [{ $ref: '#/components/parameters/ProjectId' }] post: tags: [Publishing] summary: Republish at HEAD description: | Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot republish (403). Redeploys the head of the default branch with the stored domain and slug. A `fast_path` publication is re-detected (or its committed chart re-adopted) and redeployed without an agent session (502 when the stack can no longer be detected or the deployment cannot be created). Any other publication gets a new publishing session (status `planning`) that counts against the org's active-session cap; after a failure, the stored error is handed to that session to fix. Rejected while a publish is in progress, after an unpublish (publish again instead), and when the project has since been found unpublishable. responses: '200': description: Republish started; updated publication content: application/json: schema: { $ref: '#/components/schemas/Publication' } '400': { description: "The project type (CLI, mobile, library, ...) cannot be published as a web app" } '403': { description: Requires project manage access; sandbox tokens cannot republish } '404': { description: "Project not found (or deleted), or no publication for this project" } '409': { description: "A publish is already in progress, the publication was unpublished, or it changed state during the request (retry)" } '429': { description: "Too many active sessions in the org (agent-session path only)" } '502': { description: "Fast-path publication: the stack could not be re-detected, or the deployment could not be created" } # ==================== SESSION ARTIFACTS + PREVIEW ==================== /sessions/{id}/artifacts: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: List a session's artifacts description: Artifact metadata in created_at order. Bytes are lazy-loaded via each artifact's data_url/preview_url — never inlined. responses: '200': description: Artifacts content: application/json: schema: type: object properties: artifacts: type: array items: { $ref: '#/components/schemas/SessionArtifact' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Sessions] summary: Publish an agent deliverable artifact description: | The sandbox POSTs generated files (charts, XLSX, PDFs, diagrams) back to the orchestrator, which stores the bytes (max 25MB) and emits a metadata-only artifact_created feed event. Called by crios-agent with the session owner's access token — same auth as attachment uploads. The optional preview part must be a PNG under 2MB; a bad preview fails the whole publish. requestBody: required: true content: multipart/form-data: schema: type: object required: [file, kind] properties: file: { type: string, format: binary, description: Artifact bytes (max 25MB) } preview: { type: string, format: binary, description: Optional small PNG thumbnail (max 2MB) } kind: { type: string, enum: [chart, diagram, spreadsheet, document, data, image, other] } filename: { type: string, description: Overrides the file part's filename } title: { type: string } description: { type: string } source_tool: { type: string } sandbox_path: { type: string } content_type: { type: string, description: Defaults to the file part's Content-Type header } responses: '201': description: Stored content: application/json: schema: type: object properties: artifact: { $ref: '#/components/schemas/SessionArtifact' } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } '413': { description: "Artifact exceeds 25MB, or preview exceeds 2MB" } /sessions/{id}/outputs: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Sessions] summary: List what a session made besides its app description: | The workflows the session's agent created or edited, oldest first; an empty array when it made none. Each entry is a soft reference: read the workflow behind ref_id through GET /workflows/{id}, which applies its own access rules and answers 404 once the workflow is deleted. Recorded when a workflow draft is saved with the session's own sandbox token. responses: '200': description: Outputs content: application/json: schema: type: object properties: outputs: type: array items: { $ref: '#/components/schemas/SessionOutput' } '404': { $ref: '#/components/responses/NotFound' } '500': { description: The outputs could not be listed } /sessions/{id}/artifacts/{artifact_id}/data: parameters: - { $ref: '#/components/parameters/SessionId' } - { name: artifact_id, in: path, required: true, schema: { type: string, format: uuid } } get: tags: [Sessions] summary: Download an artifact's bytes (or its PNG preview) description: Streams the stored bytes with the artifact's content type and an inline Content-Disposition; ?preview=1 returns the PNG thumbnail instead. parameters: - { name: preview, in: query, schema: { type: string, enum: ['1'] }, description: Return the PNG preview instead of the full bytes } responses: '200': description: Artifact bytes content: application/octet-stream: schema: { type: string, format: binary } image/png: schema: { type: string, format: binary } '404': { description: "Session, artifact, bytes, or requested preview not found" } /sessions/{id}/preview: parameters: [{ $ref: '#/components/parameters/SessionId' }] get: tags: [Preview] summary: Report iframe-preview availability for a session description: | The sandbox app preview behind the workspace App pane. `url` is present whenever a preview token exists, even while the sandbox sleeps, so a deliverable card keeps a stable link. `available` is true only with a live sandbox whose dev server was detected. `state` distinguishes `starting` (a live sandbox without a dev server yet, or a working session whose sandbox is being created), `ready`, and `asleep`. When the feature is off (no CRIOS_PREVIEW_BASE_DOMAIN), for native Android sessions, and for sessions whose recorded intents are all lookup/research with nothing served, the answer is `{"available": false, "state": "none"}`. `mobile` marks an Expo (React Native) project, which the UI shows in a phone frame. responses: '200': description: Preview availability content: application/json: schema: type: object properties: available: { type: boolean } state: { type: string, enum: [none, starting, ready, asleep] } url: { type: string, description: Stable preview URL; omitted when no preview token exists or the feature is off } mobile: { type: boolean, description: Present (true) for a web-previewable mobile project } '404': { $ref: '#/components/responses/NotFound' } # ==================== ORGANIZATION GROUPS ==================== # Org-scoped user groups (project-share targets): sharing a project with a # group grants every group member the share's role. Reads are open to every # org member so share/group pickers can populate; writes require org # owner/admin. Handlers trust the context org, never the {id} path segment. /organizations/{id}/groups: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: List groups description: | Any org member. `{id}` must be the caller's active organization. The org's groups with member counts, ordered by name. responses: '200': description: Groups content: application/json: schema: type: object properties: groups: type: array items: { $ref: '#/components/schemas/Group' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Organizations] summary: Create a group description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Group names are unique within the organization. requestBody: required: true content: application/json: schema: type: object required: [name] properties: name: { type: string } description: { type: string } responses: '201': description: Created content: application/json: schema: type: object properties: id: { type: string, format: uuid } name: { type: string } description: { type: string } member_count: { type: integer, description: Always 0 on create } project_count: { type: integer, description: Always 0 on create } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: A group with this name already exists } /organizations/{id}/groups/{groupID}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: groupID, in: path, required: true, schema: { type: string, format: uuid } } patch: tags: [Organizations] summary: Rename a group or change its description description: Org owner/admin only. At least one of name/description is required; name cannot be blanked. requestBody: required: true content: application/json: schema: type: object properties: name: { type: string } description: { type: string } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: A group with this name already exists } delete: tags: [Organizations] summary: Delete a group description: Org owner/admin only. Project shares referencing the group cascade away, silently revoking the access those shares granted. responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /organizations/{id}/groups/{groupID}/members: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: groupID, in: path, required: true, schema: { type: string, format: uuid } } get: tags: [Organizations] summary: List a group's members description: | Any org member. `{id}` must be the caller's active organization. Members with display fields for pickers, ordered by name then email. Unknown or cross-org group IDs return 404. responses: '200': description: Members content: application/json: schema: type: object properties: members: type: array items: { $ref: '#/components/schemas/GroupMember' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Organizations] summary: Add an org member to a group description: Org owner/admin only. The target must belong to the same org — groups never reach across org boundaries. Idempotent (re-adding an existing member succeeds without duplicating the row). requestBody: required: true content: application/json: schema: type: object required: [user_id] properties: user_id: { type: string, format: uuid } responses: '201': description: Added content: application/json: schema: { $ref: '#/components/schemas/StatusMessage' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Group, or target user, not found in organization" } /organizations/{id}/groups/{groupID}/members/{userID}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: groupID, in: path, required: true, schema: { type: string, format: uuid } } - { name: userID, in: path, required: true, schema: { type: string, format: uuid } } delete: tags: [Organizations] summary: Remove a member from a group description: Org owner/admin only. responses: '204': { description: Removed } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Group or member not found } # ==================== ADMIN-PLANE ADDITIONS ==================== /admin/license: post: tags: [Admin] summary: Install or replace the license key description: | Instance admin only. Verifies and persists a new license key and hot-swaps it into the running deployment (no restart): the replica that handles the request at once, the other orchestrator replicas through a Redis broadcast (without Redis, at their hourly reload). Exempt from the license gate, so it works on an expired install. The raw key never leaves the server; responses carry derived fields only. requestBody: required: true content: application/json: schema: type: object required: [key] properties: key: { type: string, description: 'License key, e.g. CRIOS-EL1-...' } responses: '200': description: Installed content: application/json: schema: type: object properties: installed: { type: boolean } state: { type: string, enum: [valid, grace, expired, invalid, unlicensed] } expires_at: { type: string, format: date-time } lid: { type: string } edition: { type: string } org_name: { type: string } '400': description: Missing key, or the key was rejected (invalid, wrong fingerprint, etc.) content: application/json: schema: type: object properties: error: { type: string } state: { type: string, enum: [valid, grace, expired, invalid, unlicensed] } reason: { type: string } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Licensing not initialized } /admin/model-sync/trigger: post: tags: [Admin] summary: Trigger a model catalog sync description: | Instance admin only. Starts one instance-wide sync run in the background (it covers every organization's catalog) and returns immediately; a concurrent scheduled run queues behind it. Recorded in the audit log. responses: '202': description: Sync started content: application/json: schema: type: object properties: status: { type: string, enum: [started] } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Catalog sync is not configured } /admin/usage/summary: get: tags: [Admin] summary: Get the instance usage summary description: | Instance admin only. Token/cost totals for the window and all-time counters across every organization, plus a per-organization rollup sorted by cost. Per-user, per-project and per-model breakdowns are on the organization console (`GET /organizations/{id}/usage/summary`). parameters: - { name: window, in: query, schema: { type: string, enum: [mtd, 30d, all], default: mtd } } responses: '200': description: Usage summary content: application/json: schema: type: object properties: window: { type: string, enum: [mtd, 30d, all] } totals: { $ref: '#/components/schemas/UsageTotals' } all_time: { $ref: '#/components/schemas/UsageTotals' } by_org: type: array items: allOf: - $ref: '#/components/schemas/UsageTotals' - type: object properties: organization_id: { type: string, format: uuid } name: { type: string } '400': { description: window must be one of mtd|30d|all } '403': { $ref: '#/components/responses/Forbidden' } /admin/usage/series: get: tags: [Admin] summary: Get the instance daily usage series description: | Instance admin only. Same as the organization series, summed across every organization. parameters: - { name: days, in: query, schema: { type: integer, minimum: 1, default: 30 }, description: Values above 365 are clamped } - { name: group_by, in: query, schema: { type: string, enum: [model, user, project] } } responses: '200': description: Series content: application/json: schema: { $ref: '#/components/schemas/UsageSeries' } '400': { description: "days is not a positive integer, or an invalid group_by" } '403': { $ref: '#/components/responses/Forbidden' } /admin/usage/export: get: tags: [Admin] summary: Export instance usage as CSV description: | Instance admin only. Streams the windowed daily usage of every organization as a CSV attachment (`usage--.csv`) with columns day, organization, user_email, project, provider, model, session_type, input_tokens, output_tokens, cached_input_tokens, cache_creation_input_tokens, cost_usd, call_count. parameters: - { name: window, in: query, schema: { type: string, enum: [mtd, 30d, all], default: mtd } } responses: '200': description: CSV download content: text/csv: schema: { type: string } '400': { description: window must be one of mtd|30d|all } '403': { $ref: '#/components/responses/Forbidden' } # -------------------- Backups (Settings -> Backups) -------------------- # BackupAdminHandler needs the orchestrator to run in-cluster; every route # below returns 503 when the Kubernetes API is unavailable. /admin/backup/destination: get: tags: [Admin] summary: Get the effective backup destination description: | Instance admin only. Resolves the runtime destination override Secret (crios-backup-destination) over the chart-values baseline baked into the backup CronJob, mirroring the resolution order the backup script uses. Also reports whether backups are enabled at all (the CronJob exists on this install), its schedule, and suspension state. responses: '200': description: Effective destination content: application/json: schema: type: object properties: backups_enabled: { type: boolean } cronjob: { type: string } destination: { $ref: '#/components/schemas/BackupDestination' } schedule: { type: string, description: Cron expression; present when backups_enabled } suspended: { type: boolean, description: Present when backups_enabled } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Kubernetes API unavailable (orchestrator is not running in-cluster) } put: tags: [Admin] summary: Set the backup destination override description: | Instance admin only. Writes the destination override Secret. The secret key is write-only (never echoed back); empty access_key/secret_key on update preserve the stored pair, so editing the bucket does not force re-entering credentials. Applies on the next backup run — no restart or helm apply. Credentials must be provided as a pair. requestBody: required: true content: application/json: schema: type: object required: [bucket] properties: provider: { type: string, enum: [s3, minio, gcs], description: May be omitted or empty } bucket: { type: string } endpoint: { type: string, description: Optional http(s) URL } region: { type: string } prefix: { type: string } access_key: { type: string, description: Empty keeps the stored key } secret_key: { type: string, description: Write-only; empty keeps the stored key } responses: '200': description: Saved content: application/json: schema: type: object properties: status: { type: string, enum: [saved] } destination: { $ref: '#/components/schemas/BackupDestination' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Kubernetes API unavailable (orchestrator is not running in-cluster) } delete: tags: [Admin] summary: Clear the backup destination override description: | Instance admin only. Removes the override Secret so backups revert to the chart-values destination (or none). Idempotent. responses: '200': description: Reverted content: application/json: schema: type: object properties: status: { type: string, enum: [reverted] } destination: { $ref: '#/components/schemas/BackupDestination' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Kubernetes API unavailable (orchestrator is not running in-cluster) } /admin/backup/test: post: tags: [Admin] summary: Test the backup destination description: | Instance admin only. Runs a destination probe end-to-end through the exact delivery path a real backup uses (same image, env, Secret resolution) by deriving a short-lived Job from the backup CronJob's template that uploads and deletes one tiny object, then waits up to ~75s for the verdict. A failed probe is a successful test run (still 200). responses: '200': description: Probe verdict content: application/json: schema: type: object properties: status: { type: string, enum: [ok, failed, timeout] } job: { type: string, description: Probe Job name } output: { type: string, description: Tail (up to 16KB) of the probe container's logs; empty when unavailable } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Backup CronJob not found — backups are disabled on this install } '503': { description: Kubernetes API unavailable (orchestrator is not running in-cluster) } /admin/backup/run: post: tags: [Admin] summary: Run a backup now description: | Instance admin only. Starts a full backup immediately from the CronJob's template (like kubectl create job --from=cronjob/...). Refused with 409 while another backup run is active. Finished manual runs stay visible in status for 3 days. responses: '202': description: Backup started content: application/json: schema: type: object properties: status: { type: string, enum: [started] } job: { type: string, description: Created Job name } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Backup CronJob not found — backups are disabled on this install } '409': description: A backup job is already running content: application/json: schema: type: object properties: error: { type: string } job: { type: string, description: Name of the running Job } '503': { description: Kubernetes API unavailable (orchestrator is not running in-cluster) } /admin/backup/status: get: tags: [Admin] summary: Backup status and recent runs description: | Instance admin only. Reports the CronJob schedule state, the resolved destination, and the last runs (scheduled + manual, probes excluded, newest first, max 10). When backups are disabled only backups_enabled=false, destination and an empty jobs array are returned. responses: '200': description: Backup status content: application/json: schema: type: object properties: backups_enabled: { type: boolean } cronjob: { type: string, description: Present when backups_enabled } schedule: { type: string, description: Cron expression; present when backups_enabled } suspended: { type: boolean, description: Present when backups_enabled } destination: { $ref: '#/components/schemas/BackupDestination' } jobs: type: array items: { $ref: '#/components/schemas/BackupJob' } last_schedule_time: { type: string, format: date-time } last_successful_time: { type: string, format: date-time } '403': { $ref: '#/components/responses/Forbidden' } '500': description: Failed to read the backup CronJob content: application/json: schema: { $ref: '#/components/schemas/Error' } '503': { description: Kubernetes API unavailable (orchestrator is not running in-cluster) } # ==================== WORKFLOWS (definitions, executions, agents) ==================== /workflows: get: tags: [Workflows] summary: List workflows description: | Metadata of the workflows in every project the caller can read, newest update first (`updated_at` descending). Project scoping is applied before pagination, so `total` counts only what the caller may see. Agents' internal run workflows are never listed. `pinned_workflow_ids` is the caller's own pin set (ids pinned by this user, whether or not they are on this page), oldest pin first. parameters: - { name: project_id, in: query, description: 'Limit to one project; a project the caller cannot read yields an empty list', schema: { type: string, format: uuid } } - { name: ids, in: query, description: 'Comma-separated workflow ids (the parameter may repeat). Every value must be a UUID (400 otherwise); ids outside the caller''s projects are dropped silently.', schema: { type: string } } - { name: tags, in: query, description: 'Comma-separated tags (the parameter may repeat); a workflow must carry all of them', schema: { type: string } } - { name: active, in: query, description: 'true (or 1, yes) lists workflows with an active version; false (or 0, no) the inactive ones', schema: { type: string } } - { name: q, in: query, description: Case-insensitive substring match on the name, schema: { type: string } } - { name: limit, in: query, description: 'Page size; default 50, capped at 200', schema: { type: integer, default: 50, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: One page of workflows content: application/json: schema: type: object properties: workflows: type: array items: { $ref: '#/components/schemas/WorkflowListItem' } total: { type: integer } pinned_workflow_ids: { type: array, items: { type: string, format: uuid } } '400': { $ref: '#/components/responses/BadRequest' } post: tags: [Workflows] summary: Create (or import) a workflow description: | Creates a workflow from a definition document, either bare or wrapped as `{"definition": {…}}`. `projectId` is required. The server assigns `version` 1 and the checksum and writes the first version snapshot; a client-supplied `id` is kept (import). The save gate validates the document: structural, schema, expression and host-access errors block the save (422); semantic findings and warnings come back in `issues`. Node parameters that the node type's parameter schema rejects (missing or invalid values) never block a save: they are reported as warnings, so an unfinished draft keeps its nodes, and become errors only at activation. The response also carries the setup checklist of what is left before the workflow can be activated. Requires editor access to the project. A document with an enabled host-access node (`crios.command`, `crios.ssh`, `crios.file.read`, `crios.file.write`, `crios.trigger.file`, `crios.git`) also needs the `workflow.host_access` permission (members and above by default) and the project's `workflow_host_access` setting; a `crios.api` node with `allowWrites: true` needs `workflow.api_write`. Creating beyond the organization's licensed workflow cap is refused (instance admins are exempt). requestBody: required: true content: application/json: schema: oneOf: - { $ref: '#/components/schemas/WorkflowDocument' } - type: object required: [definition] properties: definition: { $ref: '#/components/schemas/WorkflowDocument' } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/WorkflowWriteResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': description: 'Viewer role, insufficient project access or permission, or the organization reached its workflow cap (code workflow_limit_reached, with limit)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '404': { description: Project not found or not accessible } '409': { description: 'A workflow with this name already exists in the project (code name_conflict), or the supplied id is taken (code id_conflict)' } '422': description: 'The document has blocking validation errors (code validation_failed, findings in issues; a value the document cannot hold is an invalid_shape issue, as on PATCH /workflows/{id})' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/validate: post: tags: [Workflows] summary: Validate a workflow document description: | Stateless validation for CI and agents: nothing is stored and no project scoping applies. Semantic findings keep their natural severity, but node parameter findings are checked as for a save: a missing or invalid parameter is a warning, so `valid` can be true for a document that activation would still refuse. Checks that need stored data (error-workflow chains, collector conflicts, agent references, MCP grants, the project's host-access setting) are skipped. `version` may be omitted. Any authenticated user may call it, org-role viewers included (a read-shaped POST). requestBody: required: true content: application/json: schema: type: object required: [definition] properties: definition: { $ref: '#/components/schemas/WorkflowDocument' } responses: '200': description: Validation result content: application/json: schema: type: object properties: issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } valid: { type: boolean, description: No error-severity issue } setup: { $ref: '#/components/schemas/WorkflowSetupChecklist' } needs_setup: { type: boolean } tool_manifests: type: array nullable: true description: What each agent node's model would be handed; null when the graph does not compile items: { $ref: '#/components/schemas/WorkflowToolManifest' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } /workflows/tags: get: tags: [Workflows] summary: List workflow tags with usage counts description: The tag vocabulary of the workflows the caller can read, sorted by tag. Scoped exactly like the workflow list. parameters: - { name: project_id, in: query, description: 'Limit to one project; an inaccessible project yields an empty list', schema: { type: string, format: uuid } } responses: '200': description: Tags content: application/json: schema: type: object properties: tags: type: array items: type: object properties: tag: { type: string } count: { type: integer } /workflows/{id}: get: tags: [Workflows] summary: Get a workflow draft description: | The draft document (with `activeVersion`), its live validation issues, the setup checklist, the tool-manifest preview of each agent node and what the caller may do with it: `access` (`viewer`, `editor` or `manager`) and `capabilities`, the same answer per group of routes (`write`, `run`, `control`). Requires viewer access to the project. Unknown, malformed and inaccessible ids all answer 404. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } responses: '200': description: The workflow content: application/json: schema: { $ref: '#/components/schemas/WorkflowDetail' } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Workflows] summary: Delete a workflow description: | Deletes the workflow and its version snapshots. An active workflow is refused (409 `workflow_active`) unless `force=true`, which first deregisters its triggers and additionally requires the `workflow.activate` permission. Requires editor access to the project. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } - { name: force, in: query, description: 'true (or 1, yes) deactivates an active workflow before deleting it', schema: { type: boolean } } responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The workflow is active and force was not set (code workflow_active)' } '502': { description: 'Trigger deactivation failed (code activation_failed)' } '503': { description: 'Trigger subsystem unavailable (code triggers_unavailable)' } patch: tags: [Workflows] summary: Save a workflow draft description: | Optimistic save: `expected_version` must equal the current draft version, otherwise the answer is 409 `version_conflict` with the current version and checksum so the client can rebase. A valid save bumps `version`, prunes test fixtures of deleted nodes, recomputes the checksum and writes an immutable version snapshot in one transaction. Saving never changes which version is active. `definition.id` and `definition.projectId` may be omitted; when present they must match (a workflow cannot move between projects). Requires editor access to the project, plus the host-access and `crios.api` write permissions described under create when the document carries those nodes. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [definition, expected_version] properties: definition: { $ref: '#/components/schemas/WorkflowDocument' } expected_version: { type: integer, minimum: 1 } responses: '200': description: Saved content: application/json: schema: { $ref: '#/components/schemas/WorkflowWriteResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Stale expected_version (code version_conflict) or duplicate name (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '422': description: | The document has blocking validation errors: code `validation_failed` with the findings in `issues`. A value the document cannot hold (a decimal or text where a whole number belongs, such as a node's `maxTries` or `timeoutMs`; an object where a list belongs) is an `invalid_shape` issue at the value's JSON path, answered alone because nothing else can be checked on a document that does not parse. An enabled host-access node in a project without host access is a `host_access_disabled` issue on that node. content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } example: error: workflow definition is not valid code: validation_failed issues: - code: invalid_shape path: [nodes, 1, maxTries] message: 'maxTries must be a whole number, not 2.5' severity: error /workflows/{id}/versions: get: tags: [Workflows] summary: List version snapshots description: The append-only snapshot history, newest first, without the documents. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } responses: '200': description: Versions content: application/json: schema: type: object properties: versions: type: array items: { $ref: '#/components/schemas/WorkflowVersionSummary' } '404': { $ref: '#/components/responses/NotFound' } /workflows/{id}/versions/{v}: get: tags: [Workflows] summary: Get one version snapshot description: One immutable snapshot with its document. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } - { name: v, in: path, required: true, description: Version number, schema: { type: integer, minimum: 1 } } responses: '200': description: The snapshot content: application/json: schema: type: object properties: version: { type: integer } checksum: { type: string } created_by: { type: string } created_at: { type: string, format: date-time } definition: { $ref: '#/components/schemas/WorkflowDocument' } '404': { $ref: '#/components/responses/NotFound' } /workflows/{id}/versions/{v}/diff: get: tags: [Workflows] summary: Diff two version snapshots description: | The structural changes of version `v` relative to the `against` baseline: nodes keyed by id with the changed fields, edges added and removed, groups, annotations and fixtures by key, and changed settings keys. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } - { name: v, in: path, required: true, description: The newer version, schema: { type: integer, minimum: 1 } } - { name: against, in: query, required: true, description: The baseline version, schema: { type: integer, minimum: 1 } } responses: '200': description: The diff content: application/json: schema: type: object properties: workflow_id: { type: string, format: uuid } version: { type: integer } against: { type: integer } diff: { $ref: '#/components/schemas/WorkflowDiff' } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /workflows/{id}/versions/{v}/restore: post: tags: [Workflows] summary: Restore a version into the draft description: | Copies snapshot `v` into the draft as a new version (`expected_version` + 1); history is never rewritten. The restore passes the same save gate, permission checks and optimistic concurrency as PATCH. Requires editor access to the project. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } - { name: v, in: path, required: true, description: Version to restore, schema: { type: integer, minimum: 1 } } requestBody: required: true content: application/json: schema: type: object required: [expected_version] properties: expected_version: { type: integer, minimum: 1, description: The current draft version } responses: '200': description: Restored as a new draft version content: application/json: schema: { $ref: '#/components/schemas/WorkflowWriteResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Stale expected_version (code version_conflict) or duplicate name (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '422': description: The restored document fails the save gate (code validation_failed) content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/{id}/activate: post: tags: [Workflows] summary: Activate a workflow version description: | Validates snapshot `version` at activation strictness (unknown node types, unbound required connections, open setup items and missing or invalid node parameters become errors, and semantic findings keep their own severity instead of being demoted to warnings), registers its triggers (webhook routes, schedules, collector bindings) and points `activeVersion` at it. Any saved version can be activated; the draft keeps evolving independently. With `expected_checksum` the call is refused when the snapshot's checksum differs. Requires editor access to the project and the `workflow.activate` permission (members and above), plus the host-access and `crios.api` write permissions when the version carries those nodes. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [version] properties: version: { type: integer, minimum: 1 } expected_checksum: { type: string } responses: '200': description: Activated content: application/json: schema: type: object properties: workflow_id: { type: string, format: uuid } active_version: { type: integer } issues: type: array description: Non-blocking findings items: { $ref: '#/components/schemas/WorkflowValidationIssue' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Checksum mismatch (code checksum_mismatch, with checksum), or a trigger clashes with another active workflow (code collector_conflict or route_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '422': description: The version cannot be activated (code validation_failed, with issues) content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '502': { description: 'Trigger registration failed (code activation_failed)' } '503': { description: 'Trigger subsystem unavailable (code triggers_unavailable)' } /workflows/{id}/deactivate: post: tags: [Workflows] summary: Deactivate a workflow description: | Deregisters every trigger of the workflow and clears `activeVersion`. Idempotent. Requires editor access to the project and the `workflow.activate` permission. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } responses: '200': description: Deactivated content: application/json: schema: type: object properties: workflow_id: { type: string, format: uuid } active_version: { type: integer, nullable: true, description: Always null } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '502': { description: 'Trigger deregistration failed (code activation_failed)' } '503': { description: 'Trigger subsystem unavailable (code triggers_unavailable)' } /workflows/{id}/draft/fixtures: put: tags: [Workflows] summary: Replace the draft's test fixtures description: | Replaces `testFixtures` (pinned node outputs used only by test runs) wholesale; an empty object clears them. Fixtures are part of the document, so this is a save: optimistic on `expected_version`, version bump plus snapshot. Fixtures keyed by nodes that do not exist are pruned with a warning. Requires editor access to the project. parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [fixtures, expected_version] properties: fixtures: type: object description: Node id to the items that node should output additionalProperties: type: array items: { $ref: '#/components/schemas/WfItem' } expected_version: { type: integer, minimum: 1 } responses: '200': description: Saved content: application/json: schema: { $ref: '#/components/schemas/WorkflowWriteResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: Stale expected_version (code version_conflict) content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '422': description: The resulting document fails the save gate (code validation_failed) content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/{id}/executions: post: tags: [Workflow Executions] summary: Run a workflow description: | Starts one manual execution. - `test` (default) runs the current draft, or the snapshot `version`. It fires from the manual trigger, else the first enabled trigger node, or from `trigger_node`; that trigger does not poll or wait, it hands `input` to the graph. `target` bounds the run at one node ("Run to here"). Test fixtures apply. - `production` runs the active version from its manual trigger; `target`, `trigger_node` and a `version` other than the active one are refused. - `partial` re-runs the reference execution `reuse_from` (a finished execution of this workflow), reusing its journaled step outputs except for the `dirty` nodes and everything they affect. `input` and `target` are refused. The answer is 202 with the execution id. With `wait: true` the call blocks up to 30 seconds and answers 200 with the execution once it is terminal (still 202 when it is not). An `Idempotency-Key` header deduplicates retries: a repeated key returns the original execution with 200. Follow progress with GET /workflows/executions/{id}/listen or /events. Requires editor access to the project and the `execution.run` permission (members and above). parameters: - { name: id, in: path, required: true, description: Workflow ID, schema: { type: string, format: uuid } } - { name: Idempotency-Key, in: header, description: Deduplicates retried requests, schema: { type: string } } requestBody: content: application/json: schema: type: object properties: mode: { type: string, enum: [test, production, partial], default: test } input: { description: 'Trigger payload (test and production): an array of {"json": {…}} items, or one object wrapped as a single item' } version: { type: integer, description: 'Snapshot to run (test and partial; default: the current draft version)' } wait: { type: boolean, default: false } target: { type: string, description: 'Node id to stop at (test only); nothing downstream of it runs' } trigger_node: { type: string, description: Trigger node to fire from (test only) } reuse_from: { type: string, format: uuid, description: 'Reference execution (partial, required)' } dirty: { type: array, items: { type: string }, description: 'Node ids changed since the reference run (partial)' } responses: '200': description: 'Idempotent replay (execution_id, status), or with wait the finished execution' content: application/json: schema: oneOf: - { $ref: '#/components/schemas/WorkflowRunAccepted' } - type: object properties: execution: { $ref: '#/components/schemas/WorkflowExecution' } '202': description: Run accepted (or still running after the wait budget) content: application/json: schema: { $ref: '#/components/schemas/WorkflowRunAccepted' } '400': description: 'Invalid body, input, mode, target or trigger_node; or no trigger node to run from (code no_manual_trigger)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Workflow, version or reference execution not found' } '409': { description: 'Production run of a workflow with no active version (code workflow_inactive), or a reference execution that has not finished or has no journal' } '422': { description: 'target is inside a while loop or not reachable from the trigger (code validation_failed)' } /workflows/executions: get: tags: [Workflow Executions] summary: List executions description: | Executions of every project the caller can read, newest first, or of one project with `project_id`. Project scoping is applied before pagination, so `total` counts only what the caller may see. parameters: - { name: status, in: query, schema: { type: string, enum: [pending, running, waiting, succeeded, failed, timed_out, cancelled, crashed] } } - { name: mode, in: query, schema: { type: string, enum: [production, test, partial, retry, subworkflow] } } - { name: workflow_id, in: query, schema: { type: string, format: uuid } } - { name: project_id, in: query, description: 'Only this project (it must be one the caller can access; otherwise 404)', schema: { type: string, format: uuid } } - { name: data_key, in: query, description: 'Only executions that saved this key through crios.execution.data (at most 1000 matching executions are considered)', schema: { type: string } } - { name: data_value, in: query, description: Exact value for data_key; requires data_key, schema: { type: string } } - { name: since, in: query, description: 'created_at lower bound (RFC3339)', schema: { type: string, format: date-time } } - { name: until, in: query, description: 'created_at upper bound (RFC3339)', schema: { type: string, format: date-time } } - { name: limit, in: query, description: 'Page size; default 50, capped at 200', schema: { type: integer, default: 50, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: One page of executions content: application/json: schema: type: object properties: executions: type: array items: { $ref: '#/components/schemas/WorkflowExecutionSummary' } total: { type: integer } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /workflows/executions/{id}: get: tags: [Workflow Executions] summary: Get an execution description: The execution with its trigger, error and stats. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Execution ID, schema: { type: string, format: uuid } } responses: '200': description: The execution content: application/json: schema: type: object properties: execution: { $ref: '#/components/schemas/WorkflowExecution' } '404': { $ref: '#/components/responses/NotFound' } /workflows/executions/{id}/events: get: tags: [Workflow Executions] summary: Read the execution journal description: | One page of the append-only journal in order: `{seq, at, type, payload}`. Page with `after_seq` set to the returned `last_seq`; this is also how a live listener re-syncs after a gap. Types include execution.created, step.scheduled, step.started, step.finished, step.retry_scheduled, step.deferred, edge.dead, wait.started, wait.resolved, budget.exceeded, cancel.requested, execution.finished and checkpoint.written. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Execution ID, schema: { type: string, format: uuid } } - { name: after_seq, in: query, description: Return entries after this sequence number, schema: { type: integer, default: 0, minimum: 0 } } - { name: limit, in: query, description: 'Default 200, capped at 1000', schema: { type: integer, default: 200, minimum: 1, maximum: 1000 } } responses: '200': description: Journal page content: application/json: schema: type: object properties: events: type: array items: { $ref: '#/components/schemas/WorkflowJournalEvent' } last_seq: { type: integer, description: Sequence number of the last entry returned (after_seq when none) } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /workflows/executions/{id}/steps: get: tags: [Workflow Executions] summary: List execution steps description: Every step of the execution, all attempts, without outputs (those are behind the per-step read). Each step carries the notes its node attached and, when it was skipped, the cause. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Execution ID, schema: { type: string, format: uuid } } responses: '200': description: Steps content: application/json: schema: type: object properties: steps: type: array items: { $ref: '#/components/schemas/WorkflowStep' } '404': { $ref: '#/components/responses/NotFound' } /workflows/executions/{id}/steps/{step_id}: get: tags: [Workflow Executions] summary: Get one step with its output description: | Every attempt of one step, with `input_refs` and `output`. A large output that was spilled to an artifact is returned as a reference `{artifact_id, bytes, sha256, mime_type}` instead of inline items. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Execution ID, schema: { type: string, format: uuid } } - { name: step_id, in: path, required: true, description: Step ID, schema: { type: string } } responses: '200': description: The step's attempts content: application/json: schema: type: object properties: steps: type: array items: { $ref: '#/components/schemas/WorkflowStep' } '404': { $ref: '#/components/responses/NotFound' } /workflows/executions/{id}/agents: get: tags: [Workflow Executions] summary: List the agent runs of an execution description: | One row per agent instance in the execution (state, turns, tool calls, spend), computed from the journal on every request, so it stays correct after the workflow or agent has changed. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Execution ID, schema: { type: string, format: uuid } } responses: '200': description: Agent runs content: application/json: schema: type: object properties: agents: type: array items: { $ref: '#/components/schemas/WorkflowExecutionAgent' } '404': { $ref: '#/components/responses/NotFound' } /workflows/executions/{id}/cancel: post: tags: [Workflow Executions] summary: Cancel an execution description: | A waiting execution is cancelled at once; a pending or running one drains through the scheduler, so the returned status may still be non-terminal. Requires editor access to the project and the `execution.control` permission. parameters: - { name: id, in: path, required: true, description: Execution ID, schema: { type: string, format: uuid } } requestBody: content: application/json: schema: type: object properties: reason: { type: string } responses: '202': description: Cancellation accepted content: application/json: schema: { $ref: '#/components/schemas/WorkflowRunAccepted' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The execution already finished (code execution_terminal)' } /workflows/executions/{id}/retry: post: tags: [Workflow Executions] summary: Retry a failed execution description: | Starts a new execution (mode `retry`) of the same pinned version that resumes from the first failed steps and reuses the journaled outputs of every step that succeeded. Only `failed` executions can be retried. An `Idempotency-Key` header deduplicates retries. Requires editor access to the project and the `execution.control` permission. parameters: - { name: id, in: path, required: true, description: ID of the failed execution, schema: { type: string, format: uuid } } - { name: Idempotency-Key, in: header, description: Deduplicates retried requests, schema: { type: string } } responses: '200': description: Idempotent replay of an earlier retry content: application/json: schema: { $ref: '#/components/schemas/WorkflowRunAccepted' } '202': description: Retry execution accepted content: application/json: schema: { $ref: '#/components/schemas/WorkflowRunAccepted' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The execution is not failed (code not_retryable), or it has no journal to reuse' } /workflows/executions/{id}/listen: get: tags: [Workflow Executions] summary: Stream execution events (WebSocket) description: | Upgrades to a WebSocket that pushes the execution's events live. Authenticate with the `Authorization` header or, from a browser, by offering the subprotocols `crios-ws-auth` and the access token (`Sec-WebSocket-Protocol: crios-ws-auth, `); the server echoes `crios-ws-auth`. The `access_token` or `token` query parameter is also accepted. Requires viewer access to the project. The server sends JSON text frames `{id, type, session_id, content, timestamp}`, where `session_id` is the channel `exe:`: - journal events (`type` = the journal type, e.g. step.finished): `content` carries `seq` plus trimmed fields (step and node ids, attempt, status, item counts per port, metrics, error type and message), never item payloads; apply them in `seq` order; - `step.stream_chunk`: live model tokens `{step_id, node_id, attempt, port, chunk, iteration_path?}`, without `seq`, paint only; - `stream_gap` `{dropped_events}`: the connection was too slow and events were dropped; re-sync from GET /workflows/executions/{id}/events with `after_seq`. Client messages are ignored. The server pings every 30 seconds and closes the socket when the client goes away. parameters: - { name: id, in: path, required: true, description: Execution ID, schema: { type: string, format: uuid } } responses: '101': { description: Switching Protocols (WebSocket) } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } /workflows/usage: get: tags: [Workflow Executions] summary: Get the LLM usage roll-up description: | Workflow LLM usage (attempts, settled calls, tokens, cost) over a time window, summed per workflow (default) or per project, highest cost first, across the projects the caller can read. `since` and `until` override `window`. parameters: - { name: group_by, in: query, schema: { type: string, enum: [workflow, project], default: workflow } } - { name: window, in: query, schema: { type: string, enum: [1h, 24h, 7d, 30d], default: 24h } } - { name: since, in: query, description: RFC3339, schema: { type: string, format: date-time } } - { name: until, in: query, description: 'RFC3339; default now', schema: { type: string, format: date-time } } - { name: workflow_id, in: query, schema: { type: string, format: uuid } } - { name: project_id, in: query, schema: { type: string, format: uuid } } - { name: limit, in: query, description: 'Page size; default 50, capped at 200', schema: { type: integer, default: 50, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: Usage rows content: application/json: schema: type: object properties: usage: type: array items: type: object properties: project_id: { type: string, format: uuid } workflow_id: { type: string, format: uuid, description: Absent with group_by=project } attempts: { type: integer, format: int64 } calls: { type: integer, format: int64 } tokens_in: { type: integer, format: int64 } tokens_out: { type: integer, format: int64 } cost_usd: { type: number } group_by: { type: string } since: { type: string, format: date-time } until: { type: string, format: date-time } '400': { $ref: '#/components/responses/BadRequest' } /workflows/approvals: get: tags: [Workflow Approvals] summary: List approval requests description: | The approval inbox across every project the caller can read, newest first. `assignee=me` keeps the approvals that list the caller as an assignee plus unassigned ones (an approval with no assignees belongs to every eligible inbox). parameters: - { name: status, in: query, description: 'cancelled is the approval of a run that was cancelled or failed while it waited. Any other value answers 400.', schema: { type: string, enum: [pending, approved, rejected, expired, cancelled] } } - { name: workflow_id, in: query, schema: { type: string, format: uuid } } - { name: assignee, in: query, schema: { type: string, enum: [me, any], default: any } } - { name: limit, in: query, description: 'Page size; default 50, capped at 200', schema: { type: integer, default: 50, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: One page of approvals content: application/json: schema: type: object properties: approvals: type: array items: { $ref: '#/components/schemas/WorkflowApproval' } total: { type: integer } '400': { $ref: '#/components/responses/BadRequest' } /workflows/approvals/{id}: get: tags: [Workflow Approvals] summary: Get an approval request description: The approval with its policy, decisions so far and the reviewer-visible payload. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Approval ID, schema: { type: string, format: uuid } } responses: '200': description: The approval content: application/json: schema: type: object properties: approval: { $ref: '#/components/schemas/WorkflowApproval' } '404': { $ref: '#/components/responses/NotFound' } /workflows/approvals/{id}/decide: post: tags: [Workflow Approvals] summary: Approve or reject a request description: | Records the caller's decision; the approval's quorum policy decides when it settles, and settling resumes the parked execution. `arguments` replaces the arguments of the agent tool call being approved; it is accepted only when the approval allows editing and is re-validated against the tool's schema before the call runs. Requires editor access to the project and the `approval.decide` permission. When the approval lists assignees, the caller must be one of them or a project manager (project owner, org owner or admin). A manager who is not an assignee decides as an override: the decision is recorded in the approval's `decisions` with `override: true`, an `approval.decide_override` audit-log row is written, and it counts toward the quorum like any other decision (one per person). parameters: - { name: id, in: path, required: true, description: Approval ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [decision] properties: decision: { type: string, enum: [approve, reject] } comment: { type: string } arguments: { type: object, additionalProperties: true, description: Replacement tool-call arguments (JSON object) } responses: '200': description: Decision recorded content: application/json: schema: type: object properties: approval_id: { type: string, format: uuid } status: { type: string, enum: [pending, approved, rejected, expired], description: The approval's status after this decision } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: 'Viewer role or insufficient access (code forbidden), or the caller is neither an assignee nor a project manager (code not_assignee)' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The approval is already settled (code approval_settled), or the caller already decided (code already_decided)' } '410': { description: 'The approval has expired (code wait_expired)' } '422': { description: 'arguments were sent but this approval does not accept edited arguments' } /workflows/budgets: get: tags: [Workflow Budgets] summary: List the spend caps of a source description: | Every cap on one workflow or agent, with what the current window has used. A window whose bucket has passed reports `stale: true` and `used: 0` until the next charge resets it. Requires viewer access to the project. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: source_kind, in: query, required: true, schema: { type: string, enum: [workflow, agent] } } - { name: source_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Caps content: application/json: schema: type: object properties: budgets: type: array items: { $ref: '#/components/schemas/WorkflowBudget' } '400': { $ref: '#/components/responses/BadRequest' } '404': { description: Project not found or not accessible } put: tags: [Workflow Budgets] summary: Set a spend cap description: | Creates or updates one cap, identified by source, `rule` and `metric`. Takes effect without a new workflow or agent version. Updating a cap does not reset what the current window has already used. `action` is what happens at the cap: `park` (default) waits for the next window, `fail` fails the step. A `per_run` cap cannot `park`, and an agent's per-run limits live in its definition (`policies.maxCostUsd`, `maxIterations`), not here. Requires editor access to the project and `workflow.write` (workflow caps) or `agent.write` (agent caps). requestBody: required: true content: application/json: schema: allOf: - { $ref: '#/components/schemas/WfBudgetKey' } - type: object required: [budget] properties: budget: { type: number, minimum: 0 } action: { type: string, enum: [park, fail], default: park } responses: '200': description: 'The cap as written (source, rule, metric, budget, action, last_update, updated_by); the usage fields are not filled in' content: application/json: schema: type: object properties: budget: { $ref: '#/components/schemas/WorkflowBudget' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Project not accessible, or the source is not in this project' } '422': { description: 'A per-run cap for an agent (code budget_rule_in_definition), or a per_run cap with action park' } '503': { description: Budgets are unavailable on this deployment (code unavailable) } delete: tags: [Workflow Budgets] summary: Remove a spend cap description: Removes one cap. Idempotent (removing a missing cap answers 200 with `removed` 0). Requires editor access to the project and `workflow.write` or `agent.write` by source kind. requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/WfBudgetKey' } responses: '200': description: Removed content: application/json: schema: type: object properties: removed: { type: integer } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not accessible } '422': { description: 'A per-run cap for an agent (code budget_rule_in_definition)' } /workflows/dlq: get: tags: [Workflow Dead Letters] summary: List dead letters description: | Failed executions parked in the dead-letter queue across every project the caller can read, newest first. `workflow_id` is absent when the execution has since been pruned. parameters: - { name: workflow_id, in: query, schema: { type: string, format: uuid } } - { name: limit, in: query, description: 'Page size; default 50, capped at 200', schema: { type: integer, default: 50, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: One page of dead letters content: application/json: schema: type: object properties: dead_letters: type: array items: { $ref: '#/components/schemas/WorkflowDeadLetter' } total: { type: integer } '400': { $ref: '#/components/responses/BadRequest' } delete: tags: [Workflow Dead Letters] summary: Delete a project's dead letters description: | Bulk-removes the project's dead letters, optionally only those of one workflow. Requires editor access to the project and the `execution.control` permission. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: workflow_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Deleted content: application/json: schema: type: object properties: deleted: { type: integer } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not accessible } /workflows/dlq/{id}: delete: tags: [Workflow Dead Letters] summary: Delete a dead letter description: Removes one dead letter of the given project; an id of another project answers 404. Requires editor access to the project and the `execution.control` permission. parameters: - { name: id, in: path, required: true, description: Dead letter ID, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Deleted } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /workflows/dlq/{id}/redrive: post: tags: [Workflow Dead Letters] summary: Redrive a dead letter description: | Starts a new execution (mode `retry`) that re-runs the dead-lettered run and records it as `redriven_as`. A dead letter can be redriven once; of two concurrent redrives one wins and the other gets 409. Requires editor access to the project and the `execution.control` permission. parameters: - { name: id, in: path, required: true, description: Dead letter ID, schema: { type: string, format: uuid } } responses: '202': description: Redrive execution accepted content: application/json: schema: type: object properties: execution_id: { type: string, format: uuid } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'Already redriven (code already_redriven)' } /workflows/generate: post: tags: [Workflow Generation] summary: Generate a workflow from a prompt description: | Starts a background run that drafts a workflow document from a natural-language `prompt` (at most 4000 bytes) and answers 202 with its `run_id`; poll GET /workflows/generate/{runId}. Nothing is stored as a workflow: the result is a review-first draft that the caller saves through POST /workflows. The run may park once on up to three shape questions (choices that change which nodes exist or how they connect); answer them through POST /workflows/generate/{runId}/answers. With `options.questions: "none"` the run never parks: the draft keeps its own reading (each question's first option) and records the alternatives as decisions and warnings. Values only a person holds (a chat id, an address) and connections are never questions; they come back as setup items. `session_id` (optional) attributes the run's model calls to one of the caller's sessions in this project, which is then billed for them. Requires editor access to the project. requestBody: required: true content: application/json: schema: type: object required: [project_id, prompt] properties: project_id: { type: string, format: uuid } prompt: { type: string, maxLength: 4000 } session_id: { type: string, format: uuid, description: 'A session of the caller in this project' } options: type: object properties: questions: { type: string, enum: [shape, none], default: shape } responses: '202': description: Run started content: application/json: schema: type: object properties: run_id: { type: string, format: uuid } '400': description: 'Invalid body, prompt missing or too long, bad options, or a session_id that is not the caller''s session in this project (code invalid_session)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not accessible } '503': { description: 'Workflow generation is not configured (no LLM route), or the run could not be recorded (code unavailable)' } /workflows/generate/{runId}: get: tags: [Workflow Generation] summary: Poll a workflow generation run description: | The run's stage and progress message, the parked questions, and once `stage` is `done` the draft (`result`). Runs belong to the user who started them: another user's run, an agent-generation run and an expired run (30 minutes without progress) all answer 404. A 503 is transient; keep polling. parameters: - { name: runId, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: The run content: application/json: schema: { $ref: '#/components/schemas/WorkflowGenRun' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'The run could not be read right now (code unavailable)' } /workflows/generate/{runId}/answers: post: tags: [Workflow Generation] summary: Answer a generation run's questions description: | Answers the parked shape questions and starts one continuation pass in the background (202); keep polling the run. Each answer maps a question `key` to one of that question's option ids; free text is refused. An empty map, or an empty value for a question, keeps the draft's own reading. Only the user who started the run may answer, and only while it is parked. parameters: - { name: runId, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/WfGenAnswers' } responses: '202': description: Continuation started content: application/json: schema: type: object properties: run_id: { type: string, format: uuid } '400': description: 'An unknown question key or a value that is not an option id (code invalid_answer), or the run is not waiting for answers (code invalid_request)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'The run could not be read right now (code unavailable)' } /workflows/generate-field: post: tags: [Workflow Generation] summary: Generate one parameter value description: | Synchronously generates the value of one node parameter from a natural-language `prompt` (at most 4000 bytes): a SQL statement for `crios.db.read` / `crios.db.write` (`target: statement`, with the bound `params` and, for writes, a `setup` statement returned as `siblings`), or one `{{ }}` expression (`target: expression`). The optional context (current value, sample item, up to five upstream samples, each truncated to 2000 bytes) grounds the model. Nothing is stored; the builder applies the result and the next save re-validates it. The call can take up to three minutes. Requires editor access to the project. requestBody: required: true content: application/json: schema: type: object required: [project_id, prompt, target] properties: project_id: { type: string, format: uuid } prompt: { type: string, maxLength: 4000 } target: { type: string, enum: [statement, expression] } node_type: { type: string, description: 'Required for statement: crios.db.read or crios.db.write' } field: { type: string, description: 'Parameter being generated, e.g. statement' } engine: { type: string, enum: [postgres, mysql], default: postgres, description: The database node's engine } node_name: { type: string } current_value: { type: string, description: 'The field''s current value, to revise rather than restart' } sample_item: { type: object, additionalProperties: true, description: The current input item's json } upstream: type: array items: type: object properties: name: { type: string } sample: { description: First output item of that upstream node } responses: '200': description: The generated value content: application/json: schema: type: object properties: value: { type: string } siblings: type: object additionalProperties: true description: 'Other parameters generated with the value (statement: params, setup)' notes: { type: array, items: { type: string }, description: 'Disclosed guesses and remaining validation findings; review before saving' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not accessible } '502': { description: 'Generation failed (code unavailable); rephrase and retry' } '503': { description: 'Field generation is not configured (no LLM route) (code unavailable)' } /workflows/agents/generate: post: tags: [Workflow Generation] summary: Generate an agent from a prompt description: | The agent twin of POST /workflows/generate: starts a background run that drafts an agent definition (with a proposed name) from `prompt` (at most 4000 bytes), grounded on what the project's agents can bind. Answers 202 with `run_id`; poll GET /workflows/agents/generate/{runId}. Nothing is stored: save the result through POST /workflows/agents. Questions and `options.questions` work as for workflow generation. Requires editor access to the project and the `agent.write` permission. requestBody: required: true content: application/json: schema: type: object required: [project_id, prompt] properties: project_id: { type: string, format: uuid } prompt: { type: string, maxLength: 4000 } options: type: object properties: questions: { type: string, enum: [shape, none], default: shape } responses: '202': description: Run started content: application/json: schema: type: object properties: run_id: { type: string, format: uuid } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not accessible } '503': { description: 'Agent generation is not configured (no LLM route), or the run could not be recorded (code unavailable)' } /workflows/agents/generate/{runId}: get: tags: [Workflow Generation] summary: Poll an agent generation run description: | The run's stage and progress, the parked questions, and once `stage` is `done` the drafted agent (`agent_result`, `agent_name`). Only the user who started the run can read it; workflow-generation runs answer 404 here. parameters: - { name: runId, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: The run content: application/json: schema: { $ref: '#/components/schemas/WorkflowGenRun' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'The run could not be read right now (code unavailable)' } /workflows/agents/generate/{runId}/answers: post: tags: [Workflow Generation] summary: Answer an agent generation run description: Answers the parked shape questions of an agent-generation run with option ids and starts one continuation pass (202); the rules are those of POST /workflows/generate/{runId}/answers. parameters: - { name: runId, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/WfGenAnswers' } responses: '202': description: Continuation started content: application/json: schema: type: object properties: run_id: { type: string, format: uuid } '400': description: 'An unknown question key or a value that is not an option id (code invalid_answer), or the run is not waiting for answers (code invalid_request)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'The run could not be read right now (code unavailable)' } /workflows/agents/tool-sources: get: tags: [Workflow Agents] summary: List what an agent can bind description: | The feed behind the agent editor's pickers, for one project: node types an agent can call (latest version of each; trigger, webhook and internal types excluded; `executable: false` rows are listed with enough detail to say why they cannot be offered), the project's workflows with their input contract, the project's non-archived agents, the MCP connections the project may use (org-shared, granted, and the caller's own), knowledge folders and entries, prompts, and the enabled model catalog. A section this deployment does not wire is returned empty. Requires viewer access to the project. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Tool sources content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentToolSources' } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/definition-schema: get: tags: [Workflow Agents] summary: Get the agent definition JSON Schema description: The JSON Schema (with x-ui hints) of the agent definition document, which the agent editor renders from. Any authenticated user may read it. responses: '200': description: JSON Schema document content: application/json: schema: { type: object, additionalProperties: true } /workflows/agents/validate: post: tags: [Workflow Agents] summary: Validate an agent definition description: | Stateless: validates a definition (bare or wrapped as `{"definition": {…}}`; `{}` validates the defaulted empty definition) and returns the issues, the instructions the model would receive, and the tool manifest it would be handed. A document that does not parse still answers 200, with one `invalid_definition` issue. Nothing is stored. Any authenticated user may call it, org-role viewers included (a read-shaped POST). requestBody: required: true content: application/json: schema: oneOf: - { $ref: '#/components/schemas/WorkflowAgentDefinition' } - type: object required: [definition] properties: definition: { $ref: '#/components/schemas/WorkflowAgentDefinition' } responses: '200': description: Validation result content: application/json: schema: type: object properties: issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } composed_instructions: { type: string, description: The effective instructions (persona plus instructions) } tool_manifest: { $ref: '#/components/schemas/WorkflowToolManifest' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } /workflows/agents/from-canvas: post: tags: [Workflow Agents] summary: Convert a canvas agent node description: | Converts a `crios.agent` node of a workflow document, together with the model, memory, tool and retriever nodes wired into it, into an agent definition ("Convert to agent"). Conversion never fails on content: unknown pieces become warning issues. Without `persist` this is a preview that stores nothing. With `persist: true` the result is stored as a draft agent in `project_id` (default: the document's `projectId`); a taken name gets a numeric suffix and an `agent_renamed` warning. Persisting requires editor access to that project and the `agent.write` permission. Org-role viewers may preview; a persist request from a viewer is refused (403), because the organization role caps their project access at viewer. requestBody: required: true content: application/json: schema: type: object required: [definition, node_id] properties: definition: { $ref: '#/components/schemas/WorkflowDocument' } node_id: { type: string, description: Id of the crios.agent node to convert } persist: { type: boolean, default: false } name: { type: string, description: 'Name of the stored agent (default: the persona role, else the node name)' } project_id: { type: string, format: uuid, description: 'Overrides the document''s projectId' } responses: '200': description: 'The converted definition; with persist, also the new agent' content: application/json: schema: type: object properties: definition: { $ref: '#/components/schemas/WorkflowAgentDefinition' } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } agent_id: { type: string, format: uuid, description: persist only } agent: { $ref: '#/components/schemas/WorkflowAgentSummary' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'The node is not a crios.agent node of the document, or the target project is not accessible' } '409': { description: 'No free agent name was found (code name_conflict)' } '422': description: The converted definition fails validation (code validation_failed) content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/agents: get: tags: [Workflow Agents] summary: List agents description: | Metadata of the agents in every project the caller can read, newest update first. Project scoping is applied before pagination. `pinned_agent_ids` is the caller's own pin set, oldest pin first. parameters: - { name: project_id, in: query, description: 'Limit to one project; an inaccessible project yields an empty list', schema: { type: string, format: uuid } } - { name: q, in: query, description: Case-insensitive substring match on the name or slug, schema: { type: string } } - { name: tags, in: query, description: 'Comma-separated tags (the parameter may repeat); an agent must carry all of them', schema: { type: string } } - { name: status, in: query, schema: { type: string, enum: [draft, active, archived] } } - { name: ids, in: query, description: 'Comma-separated agent ids; every value must be a UUID (400 otherwise). Ids outside the caller''s projects are dropped silently.', schema: { type: string } } - { name: limit, in: query, description: 'Page size; default 50, capped at 200', schema: { type: integer, default: 50, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: One page of agents content: application/json: schema: type: object properties: agents: type: array items: { $ref: '#/components/schemas/WorkflowAgentSummary' } total: { type: integer } pinned_agent_ids: { type: array, items: { type: string } } '400': { $ref: '#/components/responses/BadRequest' } post: tags: [Workflow Agents] summary: Create an agent description: | Creates a draft agent (version 1, no active version). An absent or empty `definition` creates the defaulted empty definition. A definition bound to a prompt (`persona.promptRef`) has that prompt rendered into its instructions at save time and the resolved prompt version stamped into the reference. Error-severity issues block the save; warnings come back in `issues`. Requires editor access to the project and the `agent.write` permission. requestBody: required: true content: application/json: schema: type: object required: [project_id, name] properties: project_id: { type: string, format: uuid, description: projectId is accepted too } name: { type: string, minLength: 1, maxLength: 200, description: 'Unique per project by its slug' } description: { type: string } icon: { type: string } tags: { type: array, items: { type: string } } definition: { $ref: '#/components/schemas/WorkflowAgentDefinition' } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentWriteResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found or not accessible } '409': { description: 'An agent with this name (slug) exists in the project (code name_conflict)' } '422': description: 'The definition fails validation (code validation_failed), or its bound prompt is unusable or misses variables (code validation_failed or prompt_variable_missing)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'The definition binds a prompt and prompts are not available on this deployment (code prompt_unavailable)' } /workflows/agents/{id}: get: tags: [Workflow Agents] summary: Get an agent description: | The agent with its draft definition, the draft's validation issues, `access` (what the caller may do with it: `viewer`, `editor` or `manager`) and, when the draft binds a prompt, `prompt_status` (whether a newer prompt version exists). Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } responses: '200': description: The agent content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentWriteResult' } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Workflow Agents] summary: Delete an agent description: | Deletes the agent, its version snapshots and its internal run workflow. An active agent is refused (409 `agent_active`) unless `force=true`, which additionally requires the `agent.activate` permission. Requires editor access to the project and the `agent.write` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: force, in: query, description: 'true (or 1, yes) deletes an active agent', schema: { type: boolean } } responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The agent is active and force was not set (code agent_active)' } patch: tags: [Workflow Agents] summary: Save an agent draft description: | Optimistic save of any subset of the metadata plus the definition (absent `definition` keeps the stored draft; a metadata-only save still creates a version). `expected_version` must equal the current version, otherwise 409 `version_conflict`. Archived agents cannot be edited. With `activate=true` the saved version is also published (the editor's Publish), which additionally needs the `agent.activate` permission. If activation is refused, the draft stays saved and the 422 body says so (`saved: true`, with `version` and `checksum`). Requires editor access to the project and the `agent.write` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: activate, in: query, description: 'true (or 1, yes) publishes the saved version', schema: { type: boolean } } requestBody: required: true content: application/json: schema: type: object required: [expected_version] properties: expected_version: { type: integer, minimum: 1 } definition: { $ref: '#/components/schemas/WorkflowAgentDefinition' } name: { type: string, minLength: 1, maxLength: 200 } description: { type: string } icon: { type: string } tags: { type: array, items: { type: string } } responses: '200': description: 'Saved (and published, with activate=true)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentWriteResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'The agent is archived (code agent_archived), expected_version is stale (code version_conflict), or the name is taken (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '422': description: 'The definition or bound prompt is invalid (code validation_failed or prompt_variable_missing); with activate=true, the saved version cannot be activated (saved: true)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Prompts are not available on this deployment (code prompt_unavailable)' } /workflows/agents/{id}/versions: get: tags: [Workflow Agents] summary: List agent versions description: The append-only snapshot history, newest first, without the definitions. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } responses: '200': description: Versions content: application/json: schema: type: object properties: versions: type: array items: { $ref: '#/components/schemas/WorkflowAgentVersionSummary' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/versions/{v}: get: tags: [Workflow Agents] summary: Get one agent version description: One immutable snapshot with its definition. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: v, in: path, required: true, description: Version number, schema: { type: integer, minimum: 1 } } responses: '200': description: The snapshot content: application/json: schema: allOf: - { $ref: '#/components/schemas/WorkflowAgentVersionSummary' } - type: object properties: definition: { $ref: '#/components/schemas/WorkflowAgentDefinition' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/versions/{v}/diff: get: tags: [Workflow Agents] summary: Diff two agent versions description: | The changes of version `v` relative to the `against` baseline, as a list of JSON-pointer paths (tools keyed by name, coworkers as a set, scalars otherwise), sorted by path. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: v, in: path, required: true, description: The newer version, schema: { type: integer, minimum: 1 } } - { name: against, in: query, required: true, description: The baseline version, schema: { type: integer, minimum: 1 } } responses: '200': description: The diff content: application/json: schema: type: object properties: agent_id: { type: string, format: uuid } version: { type: integer } against: { type: integer } from: { type: integer, description: Same as against } to: { type: integer, description: Same as version } changes: type: array items: type: object properties: path: { type: string, example: /model/model } kind: { type: string, enum: [added, removed, modified] } from: { description: Old value (absent for added) } to: { description: New value (absent for removed) } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/versions/{v}/restore: post: tags: [Workflow Agents] summary: Restore an agent version description: | Copies snapshot `v` into the draft as a new version; history is never rewritten. Optimistic on `expected_version`. Archived agents cannot be edited. Requires editor access to the project and the `agent.write` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: v, in: path, required: true, description: Version to restore, schema: { type: integer, minimum: 1 } } requestBody: required: true content: application/json: schema: type: object required: [expected_version] properties: expected_version: { type: integer, minimum: 1 } responses: '200': description: Restored as a new draft version content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentWriteResult' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'The agent is archived (code agent_archived) or expected_version is stale (code version_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/agents/{id}/prompt/refresh: post: tags: [Workflow Agents] summary: Adopt the newest bound prompt version description: | Re-renders the prompt bound to the draft (`persona.promptRef`) at its newest version and saves the result as a new agent version. When the draft already uses the newest version, the unchanged agent is returned and no version is created. Requires editor access to the project and the `agent.write` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } responses: '200': description: The agent (refreshed, or unchanged when already current) content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentWriteResult' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The agent is archived (code agent_archived), the draft binds no prompt (code validation_failed), or a concurrent save won (code version_conflict)' } '422': description: 'The prompt no longer resolves, misses variables, or the refreshed definition is invalid (code validation_failed or prompt_variable_missing)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Prompts are not available on this deployment (code prompt_unavailable)' } /workflows/agents/{id}/activate: post: tags: [Workflow Agents] summary: Activate an agent version description: | Validates snapshot `version` (default, including for `{}`: the current draft version) at activation strictness (connections, referenced workflows and agents in the same project with active versions, the bound prompt, pinned knowledge entries) and makes it the agent's active version. `expected_checksum` refuses the call when the snapshot differs. An archived agent cannot be activated — unarchive it first. Requires editor access to the project and the `agent.activate` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object properties: version: { type: integer, description: 'Default: the current draft version' } expected_checksum: { type: string } responses: '200': description: Activated content: application/json: schema: type: object properties: agent_id: { type: string, format: uuid } active_version: { type: integer } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'The agent is archived (code agent_archived), or checksum mismatch (code checksum_mismatch, with version and checksum)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '422': description: The version cannot be activated (code validation_failed) content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/agents/{id}/deactivate: post: tags: [Workflow Agents] summary: Deactivate an agent description: Clears the active version. Idempotent. Requires editor access to the project and the `agent.activate` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } responses: '200': description: Deactivated content: application/json: schema: type: object properties: agent_id: { type: string, format: uuid } active_version: { type: integer, nullable: true, description: Always null } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/archive: post: tags: [Workflow Agents] summary: Archive an agent description: | Deactivates the agent and hides it from the tool pickers; archived agents cannot be edited or run. Archiving an active agent also needs the `agent.activate` permission. Requires editor access to the project and the `agent.write` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } responses: '200': description: The archived agent content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentWriteResult' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/unarchive: post: tags: [Workflow Agents] summary: Unarchive an agent description: Clears the archive mark. The agent returns without an active version; activate it explicitly. Requires editor access to the project and the `agent.write` permission. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } responses: '200': description: The agent content: application/json: schema: { $ref: '#/components/schemas/WorkflowAgentWriteResult' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/runs: get: tags: [Workflow Agents] summary: List an agent's runs description: | Every run of this agent across executions, newest first, with keyset pagination: pass `next_cursor` back as `cursor`. A run still in flight reports status `submitted`, zero counters and a null `finished_at` until it settles (the execution's journal is the live truth). Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: version, in: query, description: Only runs of this agent version, schema: { type: integer, minimum: 1 } } - { name: status, in: query, schema: { type: string, enum: [submitted, completed, canceled, failed] } } - { name: mode, in: query, schema: { type: string, enum: [production, test, partial, retry, subworkflow] } } - { name: window, in: query, description: 'Only runs started within this window: a day count (1-365) or a duration such as 24h (at most 365 days)', schema: { type: string } } - { name: cursor, in: query, description: Opaque cursor from next_cursor, schema: { type: string } } - { name: limit, in: query, description: 'Page size, 1-200; default 50', schema: { type: integer, default: 50, minimum: 1, maximum: 200 } } responses: '200': description: One page of runs content: application/json: schema: type: object properties: runs: type: array items: { $ref: '#/components/schemas/WorkflowAgentRun' } next_cursor: { type: string, description: Present when another page exists } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Workflow Agents] summary: Run an agent (chat or API call) description: | Starts one execution of the agent, either from a chat `message` (wrapped as one item, with the conversation before it in `messages`) or from raw `input` items. The agent keeps no conversation of its own, so a chat sends its prior turns with every message; they open the agent's conversation as real turns (the newest 50 within 64 KiB of text are kept). Runs the active version, or `version` when given. `mode` defaults to `test`, so trying an agent never writes into production memory; `production` is honored only for the active version (any other pinned version runs as a test). The version that would run must allow chat (`exposure.chat`). The response follows POST /workflows/{id}/executions: 202 with the execution id, or with `wait: true` the terminal execution when it finishes within 30 seconds. An `Idempotency-Key` header deduplicates retries. Stream progress with GET /workflows/executions/{id}/listen. Requires editor access to the project and the `execution.run` permission (members and above). parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: Idempotency-Key, in: header, description: A retried request with the same key returns the original execution with 200, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object properties: message: { type: string, description: Chat message; required unless input is given } messages: type: array description: 'The turns before `message`, oldest first. Only with `message`; roles other than user and assistant are refused, empty turns are dropped.' items: type: object required: [role, content] properties: role: { type: string, enum: [user, assistant] } content: { type: string } input: { description: 'Raw trigger items: an array of {"json": {…}} items, or one object wrapped as a single item' } version: { type: integer, description: 'Agent version to run (default: the active version)' } wait: { type: boolean, default: false } mode: { type: string, enum: [test, production], default: test } responses: '200': description: 'Idempotent replay (execution_id, status), or with wait the finished execution' content: application/json: schema: oneOf: - { $ref: '#/components/schemas/WorkflowRunAccepted' } - type: object properties: execution: { $ref: '#/components/schemas/WorkflowExecution' } '202': description: Run accepted (or still running after the wait budget) content: application/json: schema: { $ref: '#/components/schemas/WorkflowRunAccepted' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Agent or agent version not found } '409': { description: 'The agent is archived (code agent_archived), has no active version and no version was given (code agent_inactive), or the version does not allow chat runs (code agent_chat_disabled)' } /workflows/agents/{id}/stats: get: tags: [Workflow Agents] summary: Get per-version run statistics description: Run counts, spend, token totals and turn percentiles of the agent, one row per agent version, newest version first. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: window, in: query, description: 'Only runs started within this window: a day count (1-365) or a duration such as 24h', schema: { type: string } } responses: '200': description: Statistics content: application/json: schema: type: object properties: stats: type: array items: { $ref: '#/components/schemas/WorkflowAgentStats' } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/card: get: tags: [Workflow Agents] summary: Get the agent card description: | A read-only, A2A-style card: name, description, active version, the run URL, the tools as skills and the exposure settings, taken from the active version (the draft when none is active). No credentials and no instructions. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } responses: '200': description: The card content: application/json: schema: type: object properties: name: { type: string } slug: { type: string } description: { type: string } version: { type: integer, nullable: true, description: The active version } url: { type: string, description: 'The run endpoint, /api/v1/workflows/agents/{id}/runs' } skills: type: array items: type: object properties: name: { type: string } description: { type: string } exposure: { $ref: '#/components/schemas/WfAgentExposure' } input_modes: { type: array, items: { type: string }, example: [text, application/json] } output_modes: { type: array, items: { type: string }, example: [text, application/json] } '404': { $ref: '#/components/responses/NotFound' } /workflows/agents/{id}/workflows: get: tags: [Workflow Agents] summary: List workflows that use an agent description: The project's workflows whose draft references this agent through a `crios.agent` v2 node in reference mode (`source` `agent`, its default) — at the top level or inside a container's graph, disabled nodes included — most recently updated first. Nodes carrying an inline definition and v1 agent nodes do not count. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, description: Agent ID, schema: { type: string, format: uuid } } - { name: limit, in: query, description: 'Page size; default 50, values above 200 are capped', schema: { type: integer, default: 50, minimum: 1 } } - { name: offset, in: query, schema: { type: integer, default: 0, minimum: 0 } } responses: '200': description: Workflows content: application/json: schema: type: object properties: workflows: type: array items: type: object properties: id: { type: string, format: uuid } project_id: { type: string, format: uuid } name: { type: string } version: { type: integer } active_version: { type: integer, nullable: true } updated_at: { type: string, format: date-time } created_at: { type: string, format: date-time } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } /workflows/node-types: get: tags: [Workflow Node Types] summary: List node-type descriptors description: Every registered node type at every registered version, ordered by type then version. Any authenticated user may read it. responses: '200': description: Node types content: application/json: schema: type: object properties: node_types: type: array items: { $ref: '#/components/schemas/WorkflowNodeType' } /workflows/node-types/{type}: get: tags: [Workflow Node Types] summary: Get one node type description: Every registered version of one node type, oldest first. Any authenticated user may read it. parameters: - { name: type, in: path, required: true, description: 'Node type, e.g. crios.slack', schema: { type: string } } responses: '200': description: The versions of the type content: application/json: schema: type: object properties: node_types: type: array items: { $ref: '#/components/schemas/WorkflowNodeType' } '404': { $ref: '#/components/responses/NotFound' } /workflows/node-types/{type}/options/{name}: post: tags: [Workflow Node Types] summary: Resolve dynamic parameter options description: | Runs the node type's named option resolver (listed in the descriptor's `options`) with the node's current parameters and, when bound, its project-scoped connections, and returns the entries a picker renders. Only labels and values come back, never secret material. Without `type_version` the newest version of the type is used. When the request references a project (`project_id`, or `parameters.projectId`), the caller needs viewer access to it and the resolver sees that project as `parameters.projectId`; `project_id` is required as soon as `credentials` are bound. Org-role viewers may call it (a read-shaped POST). parameters: - { name: type, in: path, required: true, description: Node type, schema: { type: string } } - { name: name, in: path, required: true, description: Resolver name, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object properties: parameters: { type: object, additionalProperties: true, description: The node's current parameters (camelCase document fragment) } credentials: type: object description: The node's current slot bindings additionalProperties: { $ref: '#/components/schemas/WfNodeCredentialRef' } query: { type: string, description: Search text typed into the picker } project_id: { type: string, format: uuid } type_version: { type: integer, description: Defaults to the newest registered version } responses: '200': description: Options content: application/json: schema: type: object properties: options: type: array items: type: object properties: value: { type: string } label: { type: string } meta: { type: object, additionalProperties: { type: string }, description: Renderer hints } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Unknown type, version or resolver; or the referenced project is not accessible' } '503': { description: 'Credential resolution unavailable, or the upstream service failed transiently (code unavailable)' } /workflows/templates: get: tags: [Workflow Templates] summary: List workflow templates description: | The caller's organization gallery, metadata only, newest update first. The first call for an organization seeds the built-in starter templates. Any member of the organization may read it. parameters: - { name: q, in: query, description: Case-insensitive substring match on the name, schema: { type: string } } - { name: tags, in: query, description: 'Comma-separated tags (the parameter may repeat); a template must carry all of them', schema: { type: string } } - { name: limit, in: query, description: 'Page size; default 50, capped at 200', schema: { type: integer, default: 50, maximum: 200 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: Templates content: application/json: schema: type: object properties: templates: type: array items: { $ref: '#/components/schemas/WorkflowTemplateSummary' } total: { type: integer } post: tags: [Workflow Templates] summary: Publish a workflow as a template description: | Publishes a document to the organization gallery. Every credential binding is removed (templates carry unbound connection slots), `meta.generation` is dropped, and the document's id, project, tags and version are reset; the template name defaults to and replaces the document name. The document must pass the save gate. Requires an org role of member or above. requestBody: required: true content: application/json: schema: type: object required: [definition] properties: name: { type: string, maxLength: 200, description: Defaults to the document name } description: { type: string, maxLength: 2000 } tags: { type: array, maxItems: 20, items: { type: string, maxLength: 40 } } definition: { $ref: '#/components/schemas/WorkflowDocument' } responses: '201': description: Published content: application/json: schema: type: object properties: template: { $ref: '#/components/schemas/WorkflowTemplate' } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: 'A template with this name exists in the organization (code name_conflict)' } '422': description: The document has blocking validation errors (code validation_failed) content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/templates/{id}: get: tags: [Workflow Templates] summary: Get a workflow template description: The full template including its document. Templates of other organizations answer 404. parameters: - { name: id, in: path, required: true, description: Template ID, schema: { type: string, format: uuid } } responses: '200': description: The template content: application/json: schema: type: object properties: template: { $ref: '#/components/schemas/WorkflowTemplate' } '404': { $ref: '#/components/responses/NotFound' } /workflows/templates/{id}/instantiate: post: tags: [Workflow Templates] summary: Instantiate a template into a project description: | Creates the template's agents (from the `agentBrief` of each `crios.agent` node, as unpublished drafts) and the workflow that wires them, in one transaction: either everything is created or nothing is. A name that is already taken gets a numeric suffix ("Crew 2", "Crew 3", …). The response carries the workflow's setup checklist, since the new agents still need a model and the nodes may need connections. Requires editor access to the target project with both the `workflow.write` and `agent.write` permissions, and counts against the organization's workflow cap. parameters: - { name: id, in: path, required: true, description: Template ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [project_id] properties: project_id: { type: string, format: uuid, description: Target project (projectId is accepted too) } name: { type: string, description: Overrides the workflow name } responses: '201': description: Instantiated content: application/json: schema: type: object properties: workflow_id: { type: string, format: uuid } agent_ids: { type: array, items: { type: string, format: uuid } } workflow: { $ref: '#/components/schemas/WorkflowDocument' } agents: type: array items: { $ref: '#/components/schemas/WorkflowAgentSummary' } issues: type: array items: { $ref: '#/components/schemas/WorkflowValidationIssue' } setup: { $ref: '#/components/schemas/WorkflowSetupChecklist' } needs_setup: { type: boolean } '400': { $ref: '#/components/responses/BadRequest' } '403': description: 'Viewer role, insufficient project access or permission, or the organization reached its workflow cap (code workflow_limit_reached)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '404': { description: Template or project not found } '409': { description: 'No free name was found (code name_conflict)' } '422': description: 'The template cannot be instantiated: an inline agent (code template_inline_agent), an agent node without a usable brief (code template_agent_brief), or a document or agent definition that fails validation (code validation_failed)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/credential-types: get: tags: [Workflow Connector Catalog] summary: List credential types and schemas description: | Every registered connection type with its config and secrets JSON Schemas, so a client can render a create form for any of them. Declarations only, never values. Not project-scoped; any authenticated user may read it. Superseded by GET /workflows/credential-services (same fields plus catalog metadata) and kept as an alias. responses: '200': description: Credential types content: application/json: schema: type: object properties: credential_types: type: array items: { $ref: '#/components/schemas/WfCredentialTypeEntry' } /workflows/credential-services: get: tags: [Workflow Connector Catalog] summary: List the connection service catalog description: | The connection catalog: every registered credential type with its form schemas and catalog metadata (label, category, provider, logo, docs link, whether a Test applies, the operator's enabled flag, who a connection acts as, the node types that consume it), followed by the MCP catalog rows (`auth_method` mcp_oauth, mcp_token or mcp_open, null schemas). Disabled services are still listed because existing connections of that type need their schema; clients hide them from creation. Same handler and envelope as GET /workflows/connectors/catalog. Not project-scoped; any authenticated user may read it. parameters: - { name: q, in: query, description: 'Case-insensitive search over the service key, provider, display name, categories and keywords', schema: { type: string } } - { name: category, in: query, description: Keep services carrying this category, schema: { type: string } } - { name: provider, in: query, description: Keep one provider's services, schema: { type: string } } responses: '200': description: The catalog content: application/json: schema: type: object properties: credential_services: type: array items: { $ref: '#/components/schemas/WfCredentialServiceEntry' } /workflows/project-database: post: tags: [Workflow Credentials] summary: Create the project database description: | Creates the project's own database, or returns it when it already exists (idempotent), and answers with the connection that database nodes, database triggers and memory nodes bind ("Project database", "Project database (sandbox)"). This is the connection picker's create action; it provisions the project's own database (on the shared crios-project-db, or on the project's dedicated instance), never in the control-plane database. `tier` is `durable` (default, the published app's store) or `sandbox` (the copy a build session writes). `engine` is `postgres` (default) or `mysql`; a durable MySQL store is created by the first publish, not here. Requires editor access to the project and the `credential.write` permission. Sandbox (session) tokens are refused: creating a project database is a person's decision. requestBody: required: true content: application/json: schema: type: object required: [project_id] properties: project_id: { type: string, format: uuid } engine: { type: string, enum: [postgres, mysql], default: postgres } tier: { type: string, enum: [durable, sandbox], default: durable } responses: '200': description: The project database and its connection content: application/json: schema: type: object properties: connection: type: object description: Summary of the minted connection (no secret material) properties: id: { type: string, format: uuid } name: { type: string } cred_type: { type: string } created_at: { type: string, format: date-time } updated_at: { type: string, format: date-time } expires_at: { type: string, format: date-time, nullable: true } last_used_at: { type: string, format: date-time, nullable: true } method: { type: string } provider: { type: string } actor: { type: string, enum: [service, individual] } status: { type: string } managed: type: object properties: kind: { type: string, enum: [store, byo] } engine: { type: string } tier: { type: string, enum: [durable, sandbox] } store: { type: string, description: Registry name of the store } store: type: object properties: engine: { type: string } tier: { type: string } name: { type: string } status: { type: string, description: 'For example ready, hibernated or waking' } '400': description: 'Invalid body or tier, or an engine this deployment or tier cannot provision here (code unsupported_engine)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '403': { description: 'Viewer role, insufficient project access, or a sandbox token (code user_action_required)' } '404': { description: Project not found or not accessible } '409': { description: 'The project already runs the other relational engine (code relational_engine_conflict)' } '503': { description: 'Project databases are not configured on this deployment (code project_storage_unavailable), or the credential registry is unavailable' } # ==================== WORKFLOWS: CONNECTIONS, CATALOG, TELEGRAM, DATA STORES, MEMORY, VARIABLES, TRIGGERS, WAITS, ARTIFACTS ==================== /workflows/credentials: get: tags: [Workflow Credentials] summary: List a project's workflow connections description: | The feed of the builder's connection picker and the Connectors page. Requires viewer access to the project. `cred_type` keeps the rows that satisfy a slot of that type, which includes connected-account bridge rows resolving as it (a `slack` slot also lists `integration_hub:slack` rows). Sorted by name, case-insensitive. Connections minted for the project's own databases carry `managed`. Config, secrets and Vault paths are never returned. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: cred_type, in: query, description: 'Credential type a slot needs, for example postgres or slack', schema: { type: string } } responses: '200': description: Connection summaries content: application/json: schema: type: object properties: credentials: type: array items: { $ref: '#/components/schemas/WfCredSummary' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Credential registry not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } post: tags: [Workflow Credentials] summary: Create a workflow connection description: | Creates a connection of any registered type in a project. Requires editor access to the project and an organization role of member or above. `config` and `secrets` are validated against the type's schemas (listed by GET /workflows/connectors/catalog) and at least one secret is required. Secrets go to Vault before the row exists and are never returned; validation errors name fields, never submitted values. Refused with 400: an unknown type, a service an operator disabled, the `telegram` type (use POST /workflows/integrations/telegram, which verifies the token and starts the poller), and a browser-flow OAuth2 type without `config.client_id` and `secrets.client_secret`, or with `config.client_source` set to `application` (use POST /workflows/connectors/connect). This is the only connector write a sandbox (agent) token may perform. Refused with 409 `minted_connection`: the `signing_identity` type. That connection is minted when an organization admin grants a signing identity to the project and removed when the grant is withdrawn (POST /organizations/{id}/signing/identities/{sid}/grants, DELETE /organizations/{id}/signing/identities/{sid}/grants/{pid}); it cannot be created, edited or deleted through this API. Also refused with 400, with a code of its own and a `fields` array of names (never values): a `config` that carries an address key the type's schema does not declare — `allowed_domains`, `allowed_hosts`, `base_url`, `endpoint`, `host`, `server` or `url`, under any casing (code `undeclared_address_key`) — and a declared address field whose host is not plain ASCII (code `address_host_not_ascii`; write an internationalized name in its `xn--` form). A connection's secret is sent only to an address its type declares. requestBody: required: true content: application/json: schema: type: object required: [project_id, type, name] properties: project_id: { type: string, format: uuid } type: { type: string, description: 'Credential type key, for example postgres or http' } name: { type: string, description: 'Display name, unique per project and type' } config: { type: object, additionalProperties: true, description: 'Non-secret settings, validated against the type config schema' } secrets: type: object writeOnly: true additionalProperties: { type: string } description: Secret fields, validated against the type secrets schema. Write-only. expires_at: { type: string, format: date-time, description: 'Optional RFC 3339 expiry; empty or absent means none' } responses: '201': description: Created. The summary only, never the secret. content: application/json: schema: { $ref: '#/components/schemas/WfCredSummary' } '400': description: | Invalid request (code invalid_request); an address key the type does not declare (code undeclared_address_key, with `fields`); or a host outside plain ASCII in a declared address field (code address_host_not_ascii, with `fields`). Nothing was written. content: application/json: schema: type: object properties: error: { type: string } code: { type: string, enum: [invalid_request, undeclared_address_key, address_host_not_ascii] } fields: type: array items: { type: string } description: 'undeclared_address_key and address_host_not_ascii only: the config key names (names, never values)' '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'A connection of this type with this name already exists in the project (code name_conflict), or the type is minted by a grant and cannot be created here (code minted_connection: signing_identity). Nothing was written.' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Credential registry not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/credentials/{id}: get: tags: [Workflow Credentials] summary: Get one workflow connection description: | The summary plus the non-secret `config` document the edit form renders. Requires viewer access to the project named by `project_id`; a connection of another project answers 404. Secrets are never returned. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: The connection content: application/json: schema: { $ref: '#/components/schemas/WfCredDetail' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Credential registry not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } delete: tags: [Workflow Credentials] summary: Delete a workflow connection description: | Deletes the row and its Vault secret. Refused with 409 while the ACTIVE version of any workflow in the project binds it (the message names those workflows); draft bindings do not block. Telegram bots are refused with 400 (use DELETE /workflows/integrations/telegram/{id}). A `signing_identity` connection is refused with 409 `minted_connection`: it goes when the organization withdraws the signing grant. Requires editor access to the project and member role; sandbox tokens get 403. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Deleted } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Bound by the active version of one or more workflows (code credential_in_use), or a connection minted by a grant (code minted_connection: signing_identity). Nothing was deleted.' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Credential registry not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } patch: tags: [Workflow Credentials] summary: Update or rotate a workflow connection description: | Renames, replaces `config`, rotates `secrets` (the whole secret document is replaced) or changes `expires_at`, in any combination; a body with none of these answers 400. `expires_at` is tri-state: absent keeps it, `null` clears it, an RFC 3339 string sets it. Requires editor access to the project and member role; sandbox tokens get 403. Telegram bots are refused with 400 (use PATCH /workflows/integrations/telegram/{id}). A `signing_identity` connection is refused with 409 `minted_connection`, a rename or an expiry change included: it changes only with the organization's signing grant. Nothing secret is returned. A `config` that changes a destination field must be sent together with `secrets`. Every config field is a destination field unless the type exempts it — not only hosts, ports and TLS settings but, for example, an SMTP port, an S3 region, a MySQL database name, a service account's scopes — and so is any key the type's schema does not declare; the catalog lists the declared ones per type as `destination_fields`. `config` replaces the whole document and is compared whole: resend every stored key you are not changing, including the system-managed ones the forms hide (`client_source` on an OAuth connection, a Custom API's `allowed_domains`). Leaving one out is a removal, and removing a destination field is a change. Without them the answer is 400 with code `secret_reentry_required` and a `fields` array naming the changed fields, and nothing is written. A connected-account connection (`integration_hub:*`) and one of the project's own databases accept a rename or expiry change only; a connection on the application OAuth client refuses a destination change outright. A `config` that carries an address key the type's schema does not declare (`allowed_domains`, `allowed_hosts`, `base_url`, `endpoint`, `host`, `server`, `url`, under any casing) is refused with code `undeclared_address_key`, with or without `secrets`; a declared address field whose host is not plain ASCII with code `address_host_not_ascii`. Both carry `fields`. A stored connection that already holds an undeclared address key is not refused for it: the key is ignored by every reader and is not a destination field, so leave it out of the `config` you send and it is dropped. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object properties: name: { type: string } config: { type: object, additionalProperties: true, description: 'Replaces the whole non-secret config document' } secrets: type: object writeOnly: true additionalProperties: { type: string } description: Replaces the whole secret document. Write-only. expires_at: { type: string, format: date-time, nullable: true, description: 'RFC 3339 to set, null to clear, absent to keep' } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/WfCredSummary' } '400': description: | Invalid request (code invalid_request); a destination change without the secret (code secret_reentry_required, with `fields`); an address key the type does not declare (code undeclared_address_key, with `fields`); or a host outside plain ASCII in a declared address field (code address_host_not_ascii, with `fields`). Nothing was written. content: application/json: schema: type: object properties: error: { type: string } code: { type: string, enum: [invalid_request, secret_reentry_required, undeclared_address_key, address_host_not_ascii] } fields: type: array items: { type: string } description: 'The config field or key names the refusal is about (names, never values); absent for invalid_request' '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'Name already in use in the project (code name_conflict; when the same request also carried config or secrets, those WERE written and audited), the connection stayed locked by another change for the whole wait (code credential_busy; nothing was written, retry), or the connection is minted by a grant (code minted_connection: signing_identity; nothing was written)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '503': { description: 'Credential registry not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/credentials/{id}/test: post: tags: [Workflow Credentials] summary: Run a connection's connectivity test description: | Resolves the connection server-side and runs its service's connectivity check (the Test button). Requires editor access to the project and member role, because the test reads the secret and dials out with it; each result is audited. The answer never contains a URL, a header or a secret value. Services without a test answer 400 with the error envelope. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: The check passed content: application/json: schema: { $ref: '#/components/schemas/WfCredTestResult' } '400': description: The service rejected the credential (reason rejected), the stored credential is unusable (reason invalid), or the service has no connectivity test (error envelope, code invalid_request) content: application/json: schema: oneOf: - { $ref: '#/components/schemas/WfCredTestResult' } - { $ref: '#/components/schemas/WorkflowApiError' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '502': description: The service could not be reached (reason unreachable) content: application/json: schema: { $ref: '#/components/schemas/WfCredTestResult' } '503': { description: 'Credential resolution not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/credentials/{id}/oauth2/authorize: post: tags: [Workflow Credentials] summary: Start the OAuth2 connect flow description: | Begins the authorization-code flow for an existing OAuth2 connection and returns the provider URL to open. The single-use state is stored server-side for 15 minutes, with a PKCE verifier where the provider uses one; the provider then redirects to GET /api/v1/workflows/oauth2/callback. `return_to` must be an in-app path or a URL on this deployment's host. Requires editor access to the project and member role; sandbox tokens get 403. Answers 503 `oauth2_not_configured` when the deployment has no public base URL (`CRIOS_PUBLIC_BASE_URL`). A `signing_identity` connection answers 409 `minted_connection`. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } requestBody: required: false content: application/json: schema: type: object properties: return_to: { type: string, description: 'Where the callback sends the browser afterwards (default /)' } responses: '200': description: Provider authorize URL content: application/json: schema: type: object properties: authorize_url: { type: string } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The connection is minted by a grant (code minted_connection: signing_identity)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '503': description: 'OAuth2 connect not configured (code oauth2_not_configured) or registry unavailable' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/oauth2/callback: get: tags: [Workflow Credentials] summary: OAuth2 connect callback (public) description: | The provider's redirect target after consent. Public: served on the root router, because no bearer token survives the cross-site hop. The single-use `state` (valid 15 minutes) is the whole credential. On success the code is redeemed, the tokens are stored (completing a pending one-shot connection) and the answer is a 302 to the flow's `return_to` with `connected=` added. On failure the answer is a 302 to `/?oauth_error=`, where code is `oauth_state_invalid` (unknown, used or expired state), `oauth_invalid_request` or `oauth_exchange_failed`. When the provider redirects with `error` instead of a code (for example a declined consent), the state is consumed so it cannot be redeemed later, and the answer is a 302 to the flow's `return_to` (to `/` when the state is unknown or expired) with `oauth_error` set to `oauth_access_denied` for `error=access_denied` and to `oauth_provider_error` for anything else. The provider's own error text is never forwarded. A redirect with neither `error` nor both `code` and `state` answers 400 JSON. Rate limited per client IP. security: [] parameters: - { name: code, in: query, required: false, schema: { type: string }, description: Present on success } - { name: state, in: query, required: false, schema: { type: string } } - { name: error, in: query, required: false, schema: { type: string }, description: 'The provider refused the request (for example access_denied)' } responses: '302': { description: 'Redirect to return_to with connected=, or with oauth_error= (to / when the state is unknown)' } '400': { description: 'code or state missing and no provider error (code invalid_request)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '429': { description: Rate limit exceeded } '503': description: 'OAuth2 connect not configured (code oauth2_not_configured)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/connectors/connect: post: tags: [Workflow Credentials] summary: Create and connect an OAuth2 connection description: | The one-shot "Connect" action: creates a `pending` connection owned by the caller and starts its authorization-code flow in one call. With `client_source` `application` the deployment's application OAuth client is used and no client fields are stored on the row; with `own` (the default) `config.client_id` and `secrets.client_secret` are required. `scopes` replaces the type's default scope set. `name` is optional: the callback renames the row after the connected account, and a provisional name gets a numeric suffix on collision. A row still pending 15 minutes after its last write is removed by a sweep. Requires editor access to the project and member role; sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [project_id, type] properties: project_id: { type: string, format: uuid } type: { type: string, description: 'A browser-flow OAuth2 credential type' } name: { type: string } client_source: { type: string, enum: [own, application], default: own } scopes: { type: array, items: { type: string } } config: { type: object, additionalProperties: true } secrets: type: object writeOnly: true additionalProperties: { type: string } return_to: { type: string, description: 'In-app path or URL on this deployment host' } responses: '201': description: Pending connection and the provider URL to open content: application/json: schema: type: object properties: credential: { $ref: '#/components/schemas/WfCredSummary' } authorize_url: { type: string } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'No application OAuth client resolves for the service (code no_application_client), or the chosen name is taken (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': description: 'OAuth2 connect not configured (code oauth2_not_configured) or registry unavailable' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/connectors/from-account: post: tags: [Workflow Credentials] summary: Connect a hub account as a project connection description: | Grants a connected account the caller owns (from the integrations hub) to the project and returns the bridge connection (`integration_hub:`) that node slots bind. Idempotent: an existing bridge row is refreshed and returned with 200. Another person's account id answers 404. Accounts whose provider has no bridge on this deployment answer 400. Requires editor access to the project and member role; sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [project_id, account_id] properties: project_id: { type: string, format: uuid } account_id: { type: string, format: uuid, description: 'The caller''s own integrations-hub account' } responses: '200': description: The bridge connection already existed content: application/json: schema: { $ref: '#/components/schemas/WfCredSummary' } '201': description: Bridge connection created content: application/json: schema: { $ref: '#/components/schemas/WfCredSummary' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'No free name for the connection (code name_conflict)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '503': description: 'Registry or integrations hub not configured (code unavailable)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/connectors/catalog: get: tags: [Workflow Connector Catalog] summary: List the connector catalog description: | Every registered credential type with the metadata and field schemas the create form renders (declarations only, never values), plus the remote MCP catalog rows. Any authenticated user; not project-scoped. Services an operator disabled are still listed with `enabled: false` so existing connections keep their edit form; clients hide them from creation. MCP rows (`auth_method` mcp_oauth, mcp_token or mcp_open) have null schemas; connections to them are made through POST /mcp/connections, not as workflow credentials. Same feed and filters as GET /workflows/credential-services. parameters: - { name: q, in: query, description: 'Case-insensitive substring over key, provider, display name, categories and keywords', schema: { type: string } } - { name: category, in: query, description: 'Keep services carrying this category tag', schema: { type: string } } - { name: provider, in: query, description: 'Keep one provider card', schema: { type: string } } responses: '200': description: Catalog entries content: application/json: schema: type: object properties: credential_services: type: array items: { $ref: '#/components/schemas/WfConnCatalogEntry' } '401': { $ref: '#/components/responses/Unauthorized' } /workflows/connectors/catalog/usage: get: tags: [Workflow Connector Catalog] summary: Count connections per catalog type description: | Connection counts per credential type across the whole deployment (every organization), for the connector catalog. Counts only: never names, projects or secret material. Requires an instance admin who is also owner or admin of the active organization; an organization owner or admin without the instance-admin flag gets 403. responses: '200': description: Counts keyed by credential type content: application/json: schema: type: object properties: usage: type: object additionalProperties: { $ref: '#/components/schemas/WfConnCatalogUsage' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } /workflows/connectors/catalog/{service}: put: tags: [Workflow Connector Catalog] summary: Add, edit or disable a catalog entry description: | Requires an instance admin who is also owner or admin of the active organization: the catalog is deployment-wide, shared by every organization, so an organization owner or admin without the instance-admin flag gets 403. API tokens never carry the flag. What the body may set depends on the key: - A code-registered credential type: only `enabled` (required), the operator kill-switch. Existing connections of a disabled type keep resolving. - A seeded MCP row: only `enabled` and `mcp_endpoint` (https). - Any other key creates or updates a catalog-defined row: `display_name` is required and `auth_method` must be one of secret, http_bearer, http_basic, http_header or http_query, or an MCP method (mcp_oauth, mcp_token, mcp_open) with an https `mcp_endpoint`. `categories` come from a closed vocabulary (default generic), `doc_url` must be https and `logo` a `/logos/` path. The row is usable immediately, without a restart. Directory placement applies to any existing row, before the rules above: `rank` and `copy` set the operator's overrides of the directory order and card copy, and `reset_rank` / `reset_copy` clear them back to the platform's seed. A body with only placement fields answers `{"service", "placement": true}`; one that also carries other fields continues with the rules above. Placement on a key with no catalog row is 404. The service key must be a lowercase token (letters, digits, `-`, `_`). parameters: - { name: service, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/WfConnCatalogUpsert' } responses: '200': description: Saved content: application/json: schema: type: object properties: service: { type: string } source: { type: string, enum: [code, db] } enabled: { type: boolean } auth_method: { type: string, description: 'Catalog-defined rows only' } placement: { type: boolean, description: 'Only for a placement-only body: always true' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Placement fields on a key with no catalog row (code not_found)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } delete: tags: [Workflow Connector Catalog] summary: Remove a catalog-defined entry description: | Deletes a catalog-defined (source db) row. Code-registered services cannot be deleted (400; disable them instead), and a type that still has connections answers 409. Requires an instance admin who is also owner or admin of the active organization. parameters: - { name: service, in: path, required: true, schema: { type: string } } responses: '204': { description: Removed } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Connections of this type still exist (code service_in_use)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/connectors/oauth-clients/{service}: get: tags: [Workflow Connector Catalog] summary: Get a service's application OAuth client description: | The deployment's application OAuth client for one browser-flow OAuth2 type or MCP catalog row: the stored client id, whether a secret is stored (never the secret), what a connect would run on, and the redirect URIs to whitelist at the provider. The client is deployment-wide (every organization's connections use it), so this requires an instance admin who is also owner or admin of the active organization. Other services answer 404. parameters: - { name: service, in: path, required: true, schema: { type: string } } responses: '200': description: Client status content: application/json: schema: { $ref: '#/components/schemas/WfConnOAuthClient' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Secret storage unavailable (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } put: tags: [Workflow Connector Catalog] summary: Store a service's application OAuth client description: | Stores the client in Vault. `client_secret` is write-only; an empty or absent one keeps the stored secret. Requires an instance admin who is also owner or admin of the active organization. parameters: - { name: service, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object required: [client_id] properties: client_id: { type: string } client_secret: { type: string, writeOnly: true } responses: '200': description: Client status after the write content: application/json: schema: { $ref: '#/components/schemas/WfConnOAuthClient' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Secret storage unavailable (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } delete: tags: [Workflow Connector Catalog] summary: Remove a service's application OAuth client description: Requires an instance admin who is also owner or admin of the active organization. parameters: - { name: service, in: path, required: true, schema: { type: string } } responses: '204': { description: Removed } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Secret storage unavailable (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/integrations/telegram: get: tags: [Workflow Telegram] summary: List a project's workflow Telegram bots description: Requires viewer access to the project. Never returns bot tokens. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Bots content: application/json: schema: type: object properties: bots: type: array items: { $ref: '#/components/schemas/WfTelegramBot' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } post: tags: [Workflow Telegram] summary: Add a workflow Telegram bot description: | Verifies the token with Telegram's getMe before anything is stored, then saves a `telegram` connection (token in Vault) and starts the poller. Refused with 409 when the token belongs to one of the deployment's Session/Chat bots, or when the same bot is already registered in the project. `bot_type` defaults to `approvals`; a misspelled value answers 400. Requires editor access to the project and member role; sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [project_id, name, token] properties: project_id: { type: string, format: uuid } name: { type: string } token: { type: string, writeOnly: true, description: 'Bot token from @BotFather' } bot_type: { type: string, enum: [notify, approvals], default: approvals } responses: '201': description: Bot added (status pending until the first poll) content: application/json: schema: { $ref: '#/components/schemas/WfTelegramBot' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Session/Chat bot token (code telegram_session_bot), bot already registered in the project (code telegram_bot_registered), or name taken (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '502': description: 'Telegram could not be reached to verify the token (code unavailable)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/integrations/telegram/{id}: delete: tags: [Workflow Telegram] summary: Remove a workflow Telegram bot description: | Deletes the bot's connection and Vault secret, stops its poller and drops its known chats and user links. Refused with 409 while the ACTIVE version of any workflow in the project binds the bot (a Telegram trigger, or an approval's delivery slot) — the message names those workflows; draft bindings do not block, exactly like DELETE /workflows/credentials/{id}. Only `telegram` connections are accepted here. Requires editor access to the project and member role; sandbox tokens get 403. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Removed } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Bound by the active version of one or more workflows (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } patch: tags: [Workflow Telegram] summary: Rotate a bot token or change its type description: | Send `token`, `bot_type` or both. A new token is verified with getMe like on create; switching to a different bot resets the poll cursor and the cached chats. Changing only `bot_type` keeps the token. Renaming is not supported (delete and add again). Requires editor access to the project and member role; sandbox tokens get 403. parameters: - { name: id, in: path, required: true, description: 'The bot connection id', schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object properties: token: { type: string, writeOnly: true } bot_type: { type: string, enum: [notify, approvals] } responses: '200': description: Updated bot content: application/json: schema: { $ref: '#/components/schemas/WfTelegramBot' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Session/Chat bot token (code telegram_session_bot), or the bot is already registered in the project (code telegram_bot_registered)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '502': { description: 'Telegram could not be reached (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/integrations/telegram/{id}/chats: get: tags: [Workflow Telegram] summary: List the chats a bot has seen description: | The conversations the bot's poller has seen (the builder's chat id picker), most recently seen first, at most 50. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: q, in: query, description: 'Substring of the title, username or chat id', schema: { type: string } } responses: '200': description: Chats content: application/json: schema: type: object properties: chats: type: array items: { $ref: '#/components/schemas/WfTelegramChat' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/integrations/telegram/{id}/connect: post: tags: [Workflow Telegram] summary: Mint a personal connect link for a bot description: | Returns a t.me deep link carrying a single-use bind token for the CALLER, valid 10 minutes; opening it in Telegram links the caller's account to their private chat with the bot. This is the only way to link a chat. The link is personal and must not be shared (the bot's `share_link` is the shareable one: /start there points a person back here). A new link revokes the caller's earlier links for the bot, and a link opened in a group is spent without linking. A caller already linked from another chat is moved to the chat that opens the new link; the bot tells the old chat. The mint is recorded in the audit log as `telegram_link.mint`, with the request's attribution, and the bind as `telegram_link.connect`; both carry the token's `token_ref`. Only a browser session mints a link: a personal API token, an OAuth token, a session's token, or a request through the MCP gateway answers 403. Viewer access to the project is enough, organization-role viewers included. A bot whose username is not known yet answers 409. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Deep link content: application/json: schema: type: object properties: deep_link: { type: string, description: 'https://t.me/?start=' } bot_username: { type: string } expires_at: { type: string, format: date-time } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The bot has no known username yet (code telegram_bot_unverified)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/integrations/telegram/{id}/links: get: tags: [Workflow Telegram] summary: List users linked to a bot description: | Crios users linked to the bot, newest first, at most 50. `me` marks the caller's own link in the list. `mine` is the caller's link whether or not the list holds it, or null when the caller is not linked. Requires viewer access to the project. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: q, in: query, description: 'Substring of the Telegram name, Telegram username or user id', schema: { type: string } } responses: '200': description: Links content: application/json: schema: type: object properties: links: type: array items: { $ref: '#/components/schemas/WfTelegramLink' } mine: description: The caller's own link, or null when the caller is not linked to the bot. nullable: true allOf: - { $ref: '#/components/schemas/WfTelegramLink' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/integrations/telegram/{id}/links/{user_id}: delete: tags: [Workflow Telegram] summary: Unlink a user from a bot description: | Removing your own link needs viewer access to the project, so an organization-role viewer may remove their own; removing someone else's needs editor access and member role. Idempotent: an absent link also answers 204. A removal is recorded in the audit log as `telegram_link.remove`, with the link it removed. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: user_id, in: path, required: true, description: 'Crios user id', schema: { type: string } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Unlinked } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Telegram integration not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/data-stores: get: tags: [Workflow Data Stores] summary: List a project's managed data stores description: Sorted by name. Requires viewer access to the project. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Stores content: application/json: schema: type: object properties: data_stores: type: array items: { $ref: '#/components/schemas/WfStore' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } '503': description: 'Data stores not configured, for example no project-database instance (code unavailable)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } post: tags: [Workflow Data Stores] summary: Provision a managed data store description: | Provisions the project's own database on first use (a per-project database and role, never the control-plane database), creates the store table in it (`id`, `payload JSONB NOT NULL`, `occurred_at`, `created_at`), mints a `postgres` connection named after the store whose DSN reaches that database only, and records the store. The returned `credential_id` binds database nodes immediately. The DSN stays in Vault. Requires editor access to the project and member role; sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [project_id, name] properties: project_id: { type: string, format: uuid } name: { type: string, maxLength: 200 } responses: '201': description: Provisioned content: application/json: schema: { $ref: '#/components/schemas/WfStore' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'A store or postgres connection with this name already exists in the project (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Data stores not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/data-stores/{id}: delete: tags: [Workflow Data Stores] summary: Delete a managed data store description: | Drops the store's table in the project database, deletes the store record and its connection with the Vault secret. Refused with 409 while the ACTIVE version of any workflow in the project binds the store's connection — the message names those workflows; draft bindings do not block, exactly like DELETE /workflows/credentials/{id}. Requires editor access to the project and member role; sandbox tokens get 403. parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Deleted } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Bound by the active version of one or more workflows (code name_conflict)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Data stores not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/memory/namespaces: get: tags: [Workflow Memory] summary: List memory namespaces description: | Every namespace with rows in the project's Crios-managed database (where agents keep their own memory), at most 500. Builder test runs write a separate `#test` partition, reported with `test: true`. `orphaned` marks namespaces no workflow node or agent in the project still references; it is never set when any reference is an expression. Reading never provisions a database or creates tables: a project that never wrote memory answers an empty list. Requires viewer access to the project. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Namespaces content: application/json: schema: type: object properties: namespaces: type: array items: { $ref: '#/components/schemas/WfMemoryNamespace' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } /workflows/memory/rows: get: tags: [Workflow Memory] summary: List memory rows of a namespace description: | One page of current values and log entries of a namespace, ordered by (scope_key, key, kind, seq) with keyset paging. Values larger than 8192 bytes are omitted and flagged `truncated`. Without `credential_id` the rows come from the project's managed database; with it, from the database behind that connection (a memory node's binding). Reading never provisions, wakes a hibernated database or creates tables; nothing there answers an empty list. Requires viewer access to the project. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: namespace, in: query, required: true, schema: { type: string } } - { name: test, in: query, description: 'true selects the builder test partition', schema: { type: boolean } } - { name: scope_key, in: query, description: 'Filter to one scope; present but empty selects the shared scope', schema: { type: string } } - { name: prefix, in: query, description: 'Key prefix', schema: { type: string } } - { name: workflow_id, in: query, description: 'Only rows written by this workflow', schema: { type: string, format: uuid } } - { name: credential_id, in: query, description: 'Connection a memory node binds; absent means the managed store', schema: { type: string, format: uuid } } - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 500, default: 50 } } - { name: cursor, in: query, description: 'next_cursor of the previous page', schema: { type: string } } responses: '200': description: One page content: application/json: schema: type: object properties: rows: type: array items: { $ref: '#/components/schemas/WfMemoryRow' } namespace: { type: string, description: 'Stored namespace, including the #test suffix when selected. Omitted when nothing is stored.' } next_cursor: { type: string, description: 'Present when more rows follow' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'The bound connection is hibernated (code memory_target_hibernated) or unavailable (code memory_target_unavailable)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } put: tags: [Workflow Memory] summary: Edit a memory value description: | Sets the key's current value and appends a log entry recording the edit (step id `edit:`); the audit row carries the before and after values. A locked key answers 409 `memory_locked`. Answers 404 when the target database has no memory tables yet. Query parameters address the key as on GET; an absent `scope_key` is the shared scope. Requires editor access to the project and member role. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: namespace, in: query, required: true, schema: { type: string } } - { name: key, in: query, required: true, schema: { type: string } } - { name: scope_key, in: query, schema: { type: string } } - { name: test, in: query, schema: { type: boolean } } - { name: credential_id, in: query, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [value] properties: value: { description: 'Any JSON value' } responses: '200': description: Updated content: application/json: schema: type: object properties: updated: type: object properties: namespace: { type: string } key: { type: string } value: { description: 'The stored JSON value' } seq: { type: integer, format: int64, description: 'Sequence of the appended log entry' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Key is locked (code memory_locked), or the bound connection is hibernated or unavailable' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } delete: tags: [Workflow Memory] summary: Forget one memory key description: | Deletes the key's current value and every log entry for it, in one transaction. A locked key answers 409 `memory_locked`. Deleting from memory that was never written answers 200 with zero counts. Requires editor access to the project and member role. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: namespace, in: query, required: true, schema: { type: string } } - { name: key, in: query, required: true, schema: { type: string } } - { name: scope_key, in: query, description: 'Absent means the shared scope', schema: { type: string } } - { name: test, in: query, schema: { type: boolean } } - { name: credential_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Deleted counts content: application/json: schema: type: object properties: deleted: { $ref: '#/components/schemas/WfMemoryDeleted' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Key is locked (code memory_locked), or the bound connection is hibernated or unavailable' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/memory/lock: post: tags: [Workflow Memory] summary: Lock a memory key description: | Marks every log entry of the key read-only. Later appends to the key from agents and memory nodes fail, the edit and delete routes answer 409 until it is unlocked, and purges keep the locked entries. A memory node's set or delete operation on the current value is not blocked. Idempotent. Requires editor access to the project and member role. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: namespace, in: query, required: true, schema: { type: string } } - { name: key, in: query, required: true, schema: { type: string } } - { name: scope_key, in: query, schema: { type: string } } - { name: test, in: query, schema: { type: boolean } } - { name: credential_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Lock state content: application/json: schema: { $ref: '#/components/schemas/WfMemoryLockResult' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The bound connection is hibernated or unavailable', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } delete: tags: [Workflow Memory] summary: Unlock a memory key description: Clears the read-only mark on every log entry of the key. Idempotent. Requires editor access to the project and member role. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: namespace, in: query, required: true, schema: { type: string } } - { name: key, in: query, required: true, schema: { type: string } } - { name: scope_key, in: query, schema: { type: string } } - { name: test, in: query, schema: { type: boolean } } - { name: credential_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Lock state content: application/json: schema: { $ref: '#/components/schemas/WfMemoryLockResult' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The bound connection is hibernated or unavailable', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/memory/target: get: tags: [Workflow Memory] summary: Show where a memory node's rows go description: | Resolves a connection the way a run would and reports the target (host, database and table names, never a DSN or user) and whether the memory tables exist there. Read-only: no DDL, no provisioning, and a hibernated managed database is reported as `hibernated` rather than woken. Requires viewer access to the project. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: credential_id, in: query, required: true, schema: { type: string, format: uuid } } responses: '200': description: Target and table status content: application/json: schema: type: object properties: target: { $ref: '#/components/schemas/WfMemoryTarget' } tables: { $ref: '#/components/schemas/WfMemoryTablesStatus' } '400': description: 'Invalid parameters, or the database could not be opened or did not answer within 5 s (code memory_target_unreachable)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '401': { $ref: '#/components/responses/Unauthorized' } '404': description: 'Project not accessible, or the connection is not one of the project''s' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '502': description: 'The connection could not be resolved (code memory_target_unreachable)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/memory/prepare: post: tags: [Workflow Memory] summary: Create memory tables behind a connection description: | The "Create memory tables" action: resolves the connection, pings it and applies the memory schema there. In a database Crios does not own the tables carry the `crios_wf_` prefix. Audited. A hibernated managed database answers 409 (its first run creates the tables). Requires editor access to the project and member role. requestBody: required: true content: application/json: schema: type: object required: [project_id, credential] properties: project_id: { type: string, format: uuid } credential: type: object required: [id] properties: id: { type: string, format: uuid } responses: '200': description: Tables present content: application/json: schema: type: object properties: target: { $ref: '#/components/schemas/WfMemoryTarget' } tables: { $ref: '#/components/schemas/WfMemoryTablesStatus' } created: { type: boolean, description: 'False when the tables already existed' } '400': description: 'Invalid body, database unreachable (code memory_target_unreachable), or the role may not create tables (code memory_insufficient_privilege)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': description: 'Project not accessible, or the connection is not one of the project''s' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '409': description: 'The managed database is hibernated (code memory_target_unreachable)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '502': description: 'Resolution failed (code memory_target_unreachable) or the DDL failed (code memory_prepare_failed)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } /workflows/memory/purge: post: tags: [Workflow Memory] summary: Purge a memory namespace description: | Deletes every value and every unlocked log entry of a namespace, or of its test partition with `test: true`. Locked entries are kept and counted in `readonly_skipped`. Tables are not dropped. Purging memory that was never written answers 200 with zero counts. Requires editor access to the project and member role. requestBody: required: true content: application/json: schema: type: object required: [project_id, namespace] properties: project_id: { type: string, format: uuid } namespace: { type: string } test: { type: boolean, default: false } credential_id: { type: string, format: uuid, description: 'Connection a memory node binds; absent means the managed store' } responses: '200': description: Deleted counts content: application/json: schema: type: object properties: deleted: { $ref: '#/components/schemas/WfMemoryDeleted' } readonly_skipped: { type: integer, description: 'Locked log entries kept' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: 'The bound connection is hibernated or unavailable', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/{id}/variables: get: tags: [Workflow Variables] summary: Get a workflow's variables description: | Base values (the workflow's own project) plus per-project overrides. Requires viewer access to the workflow's project. parameters: - { name: id, in: path, required: true, description: 'Workflow id', schema: { type: string, format: uuid } } responses: '200': description: Variables content: application/json: schema: { $ref: '#/components/schemas/WfVariables' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } put: tags: [Workflow Variables] summary: Replace a workflow's variables description: | Replaces the whole variable state; absent maps mean empty, so `{}` clears everything. Does not bump the workflow version. Names must be non-blank, without leading or trailing whitespace, at most 128 characters; values are any JSON. Override keys are ids of OTHER projects the caller can edit (not the workflow's own project). Requires editor access to the workflow's project and member role. parameters: - { name: id, in: path, required: true, description: 'Workflow id', schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/WfVariables' } responses: '200': description: Stored variables content: application/json: schema: { $ref: '#/components/schemas/WfVariables' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /workflows/{id}/trigger-routes: get: tags: [Workflow Triggers] summary: List the webhook routes of a workflow's draft description: | The `/hooks` route every enabled trigger node of the DRAFT registers once the workflow is activated, so the builder can show the URL to paste into the provider before activation: crios.trigger.webhook, crios.trigger.form and the vendor triggers (crios.trigger.slack, crios.trigger.stripe and the other wrapper-backed types), whose path their own decoder derives. The routes come from the same decode activation runs; a credential slot the draft has not bound yet is filled with a placeholder first, because a path never depends on the credential. One entry per (node, method) in document order: a hosted form answers GET and POST. A disabled node, and a node activation would refuse (see the draft's issues), yield no route. The public URL is `/hooks/`. Requires viewer access to the workflow's project, like GET /workflows/{id}. parameters: - { name: id, in: path, required: true, description: 'Workflow id', schema: { type: string, format: uuid } } responses: '200': description: The draft's webhook routes content: application/json: schema: type: object required: [routes] properties: routes: type: array description: Never null; empty when the draft has no webhook-style trigger items: type: object required: [node_id, type, path, method] properties: node_id: { type: string, description: The trigger node's id } type: { type: string, description: 'The trigger node''s type, e.g. crios.trigger.slack' } path: { type: string, description: 'The route path under /hooks/, exactly as activation stores it: no leading or trailing slash, not percent-encoded' } method: { type: string, description: 'HTTP method, e.g. POST' } example: routes: - { node_id: form, type: crios.trigger.form, path: signup, method: GET } - { node_id: form, type: crios.trigger.form, path: signup, method: POST } - { node_id: Slack_Events-1, type: crios.trigger.slack, path: slack-slackevents-1, method: POST } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } /workflows/{id}/trigger-health: get: tags: [Workflow Triggers] summary: Get a workflow's trigger health description: | Live state of the workflow's listener triggers (Redis, Postgres, Kafka, RabbitMQ and MQTT listeners report health). A trigger node without a row has not been claimed by a worker, usually because the workflow is inactive. A `listening` row not refreshed for 95 seconds is reported as `stale` (workers refresh every 30 seconds). Requires viewer access to the workflow's project. parameters: - { name: id, in: path, required: true, description: 'Workflow id', schema: { type: string, format: uuid } } responses: '200': description: Trigger health content: application/json: schema: type: object properties: triggers: type: array items: { $ref: '#/components/schemas/WfTriggerHealth' } active: { type: boolean, description: 'Whether the workflow has an active version' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { $ref: '#/components/responses/NotFound' } /hooks/{path}: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Workflow Triggers] summary: Deliver a GET webhook or open a hosted form (public) description: | Same contract as POST /hooks/{path} for a route that registers GET. On a crios.trigger.form route, GET renders the form page (text/html) after the route's auth policy passes, without starting a run. security: [] parameters: - { name: path, in: path, required: true, description: 'The trigger path; may contain slashes', schema: { type: string } } responses: '200': description: Finished-run summary or recorded answer, or the rendered form page content: application/json: schema: { $ref: '#/components/schemas/WfHookResult' } text/html: schema: { type: string } '202': description: Run accepted content: application/json: schema: { $ref: '#/components/schemas/WfHookResult' } '401': { description: 'Auth policy failed', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { description: 'No webhook is registered for this path and method', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '503': { description: 'Routing or credential resolution unavailable', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with the resume and form routes); retry after X-RateLimit-Retry-After seconds' } put: tags: [Workflow Triggers] summary: Deliver a PUT webhook (public) description: Same contract as POST /hooks/{path}, for a route that registers PUT. security: [] parameters: - { name: path, in: path, required: true, description: 'The trigger path; may contain slashes', schema: { type: string } } requestBody: content: application/json: schema: {} responses: '200': { description: 'Finished-run summary or recorded answer', content: { application/json: { schema: { $ref: '#/components/schemas/WfHookResult' } } } } '202': { description: 'Run accepted', content: { application/json: { schema: { $ref: '#/components/schemas/WfHookResult' } } } } '401': { description: 'Auth policy failed', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { description: 'No webhook is registered for this path and method', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '413': { description: 'Body over 5 MiB', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with the resume and form routes); retry after X-RateLimit-Retry-After seconds' } post: tags: [Workflow Triggers] summary: Deliver a webhook to an active workflow (public) description: | Production webhook ingress. Public: no platform auth; each route's own policy is the whole credential. Activating a workflow registers one route per (path, method) for its crios.trigger.webhook node (methods GET, POST, PUT, PATCH, DELETE or HEAD, default POST), its crios.trigger.form node (GET and POST) and its provider trigger nodes. The handler accepts any method, but a request matches only a route registered for that exact method; anything else answers 404. Auth policy (`auth.kind` on the trigger): - `none`: no check. - `hmac`: the configured header carries the hex HMAC-SHA256 of the raw body (bare or `sha256=`-prefixed), keyed by the bound `hmac` connection's secret. - `api_key`: the configured header must equal the bound `http` connection's `api_key`. - `bearer`: `Authorization: Bearer ` must equal the bound `http` connection's `bearer_token`. Failures answer 401 without saying which check failed; a credential store outage answers 503. Provider triggers (for example Slack) replace this with the provider's own signature check, answer URL-verification challenges without starting a run, and answer 200 `{"status":"ignored"}` for deliveries they filter out. The run receives one item `{headers, query, body, method}`: headers lowercased, first query values, and the body parsed as JSON when the Content-Type contains `json`, otherwise the raw string. A form submission starts the run with the parsed fields plus `submittedAt`, `formMode` and `formQueryParameters` (and the headers when the trigger's `showHeaders` is set). An optional `dedupeKey` expression over `trigger.*` makes redeliveries idempotent: the same key answers with the same execution. Response (`respond.mode`): - `immediately` (default): 202 `{execution_id}`. - `on_finish`: waits up to `respond.timeoutMs`, capped at 30 seconds, then answers 200 with `{execution_id, status, error, stats}` of the finished run, or 202 `{execution_id, status}` on timeout. - `node`: waits the same way for the run's crios.webhook.respond node and replays its status, headers and body; a run that ends without one answers the finished-run summary, with 500 when it did not succeed. - Form routes: `submitted_text` (default, an HTML thank-you page), `redirect` (307 to the configured URL), or the two waiting modes, which also answer 307 to /workflows/form/{executionID}/{signal} when the run parks on a crios.form page. security: [] parameters: - { name: path, in: path, required: true, description: 'The trigger path; may contain slashes', schema: { type: string } } requestBody: description: Any body up to 5 MiB; a form whose page has a file field accepts up to 25 MiB (urlencoded or multipart). content: application/json: schema: {} application/x-www-form-urlencoded: schema: { type: object, additionalProperties: true } multipart/form-data: schema: { type: object, additionalProperties: true } text/plain: schema: { type: string } responses: '200': description: 'Finished-run summary (on_finish, node), the respond node''s recorded answer (node), a form thank-you page, a provider challenge answer, or {"status":"ignored"}' content: application/json: schema: { $ref: '#/components/schemas/WfHookResult' } text/html: schema: { type: string } '202': description: Run accepted (immediately), or still running when the wait ended content: application/json: schema: { $ref: '#/components/schemas/WfHookResult' } '307': { description: 'Form routes only - redirect mode, or the run parked on a crios.form page' } '400': description: 'Unreadable body, dedupeKey expression failed, or invalid form submission' content: application/json: schema: { $ref: '#/components/schemas/Error' } '401': { description: 'Auth policy or provider signature check failed', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { description: 'No webhook is registered for this path and method', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '413': { description: 'Body over the cap', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': description: 'Execution creation failed, or (node mode) the run did not succeed' content: application/json: schema: { $ref: '#/components/schemas/WfHookResult' } '503': description: 'Routing or credential resolution unavailable, or unknown provider trigger' content: application/json: schema: { $ref: '#/components/schemas/Error' } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with the resume and form routes); retry after X-RateLimit-Retry-After seconds' } delete: tags: [Workflow Triggers] summary: Deliver a DELETE webhook (public) description: Same contract as POST /hooks/{path}, for a route that registers DELETE. security: [] parameters: - { name: path, in: path, required: true, description: 'The trigger path; may contain slashes', schema: { type: string } } responses: '200': { description: 'Finished-run summary or recorded answer', content: { application/json: { schema: { $ref: '#/components/schemas/WfHookResult' } } } } '202': { description: 'Run accepted', content: { application/json: { schema: { $ref: '#/components/schemas/WfHookResult' } } } } '401': { description: 'Auth policy failed', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { description: 'No webhook is registered for this path and method', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with the resume and form routes); retry after X-RateLimit-Retry-After seconds' } head: tags: [Workflow Triggers] summary: Deliver a HEAD webhook (public) description: Same contract as POST /hooks/{path}, for a route that registers HEAD. Response bodies are not sent. security: [] parameters: - { name: path, in: path, required: true, description: 'The trigger path; may contain slashes', schema: { type: string } } responses: '200': { description: 'Run finished (on_finish or node)' } '202': { description: 'Run accepted' } '401': { description: 'Auth policy failed' } '404': { description: 'No webhook is registered for this path and method' } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with the resume and form routes); retry after X-RateLimit-Retry-After seconds' } patch: tags: [Workflow Triggers] summary: Deliver a PATCH webhook (public) description: Same contract as POST /hooks/{path}, for a route that registers PATCH. security: [] parameters: - { name: path, in: path, required: true, description: 'The trigger path; may contain slashes', schema: { type: string } } requestBody: content: application/json: schema: {} responses: '200': { description: 'Finished-run summary or recorded answer', content: { application/json: { schema: { $ref: '#/components/schemas/WfHookResult' } } } } '202': { description: 'Run accepted', content: { application/json: { schema: { $ref: '#/components/schemas/WfHookResult' } } } } '401': { description: 'Auth policy failed', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { description: 'No webhook is registered for this path and method', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '413': { description: 'Body over 5 MiB', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with the resume and form routes); retry after X-RateLimit-Retry-After seconds' } /workflows/executions/{id}/signals/{name}: post: tags: [Workflow Waits] summary: Deliver a signal to a waiting execution description: | Resolves the execution's open wait registered for signal `name` (for example by a crios.wait.signal node) with the request body as its payload: any JSON up to 1 MiB, or an empty body for none. The body becomes the waiting step's output. Racing deliveries resolve once; the loser gets 404. Requires editor access to the project and member role (execution.control). parameters: - { name: id, in: path, required: true, description: 'Execution id', schema: { type: string, format: uuid } } - { name: name, in: path, required: true, description: 'Signal name', schema: { type: string } } requestBody: required: false content: application/json: schema: {} responses: '200': description: Wait resolved content: application/json: schema: { $ref: '#/components/schemas/WfWaitResolution' } '400': { $ref: '#/components/responses/BadRequest' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': description: 'Execution not found or not accessible, or no open wait for this signal (code not_found)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '410': { description: 'The wait has expired (code wait_expired)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '413': { description: 'Payload over 1 MiB', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/resume/{token}: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Workflow Waits] summary: Resume a waiting execution by token (public) description: | Public: the single-use resume token (64 hex characters, minted for each signal wait) is the whole credential. The body (any JSON up to 1 MiB, or empty) becomes the wait's payload. The answer reveals nothing about the execution; unknown and already-used tokens are indistinguishable (404). Approval waits cannot be resolved this way (409). No Crios API or expression hands out these tokens as of 2026-09-26; callers that know the execution id use POST /api/v1/workflows/executions/{id}/signals/{name}. security: [] parameters: - { name: token, in: path, required: true, schema: { type: string } } requestBody: required: false content: application/json: schema: {} responses: '200': description: Resumed content: application/json: schema: type: object properties: status: { type: string, enum: [resumed] } '400': { description: 'Payload is not valid JSON (code invalid_request)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '404': { description: 'Unknown or already used token (code not_found)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '409': description: 'An approval wait; resolve it through an approval decision (code approval_decision_required)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '410': { description: 'The token has expired (code wait_expired)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '413': { description: 'Payload over 1 MiB', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with /hooks and the form routes)' } /workflows/form/{executionID}/{signal}: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Workflow Waits] summary: Render a parked form page (public) description: | Renders the page of a crios.form node the execution is parked on, or its completion screen. Public: the execution id and signal name address one open wait, and one submission consumes it. A form trigger in a waiting respond mode redirects its submitter here (307) when the run parks on a form page. Every answer, errors included, is an HTML page. security: [] parameters: - { name: executionID, in: path, required: true, schema: { type: string, format: uuid } } - { name: signal, in: path, required: true, description: 'form:', schema: { type: string } } responses: '200': { description: 'The form page or completion screen', content: { text/html: { schema: { type: string } } } } '307': { description: 'Completion node configured to redirect' } '404': { description: 'Not a form signal, never parked, or already submitted (HTML)', content: { text/html: { schema: { type: string } } } } '500': { description: 'The form is misconfigured (HTML)', content: { text/html: { schema: { type: string } } } } '503': { description: 'The form could not be loaded (HTML)', content: { text/html: { schema: { type: string } } } } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with /hooks and the resume route)' } post: tags: [Workflow Waits] summary: Submit a parked form page (public) description: | Parses the submission (urlencoded, or multipart when the page has a file field; inputs are named by position as rendered: `f_0`, `f_1`, …) and resolves the wait with the fields plus `submittedAt` and `formMode` `production`; uploaded files become artifacts of the execution. A completion screen's POST resolves with `{completed: true, submittedAt}`. The body cap is 1 MiB, or 25 MiB when the page has a file field. When the run parks on another form page the answer is a 307 to it (multi-page forms). Every answer is an HTML page or a redirect. security: [] parameters: - { name: executionID, in: path, required: true, schema: { type: string, format: uuid } } - { name: signal, in: path, required: true, description: 'form:', schema: { type: string } } requestBody: content: application/x-www-form-urlencoded: schema: { type: object, additionalProperties: true } multipart/form-data: schema: { type: object, additionalProperties: true } responses: '200': { description: 'Thank-you or completion page', content: { text/html: { schema: { type: string } } } } '307': { description: 'Next form page of the same run, or the completion redirect' } '400': { description: 'Invalid submission (HTML)', content: { text/html: { schema: { type: string } } } } '404': { description: 'Not a form signal, never parked, or already submitted (HTML)', content: { text/html: { schema: { type: string } } } } '410': { description: 'Already submitted or expired (HTML)', content: { text/html: { schema: { type: string } } } } '500': { description: 'Misconfigured form or the submission could not be recorded (HTML)', content: { text/html: { schema: { type: string } } } } '503': { description: 'Resolver unavailable (HTML)', content: { text/html: { schema: { type: string } } } } '429': { description: 'Per-client-IP rate limit exceeded (the public workflow ingress bucket, shared with /hooks and the resume route)' } /workflows/artifacts/{id}/url: post: tags: [Workflow Artifacts] summary: Mint a signed artifact download URL description: | Returns an origin-relative signed path to GET /workflows/artifacts/{id}, valid 5 minutes. The handler requires viewer access to the artifact's project (execution.read); organization-role viewers qualify. Answers 503 when the deployment has no artifact signing key. parameters: - { name: id, in: path, required: true, description: 'Artifact id', schema: { type: string, format: uuid } } responses: '200': description: Signed URL content: application/json: schema: type: object properties: url: { type: string, description: '/workflows/artifacts/{id}?project=…&expires=…&sig=…' } expires_at: { type: string, format: date-time } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: 'Artifact data plane not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } /workflows/artifacts/{id}: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Workflow Artifacts] summary: Download artifact bytes by signed URL (public) description: | Public: an unexpired HMAC signature over the artifact id, project, optional execution and step, and expiry is the whole credential; the stored artifact's project must match the signed one. The bytes are always served as a download (`Content-Disposition: attachment`, `X-Content-Type-Options: nosniff`, `Content-Security-Policy: sandbox`, `Cache-Control: private, no-store`) with the stored MIME type and an `ETag` of `"sha256:"`. An artifact past its retention answers 404. security: [] parameters: - { name: id, in: path, required: true, schema: { type: string, format: uuid } } - { name: project, in: query, required: true, schema: { type: string, format: uuid } } - { name: execution, in: query, description: 'Present when the URL was minted with it', schema: { type: string, format: uuid } } - { name: step, in: query, description: 'Present when the URL was minted with it', schema: { type: string } } - { name: expires, in: query, required: true, description: 'Unix seconds', schema: { type: integer, format: int64 } } - { name: sig, in: query, required: true, schema: { type: string } } responses: '200': { description: 'Artifact bytes', content: { application/octet-stream: { schema: { type: string, format: binary } } } } '403': { description: 'Invalid or expired signature (code forbidden)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '404': description: 'Unknown artifact, project mismatch, or past retention (code not_found)' content: application/json: schema: { $ref: '#/components/schemas/WorkflowApiError' } '503': { description: 'Artifact data plane not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '429': { description: 'Per-client-IP rate limit exceeded (the artifact data plane''s own bucket)' } /workflows/artifacts: servers: - url: https://api.crios.ai - url: http://localhost:8080 put: tags: [Workflow Artifacts] summary: Upload artifact bytes by signed URL (public) description: | Public signed upload slot scoped to (project, execution, step). The request body is the payload (non-empty, at most 64 MiB) and its Content-Type becomes the artifact's MIME type (default application/octet-stream). Upload URLs are minted engine-side for runner pods and plugin hosts; no API route mints them. security: [] parameters: - { name: project, in: query, required: true, schema: { type: string, format: uuid } } - { name: execution, in: query, schema: { type: string, format: uuid } } - { name: step, in: query, schema: { type: string } } - { name: expires, in: query, required: true, description: 'Unix seconds', schema: { type: integer, format: int64 } } - { name: sig, in: query, required: true, schema: { type: string } } requestBody: required: true content: application/octet-stream: schema: { type: string, format: binary } responses: '201': description: Stored content: application/json: schema: { $ref: '#/components/schemas/WfArtifactUpload' } '400': { description: 'Empty payload (code invalid_request)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '403': { description: 'Invalid or expired signature (code forbidden)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '413': { description: 'Payload over 64 MiB (code invalid_request)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '503': { description: 'Artifact data plane not configured (code unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/WorkflowApiError' } } } } '429': { description: 'Per-client-IP rate limit exceeded (the artifact data plane''s own bucket)' } # ==================== SESSIONS: BUILD, AGENT PROXIES, WORKSPACE FILES + DATA ==================== /sessions/{id}/build: post: tags: [Sessions] summary: Build a delivered plan description: | Turns a delivered plan-only session (`session_type: planning`, status `completed`) into a new implementation session: a coding session owned by the caller, whose specification is the plan document (the planning session's result, else its description). The new session inherits the plan's project, priority, plan-approval mode, agent-profile pin and skill pins, and starts automatically. One live build per plan: a second call answers 409 with the existing build session (failed, cancelled or deleted builds do not count). Subject to the organization's active-session cap. Requires editor access to the planning session. parameters: - { $ref: '#/components/parameters/SessionId' } responses: '201': description: The new build session, plus `built_from` (the planning session id) content: application/json: schema: allOf: - { $ref: '#/components/schemas/Session' } - type: object properties: built_from: { type: string, format: uuid } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: | Not a plan-only session, the plan is not delivered yet, the plan is empty, or the plan already has a live build session (`{"error", "build_session_id", "build_session_status"}`). '410': { description: The planning session is deleted } '429': { description: The organization is at its active-session cap } /sessions/{id}/spec: get: tags: [Sessions] summary: Get the session's verbatim request description: | Sandbox-facing: the in-sandbox agent calls this at boot, with its delegated sandbox token, when the request is too large to pass to the sandbox as an environment variable. Returns the full, untruncated text the user asked for (falling back to the session description). Beyond session access, the caller must be the session owner or a member of the session project's organization (else 403). parameters: - { $ref: '#/components/parameters/SessionId' } responses: '200': description: The request text content: application/json: schema: type: object properties: session_id: { type: string, format: uuid } present: { type: boolean, description: False when no request text is stored } spec: { type: string } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/skills/bundle: get: tags: [Sessions] summary: Get the session's resolved skills bundle description: | Sandbox-facing: the agent fetches this once at boot. Resolves, from the session row (never from request parameters), everything the skills platform contributes to the session: the agent-profile guidance (pinned, else auto-selected), prompt-skill appendix blocks, and the tools of executable and composite skills attached to the project or pinned on the session, gated by session type. Connector chat tools are added for the dispatch kinds listed in `tool_kinds`. Only the sandbox token's fetch has side effects (the agent_profiles / agent_profile_applied / skills_applied feed events and the write-back of an auto-selected profile); a user or API-token GET is a pure read. A session without a project gets an empty bundle. Answers 404 when the deployment sets SKILLS_BUNDLE_DISABLED=true. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: tool_kinds, in: query, schema: { type: string }, description: 'Comma-separated dispatch kinds the caller can execute: connector_request, hub_action' } responses: '200': description: The bundle content: application/json: schema: { $ref: '#/components/schemas/SessionSkillsBundle' } '404': { description: 'Session not found or deleted, or bundles are disabled on this deployment' } /sessions/{id}/connector-call: post: tags: [Sessions] summary: Execute a connector chat-tool call description: | Sandbox-facing: the agent dispatches the `connector_request` and `hub_action` tools advertised in the skills bundle here. Credentials are resolved and the call is made orchestrator-side; the sandbox never sees credential material. - `connector_request`: an HTTPS call to `url` authenticated with the project workflow credential `credential_id`. The credential must be live, available in chat for the project, and the host must be in the service's allowed API domains. The method must be allowed by the credential's access level (`read` admits GET and HEAD, `custom` its method list, `off` nothing) and then by the project's narrowing of the credential, and the path must start with one of the credential's allowed path prefixes when it has any; otherwise 403 `connector_not_allowed`. Redirects are not followed; the response body is capped at 256 KiB. Audited. - `hub_action`: runs an integration-hub action as the session owner on a connected account granted to the project; the hub enforces the grant, the account's access level and the project's narrowing of it, the scopes and the owner-approval gate. Every failure is typed: `{"error", "code"}`. Requires editor access to the session; the request body is capped at 1 MiB. parameters: - { $ref: '#/components/parameters/SessionId' } requestBody: required: true content: application/json: schema: type: object required: [kind] properties: kind: { type: string, enum: [connector_request, hub_action] } credential_id: { type: string, format: uuid, description: connector_request } method: { type: string, enum: [GET, HEAD, POST, PUT, PATCH, DELETE], description: 'connector_request; case-insensitive' } url: { type: string, description: 'connector_request: absolute https URL' } body: { type: string, description: connector_request } content_type: { type: string, description: connector_request } integration_id: { type: string, description: 'hub_action, e.g. gmail' } account_id: { type: string, format: uuid, description: hub_action } action: { type: string, description: hub_action } params: { type: object, additionalProperties: true, description: hub_action } responses: '200': description: The call result content: application/json: schema: oneOf: - type: object description: connector_request properties: kind: { type: string, enum: [connector_request] } status: { type: integer, description: The upstream HTTP status } content_type: { type: string } body: { type: string } truncated: { type: boolean, description: The body was cut at 256 KiB } - type: object description: hub_action properties: kind: { type: string, enum: [hub_action] } result: { type: string, description: 'Result kind, e.g. emails, event, files' } summary: { type: string } data: { description: Action-specific result data } '400': { description: 'Typed error: invalid_request, no_project, or a hub validation error', content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } '403': { description: 'Viewer or view-only caller, or a typed denial: chat_disabled, credential_expired, credential_unavailable, connector_not_allowed (method or path outside the access level, the project narrowing or the allowed paths), no_allowed_domains, domain_denied, no_token_material, or a hub permission error', content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } '404': { description: Session or credential not found, content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } '409': { description: "The hub action needs the owner's approval, or conflicts with the account state", content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } '429': { description: The provider rate-limited the call, content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } '502': { description: 'credential_resolution_failed, upstream_unreachable, upstream_read_failed, or the provider is unavailable', content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } '503': { description: 'unavailable: credentials or integrations are not wired on this deployment', content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } '504': { description: The provider timed out, content: { application/json: { schema: { $ref: '#/components/schemas/SessionConnectorCallError' } } } } /sessions/{id}/gmail/{action}: post: tags: [Integrations] summary: Run a Gmail action for the session owner description: | Sandbox-facing Gmail proxy: agent tools call it with the sandbox token, and the Gmail tokens stay orchestrator-side. Only the session owner (or the sandbox token acting for them) may use it; editors and org admins get 403. Uses the owner's integrations-hub Gmail account (preferring one linked to the session's project), else the legacy Gmail connection. Request fields per action: - `search`: `query` (required), `max_results` (default 10, max 25). - `read`: `message_id` (required). - `send`: `body` (required), `to` and `subject` (required unless `reply_to_message_id` is set), `cc`, `bcc`. - `modify`: `message_ids` (1–50), `operation` (archive, mark_read, mark_unread, star, unstar, trash, untrash). Approval gate: `send`, a `trash`, and a `modify` of more than 10 messages hold the request and publish a `gmail_action_approval_required` event carrying an `approval_id`, unless the owner enabled auto-approve. The request stays open until the owner decides via POST /sessions/{id}/gmail/approvals/{approval_id} or the wait expires (180 s default, CRIOS_GMAIL_APPROVAL_WAIT_SECONDS, max 570 s). Requires editor access to the session. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: action, in: path, required: true, schema: { type: string, enum: [search, read, send, modify] } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SessionGmailRequest' } responses: '200': description: | Action result. search: `{query, result_size_estimate, messages}`; read: `{id, thread_id, from, to, cc, subject, date, unread, body, attachments}`; send: `{sent, id, thread_id, to, subject}`; modify: `{operation, requested, modified, failed}`. content: application/json: schema: { type: object, additionalProperties: true } '400': { description: Invalid body or a missing/invalid field for the action } '401': { description: No authenticated user } '403': { description: 'The caller is not the session owner, or a viewer' } '404': { $ref: '#/components/responses/NotFound' } '408': { description: 'No approval decision arrived before the wait expired, or the session ended; nothing was executed' } '409': { description: 'Gmail is not connected, disconnected or revoked for the owner (do not retry), or the owner rejected the action' } '502': { description: Gmail or the token refresh failed } /sessions/{id}/gmail/approvals/{approval_id}: post: tags: [Integrations] summary: Approve or reject a held Gmail action description: | Delivers the session owner's verdict to a Gmail proxy request held by the approval gate. Called from the UI banner. Only the session owner may decide; sandbox tokens are refused (403) so generated code cannot approve its own sends. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: approval_id, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [approved] properties: approved: { type: boolean } note: { type: string, description: Passed back to the agent with the decision } responses: '200': description: Verdict delivered content: application/json: schema: type: object properties: delivered: { type: boolean } '400': { description: approved (boolean) is required } '403': { description: 'Not the session owner, a viewer, or a sandbox token' } '404': { $ref: '#/components/responses/NotFound' } '410': { description: 'The request already resolved (decided, timed out, or the call ended)' } /sessions/{id}/workspace/files: get: tags: [Sessions] summary: List the session's workspace files description: | The workspace Code tab's file tree: tracked plus untracked, not-ignored files in the sandbox's /workspace, each with its git status, and the branch currently checked out. Capped at 10,000 entries (`truncated`). Served by the running sandbox. parameters: - { $ref: '#/components/parameters/SessionId' } responses: '200': description: File list content: application/json: schema: type: object properties: branch: { type: string } files: type: array items: { $ref: '#/components/schemas/SessionWorkspaceFile' } truncated: { type: boolean } '404': { $ref: '#/components/responses/NotFound' } '502': { description: 'sandbox_error: the sandbox did not answer (it may be restarting)', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } '503': { description: 'sandbox_asleep: the sandbox is not running; send the session a message to wake it', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } /sessions/{id}/workspace/file: get: tags: [Sessions] summary: Read a workspace file description: | One file's content from the sandbox's /workspace. Binary files and files over 1 MiB come back flagged (`binary`, `too_large`) without content. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: path, in: query, required: true, schema: { type: string }, description: Repository-relative path } responses: '200': description: File content content: application/json: schema: type: object properties: path: { type: string } content: { type: string } size: { type: integer, format: int64 } binary: { type: boolean } too_large: { type: boolean } '400': { description: 'Missing path, or the sandbox rejected it (e.g. the path escapes the workspace)', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } '404': { $ref: '#/components/responses/NotFound' } '502': { description: 'sandbox_error: the sandbox did not answer (it may be restarting)', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } '503': { description: 'sandbox_asleep: the sandbox is not running; send the session a message to wake it', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } put: tags: [Sessions] summary: Save a workspace file description: | Writes the file into the sandbox's /workspace and commits it on the session's current branch, so the edit survives the agent's branch syncs. The request body is capped at 4 MiB. Sandbox-internal paths cannot be edited. Requires editor access to the session. parameters: - { $ref: '#/components/parameters/SessionId' } requestBody: required: true content: application/json: schema: type: object required: [path] properties: path: { type: string, description: Repository-relative path } content: { type: string } responses: '200': description: Saved content: application/json: schema: type: object properties: path: { type: string } size: { type: integer, format: int64 } branch: { type: string } committed: { type: boolean } commit: { type: string, description: Commit SHA; omitted when nothing was committed } pushed: { type: boolean } '400': { description: 'Invalid JSON or body over 4 MiB, missing path, or the sandbox rejected the path', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '502': { description: 'sandbox_error: the sandbox did not answer (it may be restarting)', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } '503': { description: 'sandbox_asleep: the sandbox is not running; send the session a message to wake it', content: { application/json: { schema: { $ref: '#/components/schemas/SessionWorkspaceError' } } } } /sessions/{id}/data/connections: get: tags: [Session Data] summary: List the session's database connections description: | The Workspace Data tab's connection catalog for this session: rows a user added (`manual`), rows a sandbox scan found (`discovered`, listed first) and the seeded project database (`project`). Secrets are never returned; `has_dsn` and `has_password` say whether one is stored. Viewer-safe read; works with a user token or the session's sandbox token. parameters: - { $ref: '#/components/parameters/SessionId' } responses: '200': description: Connections content: application/json: schema: type: object properties: connections: type: array items: { $ref: '#/components/schemas/SessionDataConnection' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Session Data] summary: Add a database connection description: | Adds a `manual` catalog row. The connection string and password are encrypted at rest and never returned. Nothing is dialed here; call the test endpoint to check reachability. `name` defaults to the database name (the file name for sqlite), else `host:port`, else the engine. The body is capped at 64 KiB. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } requestBody: required: true content: application/json: schema: type: object required: [engine] properties: name: { type: string } engine: { type: string, description: 'postgres, mysql, sqlite or redis (aliases postgresql, pg, mariadb, sqlite3 and valkey are normalized)' } dsn: { type: string, description: 'Connection URL. Postgres, mysql and redis need either dsn or host.' } host: { type: string } port: { type: string } username: { type: string } password: { type: string } database: { type: string, description: Database name; for sqlite the database file path inside the sandbox (required for sqlite) } responses: '201': description: Created content: application/json: schema: type: object properties: connection: { $ref: '#/components/schemas/SessionDataConnection' } '400': description: Invalid JSON, unknown engine, sqlite without database, or neither dsn nor host content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /sessions/{id}/data/connections/{conn_id}: delete: tags: [Session Data] summary: Remove a database connection description: | Deletes one catalog row of this session, whatever its source. A discovered row returns on the next discover while the sandbox still reports it; the project row is re-seeded by the next `POST .../data/project-database`. Nothing on the database server changes. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } responses: '200': description: Deleted content: application/json: schema: type: object properties: deleted: { type: boolean, enum: [true] } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Session not visible to the caller, or no such connection in this session (code not_found) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/test: post: tags: [Session Data] summary: Test a database connection description: | Runs `SELECT 1` (`PING` for redis) against the connection from inside the session's sandbox, with a 5-second timeout. An unreachable database is not an HTTP error: the answer is 200 with `ok: false`. No request body. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } responses: '200': description: Test outcome content: application/json: schema: type: object properties: ok: { type: boolean } error: { type: string, description: Present when ok is false } error_kind: { type: string, enum: [sql_write_blocked, invalid_tool_arguments, db_unreachable, timeout, sql_error], description: Present when ok is false } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep); wake the session with a message and retry content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/use-as-app-database: post: tags: [Session Data] summary: Bind a connection as the app database description: | Promotes a postgres or mysql catalog row to the project's app database (the BYO binding): the project's `DATABASE_URL`, for the sandbox and for published apps, then resolves to this server, and it is registered as the project's "App database (BYO)" connector. Binding a second connection replaces the first. No request body. Before anything is recorded the server rejects connection strings that are not URLs with a matching scheme (`postgres://`, `postgresql://`, `mysql://`), and hosts that cannot mean the same server from every tier: loopback, unspecified, link-local and multicast IPs, `localhost`, single-label names, `*.svc` and `*.cluster.local` names, and Crios's own database servers. It then pings the database once from the orchestrator (5-second timeout). User tokens only: the session's sandbox token gets 403 `user_action_required`. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } responses: '200': description: Bound. source is byo. content: application/json: schema: { $ref: '#/components/schemas/SessionDataProjectDatabase' } '400': description: | already_project_database (the row is the project row), unsupported_engine (not postgres or mysql), bad_connection (DSN not a URL, scheme mismatch, no host, bad port), host_rejected, or database_unreachable (the ping failed) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': description: Viewer role, view-only session access, or a sandbox token (code user_action_required) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '409': description: The session belongs to no project (code no_project) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: Project databases are not configured on this deployment (code project_database_unavailable) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/discover: post: tags: [Session Data] summary: Discover databases in the sandbox description: | Scans the session's sandbox for databases (environment variables, `.env` files, sqlite files, port probes) and syncs the `discovered` half of the catalog to the scan: found rows are upserted on a stable key (repeating the scan never duplicates) and discovered rows the scan no longer reports are removed, so an empty scan removes every discovered row. `manual` and `project` rows are never touched, and a scanned database that is the seeded project database is folded onto that row. No request body. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } responses: '200': description: The refreshed catalog content: application/json: schema: type: object properties: connections: type: array items: { $ref: '#/components/schemas/SessionDataConnection' } discovered: { type: integer, description: Rows upserted from this scan (new or refreshed) } removed: { type: integer, description: Stale discovered rows deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/project-database: get: tags: [Session Data] summary: Get the project database status description: | Whether this deployment serves project databases and whether the session's project already has one. Never carries a secret (no `dsn`). The in-sandbox agent calls it at boot with its sandbox token to decide whether to offer the project-database tool; the Data tab calls it with a user token. Viewer-safe read. Answers `{enabled: false, provisioned: false}` when project databases are off, and `{enabled: true, provisioned: false}` when the session has no project. Otherwise `engines` and `stores` are included, plus the store's fields once it exists. A bound external database (source byo) outranks the managed one for the relational store. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: engine, in: query, description: 'Store to report. Empty (default) means the project''s relational database (postgres or mysql, whichever the project uses). Also accepts postgres, mysql (alias mariadb), valkey (alias redis) and ferretdb (aliases mongodb, mongo).', schema: { type: string } } responses: '200': description: Status content: application/json: schema: { $ref: '#/components/schemas/SessionDataProjectDatabase' } '404': description: Session not visible to the caller, or not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } post: tags: [Session Data] summary: Provision or reuse the project database description: | Returns the project's database as a session uses it: a managed store, on the shared crios-project-db or, where the deployment runs dedicated per-project instances, the sandbox-tier copy on the project's own instance. It is created on first use together with its workflow connector (for example "Project database" or "Project database (sandbox)") and a `project` row in this session's Data tab catalog (no catalog row for the document store). Idempotent: later calls return the same store and connector. The optional body `name` asks for an additional named database beside the default store, on the project's relational engine and under the same role (its own connector, "Project database: ", with " (sandbox)" on the sandbox tier). It starts empty, and published apps receive it as `DATABASE_URL_` (uppercased, `-` folded to `_`). Empty or `default` is the default store. Named databases exist for postgres and mysql only: a name with engine valkey or ferretdb answers 503 `engine_unavailable`. The first relational provision pins the project to postgres or mysql; an explicit ask for the other engine answers 409 `relational_engine_conflict`. The connection string (`dsn`) is returned only to the session's sandbox token; a user token gets the redacted shape. A hibernated store answers `status: waking`, no `dsn` and `retry_after_seconds: 5`; POST again until the DSN arrives. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: engine, in: query, description: 'Store to provision. Empty (default) means the relational database. Also accepts postgres, mysql (alias mariadb), valkey (alias redis) and ferretdb (aliases mongodb, mongo).', schema: { type: string } } requestBody: required: false content: application/json: schema: type: object properties: name: { type: string, pattern: '^[a-z0-9][a-z0-9_-]{0,31}$', description: 'Additional named database; empty or "default" means the default store (case-insensitive)' } responses: '200': description: The project database (created is true when this call provisioned it) content: application/json: schema: { $ref: '#/components/schemas/SessionDataProjectDatabase' } '400': description: Body is not valid JSON, or the name does not match the pattern content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Session not visible to the caller, or not found; or project_deleted (the session's project was deleted, and its databases with it) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '409': description: | no_project (the session belongs to no project), relational_engine_conflict (the project already runs the other relational engine; the body also carries a human-readable message), byo_bound (a named database was asked for while an external app database is bound), database_name_collision (the database, role and instance names derived from the project id's first 8 hex characters already belong to another project; nothing is created), or store_name_collision (another database of the project already publishes as the same `DATABASE_URL_`: names that differ only in `-` versus `_`) content: application/json: schema: allOf: - { $ref: '#/components/schemas/SessionDataError' } - type: object properties: message: { type: string, description: Only on relational_engine_conflict } '502': description: Provisioning failed (code provision_failed) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: Project databases are not configured (code project_database_unavailable), or this deployment serves no such engine or no named databases for it (code engine_unavailable) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/project-database/byo: delete: tags: [Session Data] summary: Unbind the external app database description: | Removes the project's BYO binding so the managed database (if one was provisioned) is the app database again. The external server is not touched; Crios only forgets the credential. Answers with what the project database now is for this session: the managed store, or `{enabled: true, provisioned: false}` when none exists. User tokens only: the session's sandbox token gets 403 `user_action_required`. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } responses: '200': description: Unbound content: application/json: schema: { $ref: '#/components/schemas/SessionDataProjectDatabase' } '403': description: Viewer role, view-only session access, or a sandbox token (code user_action_required) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or no external app database is bound (code no_byo_binding) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '409': description: The session belongs to no project (code no_project) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: Project databases are not configured (code project_database_unavailable) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/project-database/promote: post: tags: [Session Data] summary: Copy the sandbox store into the durable one description: | On deployments that split each project's store into a sandbox tier and a durable tier, copies the sandbox store into the durable store that published apps use, provisioning the durable store on first promotion. Once the durable store exists the copy replaces its matching tables and needs `overwrite: true`. Covers the default postgres store only: named databases and mysql stores get their durable copy, seeded from the sandbox copy, from the publish that creates it. The first publish already seeds the durable store, so the Data tab no longer offers this action. It remains the way to copy the build's data into a durable store that existed before the first publish (an agent's memory or the workflow editor made it) and already holds some of the build's tables: that publish copies nothing rather than replace a table a workflow may have been filling. User tokens only: the session's sandbox token gets 403 `user_action_required`. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } requestBody: required: false content: application/json: schema: type: object properties: overwrite: { type: boolean, default: false, description: Required (true) once the durable store exists } responses: '200': description: Promoted; the durable store content: application/json: schema: { $ref: '#/components/schemas/SessionDataProjectDatabase' } '400': description: Body is not valid JSON content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': description: Viewer role, view-only session access, or a sandbox token (code user_action_required) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or the project has no sandbox store yet (code no_sandbox) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '409': description: no_project, tiers_inactive (one store per project on this deployment), byo_bound, or durable_exists (confirm with overwrite true) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The copy failed (code promote_failed) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: Project databases are not configured (code project_database_unavailable) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/project-database/persist: post: tags: [Session Data] summary: Persist the sandbox-local database description: | Copies the postgres database the app runs inside the session's sandbox (whose data dies with the sandbox) into the project's managed store, provisioning the store on first use. Once a managed store exists the copy replaces its matching tables and needs `overwrite: true`. When several local databases hold tables, name one in `database` (the 409 `multiple_databases` answer lists them). After the copy a user message is recorded that asks the agent to switch the app to the managed store; it is sent live (`steered: true`) unless the session is completed, failed or cancelled. The connection string never appears in that message. User tokens only: the session's sandbox token gets 403 `user_action_required`. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } requestBody: required: false content: application/json: schema: type: object properties: overwrite: { type: boolean, default: false, description: Required (true) once a managed store exists } database: { type: string, description: Local database to copy; needed only when several hold tables } responses: '200': description: Persisted; the managed store content: application/json: schema: allOf: - { $ref: '#/components/schemas/SessionDataProjectDatabase' } - type: object properties: persisted: { type: string, description: Name of the local database that was copied } steered: { type: boolean, description: Whether the live agent was asked to switch the app over } '400': description: Body is not valid JSON content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': description: Viewer role, view-only session access, or a sandbox token (code user_action_required) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, no local database in the sandbox (code no_local_database), or no local database with the given name (code local_database_missing) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '409': description: | no_project, byo_bound, relational_engine_conflict (the project runs mysql), sandbox_unavailable (no running sandbox; wake the session), local_database_empty, multiple_databases (with a databases list), or store_exists (confirm with overwrite true) content: application/json: schema: allOf: - { $ref: '#/components/schemas/SessionDataError' } - type: object properties: databases: type: array items: { type: string } description: Only on multiple_databases '502': description: The copy failed (code persist_failed) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: Project databases are not configured (code project_database_unavailable), or the deployment cannot copy sandbox databases (code persist_unavailable) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/project-database/wipe: post: tags: [Session Data] summary: Empty one project store description: | Deletes all tables and data of one managed store without deleting the store, its role or its connector: the same connection string keeps working on an empty store. Cannot be undone. A bound external database is never wiped, and while one is bound the project's default relational store is refused too (409 `byo_bound`); named databases can still be wiped. A hibernated store is woken first. After a sandbox-tier wipe a user message is recorded that asks the agent to re-run the app's migrations; it is sent live (`steered: true`) unless the session is completed, failed or cancelled. Durable-tier wipes are not steered. User tokens only: the session's sandbox token gets 403 `user_action_required`. Requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } requestBody: required: true content: application/json: schema: type: object required: [tier] properties: tier: { type: string, enum: [sandbox, durable], description: 'The store''s tier, as the status endpoint''s stores array reports it; stores on the shared crios-project-db are durable' } engine: { type: string, description: 'Optional; defaults to the project''s relational engine (the engine of its default relational store). Send it explicitly to wipe a key-value or document store. Accepts the same values and aliases as the engine query parameter.' } name: { type: string, pattern: '^[a-z0-9][a-z0-9_-]{0,31}$', description: 'Store name; empty or "default" means the default store' } responses: '200': description: Wiped content: application/json: schema: type: object properties: wiped: { type: boolean, enum: [true] } steered: { type: boolean, description: Whether the live agent was asked to re-run migrations (sandbox tier only) } '400': description: Body is not valid JSON, tier missing or not sandbox/durable, or invalid name content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': description: Viewer role, view-only session access, or a sandbox token (code user_action_required) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or the project has no such store (code no_such_store) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '409': description: no_project, or byo_bound (the app database is a bound external server) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The wipe failed (code wipe_failed) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: Project databases are not configured (code project_database_unavailable), or no driver serves the engine (code engine_unavailable) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/project-database/export: get: tags: [Session Data] summary: Download the project database archive description: | Streams a portable archive of the store this session serves, waking a hibernated store first: a pg_dump custom-format archive (`.dump`) for postgres, mysqldump SQL (`.sql`) for mysql, an RDB snapshot (`.rdb`) for the key-value store and a ZIP of BSON collection dumps (`.zip`) for the document store. It covers the engine's default store only: named databases cannot be exported here. Where the deployment splits stores into a sandbox and a durable tier, this is the sandbox copy, not the published app's data. The file is named `-`. If the stream fails after bytes were sent, the connection is aborted so the download fails instead of arriving truncated. A bound external database is refused. Because a download link cannot set a header, the access token may be passed as `?token=` (or `?access_token=`). User tokens only: the session's sandbox token gets 403 `user_action_required`. Viewer-safe read. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: engine, in: query, description: 'Store to export. Empty (default) means the relational database; redis (or valkey) the key-value store, mongodb (or ferretdb) the document store.', schema: { type: string } } responses: '200': description: Archive bytes, sent with Content-Disposition attachment content: application/octet-stream: schema: { type: string, format: binary } '403': description: A sandbox token (code user_action_required) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or the project has no such store (code not_provisioned) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '409': description: no_project, or byo_bound (export a bound external database with your own tools) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The store could not be readied or dumped (code export_failed) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: Project databases are not configured (code project_database_unavailable), or the deployment cannot run the store's dump tool (code export_unavailable) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/schemas: get: tags: [Session Data] summary: List a connection's schemas description: | Runs a catalog query inside the session's sandbox. System schemas are left out; postgres lists `public` first and sqlite always answers `main`. A SQL failure is not an HTTP error: the answer is 200 with a query-result body carrying `error` and `error_kind`. Viewer-safe read. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } responses: '200': description: Schemas, or a query result carrying the SQL error content: application/json: schema: oneOf: - type: object properties: schemas: type: array items: { type: string } - { $ref: '#/components/schemas/SessionDataQueryResult' } '400': description: The connection's engine has no schemas to browse (redis; code browse_unsupported) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/tables: get: tags: [Session Data] summary: List tables and views in a schema description: | Runs a catalog query inside the session's sandbox. `approx_rows` is a cheap estimate (-1 when unknown; always -1 for sqlite); exact counts come with the rows endpoint. A SQL failure answers 200 with a query-result body carrying `error`. Viewer-safe read. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } - { name: schema, in: query, description: 'Schema to list. Defaults to public (postgres) or main (sqlite); mysql has no default, so omitting it answers 400.', schema: { type: string } } responses: '200': description: Tables, or a query result carrying the SQL error content: application/json: schema: oneOf: - type: object properties: schema: { type: string } tables: type: array items: { $ref: '#/components/schemas/SessionDataTable' } - { $ref: '#/components/schemas/SessionDataQueryResult' } '400': description: browse_unsupported (redis), or an invalid or missing schema name (code bad_request) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/tables/{table}/columns: get: tags: [Session Data] summary: Describe a table's columns and keys description: | Columns with type, nullability, default, primary-key flag and outgoing foreign key (`references`), plus the incoming foreign keys of other tables (`referenced_by`, always empty for sqlite): both directions of relationship navigation in one call. A SQL failure of the column query answers 200 with a query-result body carrying `error`. Viewer-safe read. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } - { name: table, in: path, required: true, description: 'Table name (1-128 characters; no quotes, backticks, backslashes or control characters)', schema: { type: string } } - { name: schema, in: query, description: Defaults to public (postgres) or main (sqlite); required for mysql., schema: { type: string } } responses: '200': description: Columns, or a query result carrying the SQL error content: application/json: schema: oneOf: - type: object properties: schema: { type: string } table: { type: string } columns: type: array nullable: true description: Null when the column query returned no rows items: { $ref: '#/components/schemas/SessionDataColumn' } referenced_by: type: array items: type: object properties: schema: { type: string } table: { type: string, description: The referencing table } column: { type: string, description: The referencing column } references_column: { type: string, description: The column of this table it points at } - { $ref: '#/components/schemas/SessionDataQueryResult' } '400': description: browse_unsupported (redis), or an invalid table or schema name (code bad_request) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/tables/{table}/rows: get: tags: [Session Data] summary: Page through a table's rows description: | The data grid: `SELECT *` with paging, ordering and an optional exact-match filter (the foreign-key hop, such as "orders where customer_id = 42"). Cells are strings as the engine's client prints them. `total` is an exact count that is best effort (-1 when the count failed). A SQL failure of the page query answers 200 with a query-result body carrying `error`. Viewer-safe read. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } - { name: table, in: path, required: true, description: 'Table name (1-128 characters; no quotes, backticks, backslashes or control characters)', schema: { type: string } } - { name: schema, in: query, description: Defaults to public (postgres) or main (sqlite); required for mysql., schema: { type: string } } - { name: limit, in: query, description: 'Page size; values below 1 mean 50, values above 500 are capped at 500', schema: { type: integer, default: 50, maximum: 500 } } - { name: offset, in: query, schema: { type: integer, default: 0, minimum: 0 } } - { name: order_by, in: query, description: Column to sort by, schema: { type: string } } - { name: order_dir, in: query, description: Sort direction; anything other than desc sorts ascending, schema: { type: string, enum: [asc, desc], default: asc } } - { name: filter_col, in: query, description: Column for an exact-match filter, schema: { type: string } } - { name: filter_val, in: query, description: Value filter_col must equal (compared as a string literal), schema: { type: string } } - { name: filter_null, in: query, description: 'With filter_col, true matches rows where the column is NULL instead of filter_val', schema: { type: string, enum: ['true'] } } responses: '200': description: One page of rows, or a query result carrying the SQL error content: application/json: schema: oneOf: - { $ref: '#/components/schemas/SessionDataRows' } - { $ref: '#/components/schemas/SessionDataQueryResult' } '400': description: browse_unsupported (redis), or an invalid table, schema, order-by or filter column (code bad_request) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/query: post: tags: [Session Data] summary: Run a read-only query description: | The Data tab's SQL escape hatch (a command for redis), executed inside the session's sandbox. Read-only is enforced by the orchestrator and again by the sandbox: one statement only, starting with SELECT, WITH, SHOW, EXPLAIN, DESCRIBE, DESC, PRAGMA, VALUES or TABLE; data-modifying WITH clauses and EXPLAIN ANALYZE are refused, and for redis common mutating commands are refused. A refused statement, a SQL error, an unreachable database or a timeout (30 seconds) is not an HTTP error: the answer is 200 with `error` and `error_kind` set; a refused statement also carries `error_reason`. Output is capped at 64 KiB (`truncated`). Although read-only, this is a POST and requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [query] properties: query: { type: string } max_rows: { type: integer, default: 200, description: 'Row cap; values below 1 mean 200, and the sandbox caps it at 1000' } responses: '200': description: Query result (check error) content: application/json: schema: { $ref: '#/components/schemas/SessionDataQueryResult' } '400': description: Invalid JSON or empty query (code bad_request) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } /sessions/{id}/data/connections/{conn_id}/search: post: tags: [Session Data] summary: Search a schema for a term description: | Finds a term anywhere in a schema without knowing which table holds it: the text-like columns of each table are matched case-insensitively (substring). Bounded: at most 40 tables (20 for sqlite) in catalog order, 5 matching rows and 3 seconds per table, and an 8-second overall budget. Tables beyond the table cap, or left when the budget or `max_hits` ran out, are listed in `skipped`; `truncated` is true in the latter case. Tables whose search query fails are skipped silently. A failure of the catalog queries answers 200 with a query-result body carrying `error`. Although read-only, this is a POST and requires editor access to the session; viewers get 403. parameters: - { $ref: '#/components/parameters/SessionId' } - { name: conn_id, in: path, required: true, description: Connection ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [term] properties: term: { type: string, minLength: 2, maxLength: 256, description: Trimmed before the length check } schema: { type: string, description: Defaults to public (postgres) or main (sqlite); required for mysql } max_hits: { type: integer, default: 40, description: Stop after this many matching rows; values outside 1-200 mean 40 } responses: '200': description: Hits grouped by table, or a query result carrying the SQL error content: application/json: schema: oneOf: - { $ref: '#/components/schemas/SessionDataSearchResult' } - { $ref: '#/components/schemas/SessionDataQueryResult' } '400': description: browse_unsupported (redis), invalid JSON, a term shorter than 2 or longer than 256 characters, or an invalid schema name (code bad_request) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Session not visible to the caller, or connection not found content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '502': description: The sandbox did not answer (code sandbox_error) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } '503': description: The sandbox is not running (code sandbox_asleep) content: { application/json: { schema: { $ref: '#/components/schemas/SessionDataError' } } } # ==================== PROJECTS: SKILLS, DISCUSSION, TASKS, CONNECTORS, COLLECTORS, LICENSE WATCH, PUBLISHING, INTAKE ==================== /projects/{id}/skills: get: tags: [Skills] summary: List skills selectable for a project description: | The enabled declarative skills (types `prompt` and `agent_profile`) that cover this project: organization-wide skills plus the project's own. Each entry says whether it is attached to the project and whether a project override exists. The instructions body is never included. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Selectable skills content: application/json: schema: type: object properties: skills: type: array items: { $ref: '#/components/schemas/SelectableSkill' } '400': { description: Invalid project id } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/skills/{skillID}: put: tags: [Skills] summary: Override a skill's attachment for a project description: | Records a project override: `enabled: false` detaches a skill that would otherwise attach to this project, `enabled: true` attaches it. The body is optional and `enabled` defaults to true. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: skillID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: false content: application/json: schema: type: object properties: enabled: { type: boolean, default: true } responses: '200': description: Override stored content: application/json: schema: type: object properties: skill_id: { type: string, format: uuid } project_id: { type: string, format: uuid } enabled: { type: boolean } '400': { description: "Invalid ids or body, or the skill is scoped to another project" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project or skill not found } delete: tags: [Skills] summary: Reset a skill's attachment for a project description: | Removes the project override, restoring the skill's default attachment. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: skillID, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Override removed } '400': { description: "Invalid ids, or the skill is scoped to another project" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project or skill not found } /projects/{id}/discussion/messages: get: tags: [Discussion] summary: List discussion messages description: | One page of the project's discussion channel, always in ascending `seq` order. Without a cursor it returns the newest `limit` messages. `after_seq` returns the messages after that cursor (for polling and re-sync: `seq` is shared across all projects and is not contiguous within one channel, so pass a slightly overlapped cursor and dedupe by `id`). `before_seq` returns the `limit` messages before it (for scrolling back). When both are set, `after_seq` wins. Deleted and redacted messages are included as tombstones with an empty `body`. Requires project viewer access. Returns 404 when the discussion feature is disabled on the deployment. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: limit, in: query, description: 'Page size (default 100; values above 500 are clamped to 500)', schema: { type: integer, default: 100 } } - { name: after_seq, in: query, description: Return messages with a higher seq, schema: { type: integer, format: int64 } } - { name: before_seq, in: query, description: Return messages with a lower seq, schema: { type: integer, format: int64 } } responses: '200': description: Messages in ascending seq order content: application/json: schema: type: object properties: messages: type: array items: { $ref: '#/components/schemas/DiscussionMessage' } '404': { description: 'Project not found or not accessible, or discussion disabled' } post: tags: [Discussion] summary: Post a discussion message description: | Posts a message authored by the caller (`author_kind` is always `user`). Viewers may post. By default a user may post 20 messages per minute per project; beyond that the call returns 429. By default, a message sent within a minute of the same author's previous message, with nothing posted in between, is marked as a continuation of that run (`continuation_of`). Once the edit window has closed for the whole run, the fragments are merged into its first message and removed (if the first message was deleted, or the merged text would be too long, they stay as standalone messages). Send `separate: true` to keep a message on its own. Inline commands are read from the stored body after the post commits: `@decision …` records the text as a confirmed decision, `@todo …` files a task (assigned to the first project member mentioned, if any), and `@` asks that agent profile to reply (at most two agents, subject to the agent cooldown and hourly cap). Requires project viewer access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [body] properties: body: { type: string, maxLength: 16000, description: 'Message text; trimmed and must not be empty' } reply_to_id: { type: string, format: uuid, description: "Message this one replies to; must be a message of this project (otherwise 400)" } separate: { type: boolean, description: Never mark this message as a continuation } responses: '201': description: Posted message content: application/json: schema: { $ref: '#/components/schemas/DiscussionMessage' } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: Sandbox tokens cannot modify project discussion } '404': { description: 'Project not found or not accessible, or discussion disabled' } '429': { description: Posting too fast (per-user rate limit) } /projects/{id}/discussion/messages/{msgID}: delete: tags: [Discussion] summary: Retract your own discussion message description: | Deletes the caller's own message within the edit window (5 minutes after posting by default). The message stays in the channel as a tombstone; the response is that tombstone, with `deleted_at` set and an empty `body`. Requires project viewer access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: msgID, in: path, required: true, description: Message ID, schema: { type: string, format: uuid } } responses: '200': description: The tombstone content: application/json: schema: { $ref: '#/components/schemas/DiscussionMessage' } '403': { description: Sandbox tokens cannot modify project discussion } '404': { description: 'Message not found, not the caller''s own, or already deleted; or project not accessible' } '409': { description: The edit window has closed } patch: tags: [Discussion] summary: Edit your own discussion message description: | Rewrites the caller's own message while it is still editable (5 minutes after posting by default). Editing clears the message's classification (`kind`, `sentiment`, `urgent`, `topics`) and dismisses candidate decisions that were extracted from it. Saving the unchanged text is a no-op that returns the message as it is. Requires project viewer access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: msgID, in: path, required: true, description: Message ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [body] properties: body: { type: string, maxLength: 16000, description: 'New text; trimmed and must not be empty' } responses: '200': description: Edited message content: application/json: schema: { $ref: '#/components/schemas/DiscussionMessage' } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: Sandbox tokens cannot modify project discussion } '404': { description: 'Message not found, not the caller''s own, or already deleted; or project not accessible' } '409': { description: The edit window has closed } /projects/{id}/discussion/messages/{msgID}/disregard: post: tags: [Discussion] summary: Disregard a bot or knowledge message description: | Collapses a bot or knowledge-card message for everyone in the channel and records who did it and when (`disregarded_by`, `disregarded_at`). The body is kept and can still be expanded. Repeating the call keeps the first actor. Only `bot` and `knowledge` messages that are not deleted or redacted can be disregarded. Requires project editor access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: msgID, in: path, required: true, description: Message ID, schema: { type: string, format: uuid } } responses: '200': description: The updated message content: application/json: schema: { $ref: '#/components/schemas/DiscussionMessage' } '403': { description: 'Below project editor access, or a sandbox token' } '404': { description: 'Message not found, project not accessible, or discussion disabled' } '409': { description: Only bot and knowledge messages can be disregarded } delete: tags: [Discussion] summary: Restore a disregarded message description: | Clears the disregard mark on a bot or knowledge message, so it shows expanded for everyone again. Requires project editor access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: msgID, in: path, required: true, description: Message ID, schema: { type: string, format: uuid } } responses: '200': description: The updated message content: application/json: schema: { $ref: '#/components/schemas/DiscussionMessage' } '403': { description: 'Below project editor access, or a sandbox token' } '404': { description: 'Message not found, project not accessible, or discussion disabled' } '409': { description: Only bot and knowledge messages can be disregarded } /projects/{id}/discussion/messages/{msgID}/redact: post: tags: [Discussion] summary: Redact a discussion message description: | Moderation. Clears any message, whatever its author or age, and leaves a tombstone with `redacted_at` set and an empty `body`. Confirmed decisions that cite the message go back to `candidate` for re-review (`reverted_decision_ids`). Live replies to the message are listed in `reply_ids` so a moderator can review them; they are not redacted automatically. Repeating the call returns the existing tombstone. No request body. Requires project manage access (project owner or org owner/admin). Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: msgID, in: path, required: true, description: Message ID, schema: { type: string, format: uuid } } responses: '200': description: Redacted content: application/json: schema: type: object properties: message: { $ref: '#/components/schemas/DiscussionMessage' } reverted_decision_ids: type: array items: { type: string, format: uuid } description: Confirmed decisions reverted to candidate by this call reply_ids: type: array items: { type: string, format: uuid } description: Live messages that reply to the redacted one '403': { description: 'Below project manage access, or a sandbox token' } '404': { description: 'Message not found, project not accessible, or discussion disabled' } /projects/{id}/discussion/read-state: get: tags: [Discussion] summary: Get your read position in the channel description: | Where the caller got to in this project's channel, with the unread summary for the "New messages" divider and badge. The first call for a project records the channel's newest message as read, so a new reader does not inherit the backlog as unread. Unread counts skip deleted, redacted and disregarded messages, continuation fragments, and the caller's own messages. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Read state content: application/json: schema: { $ref: '#/components/schemas/DiscussionReadState' } '404': { description: 'Project not found or not accessible, or discussion disabled' } put: tags: [Discussion] summary: Move your read position description: | Sets the caller's watermark. Send `last_read_seq` to advance it, or `all: true` to mark the whole channel read. The watermark only moves forward unless `rewind: true` is sent ("mark unread from here"), so a stale tab or a second device cannot undo reading. It is capped at the channel's newest message. Returns the full read state. Requires project viewer access. Sandbox tokens are refused (403), and API tokens need write scope. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object description: Either last_read_seq or all=true is required properties: last_read_seq: { type: integer, format: int64, description: 'New watermark (negative values count as 0)' } all: { type: boolean, description: 'Mark everything read (takes precedence over last_read_seq)' } rewind: { type: boolean, description: Allow last_read_seq to lower the watermark } responses: '200': description: Read state after the update content: application/json: schema: { $ref: '#/components/schemas/DiscussionReadState' } '400': { description: 'Invalid body, or neither last_read_seq nor all=true given' } '403': { description: 'Sandbox token, or an API token without write scope' } '404': { description: 'Project not found or not accessible, or discussion disabled' } /projects/{id}/discussion/listen: get: tags: [Discussion] summary: Stream discussion events (WebSocket) description: | Upgrades to a WebSocket that pushes the channel's events as they happen. Browsers authenticate by offering two values in `Sec-WebSocket-Protocol`, `crios-ws-auth` and the JWT; the server answers with `crios-ws-auth`. An `Authorization` header or an `access_token` query parameter also work. Personal API tokens must be sent in the `Authorization` header and must have full access (`*`); fine-grained tokens are refused (403). Every frame is a JSON `DiscussionStreamEvent`: `{id, type, session_id, content, timestamp}`, where `session_id` is `discussion:`. `discussion_message_created`, `discussion_message_updated` (edit, classification, disregard, a merged run) and `discussion_message_deleted` (retraction or redaction) carry the message as `content`. `discussion_message_removed` means a continuation fragment was merged into its run: drop that message `id`. `stream_gap` (content `{"dropped_events": n}`) means events were dropped for a slow reader. Apply events by `seq` and dedupe by message `id`; after a `stream_gap` or a reconnect, re-sync with `GET /projects/{id}/discussion/messages?after_seq=…`. Treat the socket as a latency improvement, not a complete feed: keep an occasional `after_seq` poll as the fallback. The server pings every 30 seconds and ignores messages from the client. Requires project viewer access, re-checked about every 45 s while the socket is open; the socket also ends when its token expires. Close code 4401: the credential is gone (expired or revoked, account suspended, removed from the organization; refresh before reconnecting); 4403: the credential no longer reaches the project (share revoked, project deleted; do not retry). parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '101': { description: Switching Protocols (WebSocket) } '403': { description: 'A fine-grained API token (only full-access tokens may open realtime channels)' } '404': { description: 'Project not found or not accessible, or discussion disabled' } '503': { description: Realtime delivery is unavailable } /projects/{id}/discussion/ask: post: tags: [Discussion] summary: Ask agents to reply description: | Runs agent selection over the channel's recent conversation (up to the last 10 user messages) and lets at most two of the selected agent profiles post a reply to the latest user message. The call waits for the replies (up to 90 seconds). An empty `replies` list is a normal outcome: there were no recent user messages, or no agent was judged relevant. No request body. Requires project editor access. Sandbox tokens are refused (403); a personal API token with `projects:write` (or full access) acts with its owner's project access. Returns 404 when discussion agents are disabled on the deployment. Asks share the per-project hourly cap on agent replies with @-mention summons and automatic chime-ins (10 agent replies per project per hour unless the operator changes it). parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Replies posted (possibly none) content: application/json: schema: type: object properties: replies: type: array items: { $ref: '#/components/schemas/DiscussionMessage' } selector_reason: { type: string, description: Why the selector chose these agents; empty when it did not run } '403': { description: 'Below project editor access, or a sandbox token' } '404': { description: 'Project not found or not accessible, or discussion or discussion agents disabled' } '429': { description: 'An agent replied in this channel within the last 30 seconds, or the project reached its hourly cap on agent replies (the body then carries `code: hourly_cap`)' } '502': { description: Agent selection failed } '503': { description: Agents are unavailable on this deployment } /projects/{id}/discussion/members: get: tags: [Discussion] summary: List project members for mentions description: | Everyone in the project's organization who can access the project, for the @mention picker and task assignment: the project owner, org owners and admins, every org member when the project is visible to the whole organization, and users with a direct or group share. Sorted by name. Emails are not included. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Members content: application/json: schema: type: object properties: members: type: array items: { $ref: '#/components/schemas/DiscussionMember' } '404': { description: 'Project not found or not accessible, or discussion disabled' } /projects/{id}/discussion/decisions: get: tags: [Discussion] summary: List decisions description: | The project's decision records, newest first, at most 200. Without `status` every status is returned; candidates are proposals extracted from the discussion that wait for review. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: status, in: query, schema: { type: string, enum: [candidate, confirmed, dismissed, superseded] } } responses: '200': description: Decisions content: application/json: schema: type: object properties: decisions: type: array items: { $ref: '#/components/schemas/DiscussionDecision' } '404': { description: 'Project not found or not accessible, or discussion disabled' } post: tags: [Discussion] summary: Record a decision description: | Records a decision written by a person. It is created as `confirmed`, announced in the channel and indexed as project knowledge. `source_message_id` links it to the discussion message it came from; when `topics` is omitted, the topics are copied from that message's classification. Statements longer than 2000 characters are truncated. Requires project editor access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [statement] properties: statement: { type: string, description: The decision; trimmed and must not be empty } source_message_id: { type: string, format: uuid, description: "Discussion message the decision came from; must be a message of this project (otherwise 400)" } topics: type: array description: Case-insensitive; a topic outside the list is rejected (400) items: { type: string, enum: [marketing, design, engineering, product, pricing, i18n, ops, other] } responses: '201': description: Created (status confirmed) content: application/json: schema: { $ref: '#/components/schemas/DiscussionDecision' } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: 'Below project editor access, or a sandbox token' } '404': { description: 'Project not found or not accessible, or discussion disabled' } /projects/{id}/discussion/decisions/{did}: patch: tags: [Discussion] summary: Rule on a decision description: | Moves a decision through its lifecycle: `confirm` or `dismiss` a candidate, or `supersede` a confirmed decision. With `superseded_by`, the named decision (another confirmed decision of this project) replaces this one; without it the decision is retired with no successor. Confirming a candidate whose `supersedes` names a confirmed decision also retires that decision. A transition that is not allowed from the current status returns 409. Requires project editor access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: did, in: path, required: true, description: Decision ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [action] properties: action: { type: string, enum: [confirm, dismiss, supersede] } superseded_by: { type: string, format: uuid, description: 'Successor decision; used with action supersede only' } responses: '200': description: Updated decision content: application/json: schema: { $ref: '#/components/schemas/DiscussionDecision' } '400': { description: 'Invalid action, or superseded_by is this decision, not found, or not confirmed' } '403': { description: 'Below project editor access, or a sandbox token' } '404': { description: 'Decision not found, project not accessible, or discussion disabled' } '409': { description: The action is not allowed from the decision's current status } /projects/{id}/tasks: get: tags: [Tasks] summary: List project tasks description: | The project's tasks, newest first, at most 200. Requires project viewer access. Returns 404 when the tasks feature is disabled on the deployment. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: status, in: query, schema: { type: string, enum: [open, done, dismissed] } } responses: '200': description: Tasks content: application/json: schema: type: object properties: tasks: type: array items: { $ref: '#/components/schemas/ProjectTask' } '404': { description: 'Project not found or not accessible, or tasks disabled' } post: tags: [Tasks] summary: Create a task description: | Creates an `open` task. Any project participant may create tasks, viewers included, since anyone can file one with `@todo` in the discussion. `assignee_user_id` must be a project member (see `GET /projects/{id}/discussion/members`). `source_decision_id` and `source_message_id` must belong to this project. Titles longer than 2000 characters are truncated. Requires project viewer access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [title] properties: title: { type: string, description: Trimmed and must not be empty } assignee_user_id: { type: string, format: uuid } source_decision_id: { type: string, format: uuid, description: Decision this task follows up on } source_message_id: { type: string, format: uuid, description: Discussion message the task was filed from } responses: '201': description: Created task content: application/json: schema: { $ref: '#/components/schemas/ProjectTask' } '400': { description: 'Missing title, assignee not a project member, or source decision or message not found' } '403': { description: Sandbox tokens cannot modify project tasks } '404': { description: 'Project not found or not accessible, or tasks disabled' } /projects/{id}/tasks/{taskID}: patch: tags: [Tasks] summary: Update a task description: | Partial update; omitted fields stay as they are. Set `status` to `done` to complete a task, `dismissed` to drop it, or `open` to reopen it. `completed_at` is set when the task becomes `done` and cleared when it leaves that status. Tasks cannot be deleted; dismiss them instead. Requires project viewer access. Sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: taskID, in: path, required: true, description: Task ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object properties: title: { type: string, description: Must not be empty } status: { type: string, enum: [open, done, dismissed] } assignee_user_id: { type: string, description: 'A project member''s user ID, or an empty string to unassign' } responses: '200': description: Updated task content: application/json: schema: { $ref: '#/components/schemas/ProjectTask' } '400': { description: 'Invalid body, empty title, invalid status, or assignee not a project member' } '403': { description: Sandbox tokens cannot modify project tasks } '404': { description: 'Task not found, project not accessible, or tasks disabled' } /projects/{id}/integrations: get: tags: [Integrations] summary: List hub accounts linked to a project description: | Every member's connected account granted to this project, newest grant first, with whether the grant is enabled. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Linked accounts content: application/json: schema: type: object properties: accounts: type: array items: { $ref: '#/components/schemas/ProjectIntegrationLink' } '400': { description: Invalid project id } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Integrations are not available on this deployment } /projects/{id}/integrations/available: get: tags: [Integrations] summary: List your accounts available to a project description: | The caller's own connected accounts (newest first), each marked with whether it is linked to this project and enabled there. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: The caller's accounts content: application/json: schema: type: object properties: accounts: type: array items: { $ref: '#/components/schemas/ProjectIntegrationAvailableAccount' } '400': { description: Invalid project id } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Integrations are not available on this deployment } /projects/{id}/integrations/accounts: post: tags: [Integrations] summary: Link one of your accounts to a project description: | Grants one of the caller's own connected accounts to the project (someone else's account id answers 404). Linking again re-enables a parked grant. When the integration has a workflow counterpart, the response carries the id of the workflow credential that mirrors the grant. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [account_id] properties: account_id: { type: string, format: uuid } responses: '201': description: Account linked content: application/json: schema: type: object properties: linked: { type: boolean } project_id: { type: string, format: uuid } account_id: { type: string, format: uuid } integration_id: { type: string } workflow_credential_id: { type: string, format: uuid, description: Present when a workflow credential mirrors the grant } '400': { description: Invalid project id or body } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Project not found, or the account is not one of the caller's content: application/json: schema: { $ref: '#/components/schemas/ProjectIntegrationError' } '503': { description: Integrations are not available on this deployment } /projects/{id}/integrations/accounts/{accountId}: delete: tags: [Integrations] summary: Unlink an account from a project description: | Removes the grant and the workflow credential that mirrors it. Refused with 409 (code `bridge_in_use`) while active workflows still bind the account; the response lists them. Any project editor may unlink, not only the account owner. Idempotent. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: accountId, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: Unlinked content: application/json: schema: type: object properties: linked: { type: boolean, enum: [false] } '400': { description: Invalid ids } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: Active workflows still bind the account content: application/json: schema: type: object properties: error: { type: string } code: { type: string, enum: [bridge_in_use] } workflows: { type: array, items: { type: string } } '503': { description: Integrations are not available on this deployment } patch: tags: [Integrations] summary: Enable or park a linked account description: | Parks (`enabled: false`) or re-enables a grant without removing it. Any project editor may do this, not only the account owner. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: accountId, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [enabled] properties: enabled: { type: boolean } responses: '200': description: Updated content: application/json: schema: type: object properties: enabled: { type: boolean } '400': { description: "Invalid ids, or the body is not {\"enabled\": true|false}" } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Project not found, or the account is not linked to this project content: application/json: schema: { $ref: '#/components/schemas/ProjectIntegrationError' } '503': { description: Integrations are not available on this deployment } /projects/{id}/connectors: get: tags: [Connectors] summary: List a project's connector instances description: | The project's workflow credentials and the hub accounts granted to it, grouped by connector (sorted by slug), each with its project settings: alias, default instance, availability in chat and any access narrowing. A workflow credential also reports the hosts and path prefixes its chat tool is confined to and a custom API's description. A connector's only instance is its default. References and metadata only; no secret material. While the workflow database is unavailable only the hub accounts are listed. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Connector groups content: application/json: schema: type: object properties: connectors: type: array items: { $ref: '#/components/schemas/ProjectConnectorGroup' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/connectors/bindings/{kind}/{instanceId}: put: tags: [Connectors] summary: Set a connector instance's project settings description: | Partial update of one instance's alias, default flag, chat availability and access narrowing; omitted fields keep their value. Making an instance the default clears the connector's previous default. Bridge credentials that mirror a granted hub account are configured through the `hub_account` instance instead (404 here). Sandbox tokens cannot call this (403). Requires project editor access. `access_level` narrows what this project's agents may do with the instance: `off`, `read`, `full` or `custom` (with `allowed_actions`: hub action names for a `hub_account`, HTTP methods for a `workflow_credential`); an empty string removes the narrowing. The connection's own level is checked first, so a project can only take away: for a hub account on every invoke with the project, for a workflow credential on its chat-tool calls (read is GET and HEAD). Setting `access_level` replaces the stored `allowed_actions`. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: kind, in: path, required: true, schema: { type: string, enum: [workflow_credential, hub_account] } } - { name: instanceId, in: path, required: true, description: Workflow credential id or hub account id, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object properties: alias: { type: string, maxLength: 64, description: Trimmed; empty string clears } is_default: { type: boolean } chat_enabled: { type: boolean, description: Whether session agents may use this instance in chat } access_level: { type: string, enum: ['', 'off', read, full, custom], description: 'Trimmed and lowercased; "" removes the narrowing' } allowed_actions: { type: array, items: { type: string }, description: 'custom only: hub actions or HTTP methods, by instance kind' } responses: '200': description: Stored settings content: application/json: schema: type: object properties: kind: { type: string, enum: [workflow_credential, hub_account] } instance_id: { type: string, format: uuid } connector_slug: { type: string } alias: { type: string } is_default: { type: boolean } chat_enabled: { type: boolean } access_level: { type: string, description: '"" when the project does not narrow the instance' } allowed_actions: { type: array, items: { type: string }, description: The stored custom list; empty otherwise } '400': { description: "Invalid kind, instance id, body, alias longer than 64 characters, or an access_level other than off, read, full, custom or empty" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Project not found, or the instance is not on this project' } '503': { description: The instance could not be resolved (workflow database unavailable) } delete: tags: [Connectors] summary: Reset a connector instance's project settings description: | Drops the instance's alias, default flag, chat setting and access narrowing, reverting to the defaults (available in chat, no alias, a sole instance is the default, the connection's own level). Idempotent. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: kind, in: path, required: true, schema: { type: string, enum: [workflow_credential, hub_account] } } - { name: instanceId, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Settings reset } '400': { description: Invalid kind or instance id } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/mcp-connections: get: tags: [MCP] summary: List MCP connections granted to a project description: | Members' individual MCP connections granted to this project, by name, including disabled ones. Tool names only; no credentials. Organization-shared servers need no grant and are not listed. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Granted connections content: application/json: schema: type: object properties: connections: type: array items: { $ref: '#/components/schemas/ProjectMCPGrant' } '400': { description: Invalid project id } '404': { $ref: '#/components/responses/NotFound' } '503': { description: MCP connections are not available on this deployment } post: tags: [MCP] summary: Grant your MCP connection to a project description: | Grants one of the caller's own individual MCP connections to the project (201). An organization-shared server needs no grant: the call answers 200 with `shared: true` and writes nothing. Another member's connection is refused (403): only its owner can grant it. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [server_id] properties: server_id: { type: string, format: uuid } responses: '200': description: Organization-shared server; no grant needed content: application/json: schema: type: object properties: granted: { type: boolean } shared: { type: boolean } server_id: { type: string, format: uuid } project_id: { type: string, format: uuid } '201': description: Granted content: application/json: schema: type: object properties: granted: { type: boolean } individual: { type: boolean } server_id: { type: string, format: uuid } project_id: { type: string, format: uuid } owner: type: object properties: user_id: { type: string, format: uuid } '400': { description: Invalid project id or body } '403': { description: "Below project editor access, sandbox token, or the connection belongs to another member" } '404': { description: Project or connection not found } '503': { description: MCP connections are not available on this deployment } /projects/{id}/mcp-connections/{serverId}: delete: tags: [MCP] summary: Revoke an MCP connection grant description: | Any project editor may revoke a grant; the owner keeps the connection itself. Idempotent. Sandbox tokens cannot call this (403). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: serverId, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: Grant revoked content: application/json: schema: type: object properties: granted: { type: boolean, enum: [false] } server_id: { type: string, format: uuid } project_id: { type: string, format: uuid } '400': { description: Invalid ids } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: MCP connections are not available on this deployment } /projects/{id}/jira/mappings: get: tags: [Integrations] summary: List a project's Jira mappings description: | Which Jira projects, on which connected Jira accounts, this project tracks. With at least one mapping, the agent's Jira tool acts through the mapped account; without any it falls back to the organization's Jira connector. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Mappings content: application/json: schema: type: object properties: mappings: type: array items: { $ref: '#/components/schemas/ProjectJiraMapping' } '400': { description: Invalid project id } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Integrations are not available on this deployment } post: tags: [Integrations] summary: Map a Jira project to this project description: | Binds one of the caller's own connected Jira accounts and a Jira project key (upper-cased) to the project. The account is also linked to the project and enabled there. Idempotent. Requires project editor access; sandbox tokens are refused (403), because the link grants the project the account. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [account_id, jira_project_key] properties: account_id: { type: string, format: uuid, description: A connected Jira account of the caller } jira_project_key: { type: string, pattern: '^[A-Za-z][A-Za-z0-9_]*$', example: ENG, description: 'A Jira project key: a letter, then letters, digits or underscores' } responses: '201': description: Mapped content: application/json: schema: type: object properties: mapped: { type: boolean } project_id: { type: string, format: uuid } account_id: { type: string, format: uuid } jira_project_key: { type: string } '400': { description: "Invalid body, a missing key or one that is not a Jira project key, or the account is not a Jira account" } '403': { description: 'Requires project editor access; sandbox tokens cannot change Jira mappings' } '404': description: Project not found, or the account is not one of the caller's content: application/json: schema: { $ref: '#/components/schemas/ProjectIntegrationError' } '503': { description: Integrations are not available on this deployment } /projects/{id}/jira/mappings/{mappingId}: delete: tags: [Integrations] summary: Remove a Jira mapping description: | Deletes the mapping; the account stays linked to the project. Requires project editor access; sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: mappingId, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: Removed content: application/json: schema: type: object properties: mapped: { type: boolean, enum: [false] } '400': { description: Invalid ids } '403': { $ref: '#/components/responses/Forbidden' } '404': description: Project or mapping not found content: application/json: schema: { $ref: '#/components/schemas/ProjectIntegrationError' } '503': { description: Integrations are not available on this deployment } /projects/{id}/collectors: get: tags: [Collectors] summary: List a project's collector sources description: Newest first. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Sources content: application/json: schema: type: object properties: sources: type: array items: { $ref: '#/components/schemas/CollectorSource' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Collectors] summary: Create a collector source description: | Adds a source and schedules its first poll immediately. Defaults: kind `rss`, enabled, classification off, poll every 300 s (clamped to 60–86400), source_type `other`. A project holds at most 100 sources. Classification cannot be enabled until the source declares at least one signal name (400, code `collector_classify_requires_signal_names`). knowledge_base_id must name a document-kind knowledge entry this project can see (400, code `collector_knowledge_base_not_visible`). Where the signal pipeline is license-gated (the current release ships it ungated), `db_change` sources need a license that includes it (403, code `signal_pipeline_not_entitled`). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/CollectorSourceWrite' } responses: '201': description: Source created content: application/json: schema: { $ref: '#/components/schemas/CollectorSource' } '400': description: "Invalid field, collector limit reached (100 per project), or a coded rule violation (`error` + `code`)" content: application/json: schema: { $ref: '#/components/schemas/CollectorError' } '403': description: Below project editor access, or `db_change` without a signal-pipeline license (license-gated builds only) content: application/json: schema: { $ref: '#/components/schemas/CollectorError' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/collectors/probe: post: tags: [Collectors] summary: Dry-run a source configuration description: | Runs the configuration once against the real upstream and reports what a source would collect. Nothing is persisted. Configuration and fetch problems come back in the report (`ok: false`, `problems`), not as an error status. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object properties: kind: { type: string, enum: [rss, http_api, db_change], default: rss } feed_url: { type: string, description: Feed URL (rss only) } language_declared: { type: string, description: Declared content language code } config: { type: object, additionalProperties: true, description: 'Per-kind configuration (http_api, db_change); ignored for rss' } responses: '200': description: Probe report content: application/json: schema: { $ref: '#/components/schemas/CollectorProbeReport' } '400': { description: Invalid body or unknown collector kind } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/collectors/scout: post: tags: [Collectors] summary: Start a source-scouting run description: | Starts a background run that plans web searches from the prompt, discovers and probes candidate feeds, and creates the best ones as sources (origin `scout`). One run per project at a time. Poll `GET /projects/{id}/collectors/scout/{runID}` for progress. Needs web search and an LLM route on the deployment (503 otherwise). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [prompt] properties: prompt: { type: string, maxLength: 600, description: What the sources should cover } responses: '202': description: Run started content: application/json: schema: { $ref: '#/components/schemas/CollectorScoutRun' } '400': { description: Missing or too-long prompt } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: A scout run is already in progress for this project } '503': { description: 'Web search is not configured, or the model router is unavailable' } /projects/{id}/collectors/scout/{runID}: get: tags: [Collectors] summary: Get a scout run description: | Progress of one scout run. Runs are kept in memory (the most recent 100) and disappear when the orchestrator restarts; the sources they created remain. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: runID, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: Run state content: application/json: schema: { $ref: '#/components/schemas/CollectorScoutRun' } '404': { description: Project or scout run not found } /projects/{id}/collectors/{sourceID}: delete: tags: [Collectors] summary: Delete a collector source description: | For `db_change` sources the change-capture triggers are removed from the watched database first (best effort: an unreachable database does not block the delete). Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: sourceID, in: path, required: true, schema: { type: string, format: uuid } } responses: '400': { $ref: '#/components/responses/BadRequest' } '200': description: Deleted content: application/json: schema: type: object properties: deleted: { type: boolean } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project or collector not found } patch: tags: [Collectors] summary: Update a collector source description: | Partial update over the stored source; `kind` cannot change. The same validation and coded rules as create apply to the merged source. Omitting knowledge_base_id keeps the link and an empty string clears it. Changing feed_url (rss) or config (http_api), or re-enabling the source, schedules an immediate poll. Turning classification on releases the source's unclassified backlog, metered by the hourly classification budget. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: sourceID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/CollectorSourceWrite' } responses: '200': description: Updated source content: application/json: schema: { $ref: '#/components/schemas/CollectorSource' } '400': description: Invalid field or a coded rule violation content: application/json: schema: { $ref: '#/components/schemas/CollectorError' } '403': description: Below project editor access, or a `db_change` source without a signal-pipeline license (license-gated builds only) content: application/json: schema: { $ref: '#/components/schemas/CollectorError' } '404': { description: Project or collector not found } /projects/{id}/collectors/{sourceID}/poll: post: tags: [Collectors] summary: Poll a source now description: Moves the source's next fetch to now. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: sourceID, in: path, required: true, schema: { type: string, format: uuid } } responses: '400': { $ref: '#/components/responses/BadRequest' } '200': description: Poll scheduled content: application/json: schema: type: object properties: scheduled: { type: boolean } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project or collector not found } /projects/{id}/collectors/{sourceID}/health: get: tags: [Collectors] summary: Get a source's collection health description: | Collection state plus the source's pipeline backlog. `raw_events` is omitted while the pipeline database is unavailable (`pipeline_available: false`). Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: sourceID, in: path, required: true, schema: { type: string, format: uuid } } responses: '400': { $ref: '#/components/responses/BadRequest' } '200': description: Health content: application/json: schema: type: object properties: last_polled_at: { type: string, format: date-time, nullable: true } last_status: { type: string, description: 'Outcome of the last poll (ok, not_modified, error; empty before the first poll)' } last_error: { type: string } consecutive_failures: { type: integer } disabled_reason: { type: string, description: Set when the source was disabled automatically } pipeline_available: { type: boolean } raw_events: { $ref: '#/components/schemas/PipelineRawEventCounts' } '404': { description: Project or collector not found } /projects/{id}/pipeline/pause: post: tags: [Collectors] summary: Pause the project's signal pipeline description: Collection for the project stops at the next claim cycle. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Paused content: application/json: schema: type: object properties: paused: { type: boolean, enum: [true] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Pipeline database unavailable } /projects/{id}/pipeline/resume: post: tags: [Collectors] summary: Resume the project's signal pipeline description: Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Resumed content: application/json: schema: type: object properties: paused: { type: boolean, enum: [false] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Pipeline database unavailable } /projects/{id}/pipeline/status: get: tags: [Collectors] summary: Get the project's pipeline status description: | Pause state, the classification budget and its use in the current hourly window, raw-event retention limits, and the project backlog. Returns only `{ "pipeline_available": false }` while the pipeline database is unavailable. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Status content: application/json: schema: type: object properties: pipeline_available: { type: boolean } paused: { type: boolean } classify_budget_per_hour: { type: integer, description: Default 500 } classify_used_this_window: { type: integer } raw_events_retention_days: { type: integer, description: Default 30 } raw_events_max_rows: { type: integer, format: int64, description: Default 1000000 } counts: { $ref: '#/components/schemas/PipelineRawEventCounts' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/pipeline/settings: patch: tags: [Collectors] summary: Change one pipeline setting description: | Sets one allow-listed key per request (pause and resume have their own routes). Numbers must be whole and in range: - `classify_budget_per_hour`: 1–100000 - `raw_events_retention_days`: 1–3650 - `raw_events_max_rows`: 1000–100000000 - `workflow_llm_budget_per_hour`: 0–100000 (0 turns the hourly workflow LLM budget off) - `workflow_host_access`: boolean; opts the project into the host-access workflow nodes (commands, SSH, files, git), which the deployment must also allow - `workflow_retention_succeeded_days`, `workflow_retention_failed_days`, `workflow_retention_dlq_days`, `workflow_retention_artifact_orphan_days`: 1–3650; `workflow_retention_succeeded_keep_pct`: 0–100; `workflow_retention_max_executions`: 1000–100000000. The project's workflow retention policy; the nightly worker applies it only when the deployment runs retention in `enforce` mode (`CRIOS_WORKFLOW_RETENTION`), and only reports otherwise. Requires project manage access (project owner or org owner/admin); sandbox tokens are refused (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [key, value] properties: key: { type: string, enum: [classify_budget_per_hour, raw_events_retention_days, raw_events_max_rows, workflow_llm_budget_per_hour, workflow_host_access, workflow_retention_succeeded_days, workflow_retention_failed_days, workflow_retention_succeeded_keep_pct, workflow_retention_dlq_days, workflow_retention_artifact_orphan_days, workflow_retention_max_executions] } value: { description: 'Whole number, or boolean for workflow_host_access' } responses: '200': description: Setting stored content: application/json: schema: type: object properties: updated: { type: string, description: The key that was changed } '400': { description: 'Unknown key, wrong type, or value out of range' } '403': { description: 'Requires project manage access; sandbox tokens cannot change pipeline settings' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Pipeline database unavailable } /projects/{id}/licensewatch/scan: post: tags: [License Watch] summary: Scan a dependency manifest description: | Parses one manifest or lockfile and replaces the project's inventory for that ecosystem (the last scan wins; findings of dependencies that disappeared resolve on their own). Accepted files: npm `package.json` or `package-lock.json`, pypi requirements-style pin lists, cargo `Cargo.lock`, go `go.mod`. At most 5000 dependencies per scan. Licenses resolve cache-first with a bounded number of registry lookups inside the request; the rest stay `pending` and resolve in the background. Findings are re-evaluated. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [ecosystem, filename, content] properties: ecosystem: { type: string, enum: [npm, pypi, cargo, go] } filename: { type: string, description: 'Manifest file name, e.g. package-lock.json (selects the npm parser)' } content: { type: string, description: 'Raw file content, at most 8 MiB' } responses: '200': description: Scan summary content: application/json: schema: { $ref: '#/components/schemas/LicenseWatchScanSummary' } '400': { description: "Invalid ecosystem, missing filename/content, manifest too large, unparseable, empty, or over 5000 dependencies" } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/licensewatch/summary: get: tags: [License Watch] summary: Get the project's compliance summary description: | Per-ecosystem dependency counts with a breakdown by license risk (dependencies still pending or failed count as `pending`, not by risk), finding totals, and the time of the latest scan. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Summary content: application/json: schema: type: object properties: enabled: { type: boolean, description: Whether the project's policy is enabled } ecosystems: type: array items: type: object properties: ecosystem: { type: string } deps: { type: integer } direct: { type: integer } pending: { type: integer } by_risk: type: object additionalProperties: { type: integer } description: 'Count per risk tier (permissive, weak_copyleft, copyleft, restricted, unknown)' last_scan_at: { type: string, format: date-time, nullable: true } totals: type: object properties: deps: { type: integer } pending: { type: integer } open: { type: integer } acknowledged: { type: integer } critical: { type: integer, description: Open findings of critical severity (acknowledged ones are not counted) } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/licensewatch/dependencies: get: tags: [License Watch] summary: List watched dependencies description: | The inventory with risk annotations, ordered by ecosystem and name, capped at 1000 rows after filtering. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: ecosystem, in: query, schema: { type: string, enum: [npm, pypi, cargo, go] } } - { name: risk, in: query, schema: { type: string, enum: [permissive, weak_copyleft, copyleft, restricted, unknown] } } - { name: status, in: query, description: License resolution status, schema: { type: string, enum: [pending, resolved, unknown, failed] } } - { name: q, in: query, description: Case-insensitive substring of the package name, schema: { type: string } } responses: '200': description: Dependencies content: application/json: schema: type: object properties: dependencies: type: array items: { $ref: '#/components/schemas/LicenseWatchDependency' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/licensewatch/findings: get: tags: [License Watch] summary: List compliance findings description: | Critical findings first, then most recently seen; at most 500. `status=open` (the default) returns the findings nobody has acknowledged; acknowledged ones are listed under `status=acknowledged`, and `status=all` returns every status. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: status, in: query, schema: { type: string, enum: [open, acknowledged, resolved, all], default: open } } responses: '200': description: Findings content: application/json: schema: type: object properties: findings: type: array items: { $ref: '#/components/schemas/LicenseWatchFinding' } '400': { description: Invalid status filter } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/licensewatch/findings/acknowledge: post: tags: [License Watch] summary: Acknowledge several findings description: | Acknowledges the listed findings that are open in the project, in one call. Name the findings you mean (the ids a `GET .../findings?status=open` returned): a finding that opens after that list was read is not acknowledged. An id that is no longer open, or belongs to another project, is skipped, and the response says how many findings changed. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [ids] properties: ids: type: array minItems: 1 maxItems: 500 items: { type: string, format: uuid } responses: '200': description: Acknowledged content: application/json: schema: type: object properties: acknowledged: { type: integer, description: How many of the listed findings were open and are now acknowledged } '400': { description: "Invalid body, no ids, more than 500 ids, or an id that is not a UUID" } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/licensewatch/findings/{findingID}: patch: tags: [License Watch] summary: Acknowledge or reopen a finding description: | Only open or acknowledged findings can change; a resolved finding returns 404 and reopens only through re-evaluation. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: findingID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [status] properties: status: { type: string, enum: [acknowledged, open] } responses: '200': description: Updated content: application/json: schema: type: object properties: updated: { type: boolean } '400': { description: Invalid body or status } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Project not found, or no open/acknowledged finding with this id" } /projects/{id}/licensewatch/policy: get: tags: [License Watch] summary: Get the project's license policy description: | The stored policy, or the defaults when none is saved (enabled, deny copyleft, warn on weak copyleft, flag unknown licenses, no license lists). Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Effective policy content: application/json: schema: { $ref: '#/components/schemas/LicenseWatchPolicy' } '404': { $ref: '#/components/responses/NotFound' } put: tags: [License Watch] summary: Update the project's license policy description: | Patch semantics over the effective policy: omitted fields keep their value. License lists hold at most 100 entries each; entries are normalized to SPDX ids, deduplicated, and unparseable ones dropped. An allow-listed license overrides every other rule. Findings are re-evaluated before the response. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object properties: enabled: { type: boolean } deny_copyleft: { type: boolean } warn_weak_copyleft: { type: boolean } flag_unknown: { type: boolean } deny_licenses: { type: array, maxItems: 100, items: { type: string } } warn_licenses: { type: array, maxItems: 100, items: { type: string } } allow_licenses: { type: array, maxItems: 100, items: { type: string } } responses: '200': description: Saved policy and re-evaluated finding counts content: application/json: schema: type: object properties: policy: { $ref: '#/components/schemas/LicenseWatchPolicy' } findings: { $ref: '#/components/schemas/LicenseWatchFindingCounts' } '400': { description: 'Invalid body, or a license list over 100 entries' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '500': { description: Policy saved but re-evaluating findings failed } /projects/{id}/licensewatch/scans: get: tags: [License Watch] summary: List recent manifest scans description: The 20 most recent scans, newest first. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Scans content: application/json: schema: type: object properties: scans: type: array items: { $ref: '#/components/schemas/LicenseWatchScan' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/licensewatch/resolve: post: tags: [License Watch] summary: Resolve pending licenses now description: | Wakes the background resolver for this project instead of waiting for its next tick: one batch of this project's pending dependencies (and failed ones past their one-hour backoff) is resolved and its findings re-evaluated. Other projects wait for the tick. Requires project editor access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '202': description: Resolution scheduled content: application/json: schema: type: object properties: scheduled: { type: boolean } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/theme/apply: post: tags: [Projects] summary: Apply the project theme to the repository description: | Rewrites the theme token regions in the project repository's default branch to match the saved project theme (`settings.theme`, default `aurora`): marked CSS files in web apps, `src/theme/theme.ts` in Expo apps and marked `Theme.kt` files in Android apps. Changed files are committed to the default branch. No request body. Requires project editor access; sandbox tokens are refused (403). When files were committed and the project has a publication that is neither unpublished nor mid-publish, the app is redeployed without an agent session, pinned to the theme commit, only if both hold: - the caller may publish: project manage access (project owner or org owner/admin), as for republish; - the theme commit is exactly the published revision plus the rewritten token files: the default-branch head the rewrite started from has the published revision's content, and nothing else landed while the theme was being written. Otherwise the commit stays on the default branch and `deploy` is `skipped_republish_needed`: a republish ships it together with the rest. When nothing was rewritten (the repository already carries the theme) there is no redeploy and `deploy` is omitted. Returns 200 with `applied: false` and a `detail` when there is nothing to rewrite yet (no repository, no commits, no marked token region); the saved theme is then applied by the next agent session. A redeploy that cannot run is reported in `deploy`, never as an HTTP error. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Outcome of the rewrite and the redeploy content: application/json: schema: { $ref: '#/components/schemas/ProjectThemeApplyResult' } '400': { description: The saved settings.theme is not a registered theme } '403': { description: 'Requires project editor access; sandbox tokens cannot apply a theme' } '404': { description: Project not found (or deleted) } /projects/{id}/publication/events: get: tags: [Publishing] summary: List publication activity events description: | The publication's activity timeline, newest first: status transitions, user actions (publish, republish, unpublish, domain, password, SSL and seed changes, added monitors, theme redeploys), auto-repair attempts and errors such as a monitored endpoint going down. Empty when the project was never published. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: limit, in: query, description: 'Page size (default 100); values above 500 are clamped to 500', schema: { type: integer, default: 100 } } responses: '200': description: Events content: application/json: schema: type: object properties: events: type: array items: { $ref: '#/components/schemas/PublicationEvent' } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/publication/ssl: put: tags: [Publishing] summary: Choose the publication's certificate authority description: | Sets the certificate authority that issues the domain's TLS certificate. `zerossl` and `google` are accepted only when an administrator has stored their EAB credentials on the deployment (see the SSL options endpoint). A deployed app is switched over directly, with no republish, and the choice is re-applied on every publish. `custom` is accepted only for a publication already on it (a no-op): a custom certificate is selected by uploading one with POST /projects/{id}/publication/ssl/custom, and choosing `custom` without a certificate answers 409, because it would stop the renewal of the certificate the app serves. Unpublishing removes an uploaded certificate with the app, so publishing again starts on the organization default. Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot change it (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [provider] properties: provider: { type: string, enum: [letsencrypt, zerossl, google, custom] } responses: '200': description: Updated publication content: application/json: schema: { $ref: '#/components/schemas/Publication' } '400': { description: Invalid body or unknown provider } '403': { description: Requires project manage access; sandbox tokens cannot change the publication } '404': { description: "Project not found, or no publication for this project" } '409': { description: "Publication is unpublished; the provider's EAB credentials are not configured on this deployment; or custom was chosen without an uploaded certificate (upload one instead)" } /projects/{id}/publication/ssl/custom: post: tags: [Publishing] summary: Upload a custom TLS certificate description: | Installs your own certificate and private key for the publication's domain and switches the publication to `ssl_provider: custom`. The pair is validated first: `cert_pem` holds PEM certificates (max 256 KiB; the first one is the leaf), `key_pem` an unencrypted RSA or ECDSA private key (max 64 KiB) that matches the leaf. The leaf must be currently valid and cover the publication domain (SAN, single-label wildcard, or legacy common name). The app must already be deployed. When the certificate expires within 14 days the response carries `ssl_warning`. Key material is never returned. Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot upload (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [cert_pem, key_pem] properties: cert_pem: { type: string, description: 'PEM certificate chain, leaf first' } key_pem: { type: string, format: password, description: 'Unencrypted PEM private key (PKCS#8, PKCS#1 RSA or SEC1 EC)' } responses: '200': description: Updated publication content: application/json: schema: allOf: - { $ref: '#/components/schemas/Publication' } - type: object properties: ssl_warning: { type: string, description: Present when the certificate expires within 14 days } '400': { description: "Missing or invalid cert_pem/key_pem: unparseable, too large, key mismatch, not yet valid, expired, or does not cover the domain" } '403': { description: Requires project manage access; sandbox tokens cannot change the publication } '404': { description: "Project not found, or no publication for this project" } '409': { description: "Publication is unpublished, or the app is not deployed yet" } '502': { description: The platform could not install the certificate } '503': { description: Custom certificates are not enabled on this deployment } /projects/{id}/publication/ssl/options: get: tags: [Publishing] summary: List selectable certificate authorities description: | The certificate authorities the publication's SSL settings may offer: `letsencrypt` and `custom` always, `zerossl` and `google` only when their EAB credentials are configured on the deployment. `default_provider` is the organization's default (Let's Encrypt when none is set or its credentials are gone); new publications start on it. Works before the project is published. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Available providers content: application/json: schema: type: object properties: providers: type: array items: { type: string, enum: [letsencrypt, zerossl, google, custom] } default_provider: { type: string, enum: [letsencrypt, zerossl, google, custom] } '404': { $ref: '#/components/responses/NotFound' } /projects/{id}/publication/seed: put: tags: [Publishing] summary: Toggle database seeding on boot description: | When on, the app's frontend and backend containers run the repository's root `seed.mjs` after migrations on every start. The setting is stored on the publication and takes effect on the next publish or republish. It only adds seeding: a component the publish manifest already marks `seed: true` keeps seeding when this is off. Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot change it (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [seed_on_boot] properties: seed_on_boot: { type: boolean } responses: '200': description: Updated publication content: application/json: schema: { $ref: '#/components/schemas/Publication' } '400': { description: seed_on_boot (boolean) is required } '403': { description: Requires project manage access; sandbox tokens cannot change the publication } '404': { description: "Project not found, or no publication for this project" } '409': { description: Publication is unpublished; publish again to change it } /projects/{id}/publication/observability/status: get: tags: [Publishing] summary: Get a published app's health gauges description: | Health of the published app from the platform's metrics backend: readiness, the last smoke check, the 90th-percentile smoke check duration over the last 15 minutes, container restarts and the 24-hour uptime ratio. A gauge with no data yet is null. Requires project viewer access. When the metrics backend is not deployed or does not answer, returns 503 with `enabled: false` so clients can hide the panel. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Health gauges content: application/json: schema: { $ref: '#/components/schemas/PublicationObservabilityStatus' } '404': { description: "Project not found, or no publication for this project" } '503': description: Metrics backend unavailable content: application/json: schema: { $ref: '#/components/schemas/PublicationObservabilityUnavailable' } /projects/{id}/publication/observability/logs: get: tags: [Publishing] summary: Tail a published app's logs description: | Recent log lines of the running app (`source=runtime`, the default) or of its image builds (`source=build`), oldest first, with secrets redacted. The query parameters tune only the window and the line count; the log selection is fixed server-side to this app. Requires project viewer access. Returns 503 with `enabled: false` when the log backend is not deployed or does not answer. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: since, in: query, description: 'Lookback window as a duration such as 30m or 2h (default 1h, capped at 24h; invalid values use the default)', schema: { type: string, default: 1h } } - { name: tail, in: query, description: 'Maximum number of lines (default 200, capped at 500)', schema: { type: integer, default: 200 } } - { name: source, in: query, schema: { type: string, enum: [runtime, build], default: runtime } } responses: '200': description: Log lines content: application/json: schema: type: object properties: enabled: { type: boolean, enum: [true] } namespace: { type: string, description: Cluster namespace the lines were read from } entries: type: array items: { $ref: '#/components/schemas/PublicationLogEntry' } '400': { description: source must be runtime or build } '404': { description: "Project not found, or no publication for this project" } '503': description: Log backend unavailable content: application/json: schema: { $ref: '#/components/schemas/PublicationObservabilityUnavailable' } /projects/{id}/publication/observability/alerts: get: tags: [Publishing] summary: List a published app's active alerts description: | Alerts currently pending or firing for this app in the platform's alerting rules. Requires project viewer access. Returns 503 with `enabled: false` when the metrics backend is not deployed or does not answer. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Active alerts content: application/json: schema: type: object properties: enabled: { type: boolean, enum: [true] } app: { type: string, description: The publication slug } alerts: type: array items: { $ref: '#/components/schemas/PublicationAlert' } '404': { description: "Project not found, or no publication for this project" } '503': description: Metrics backend unavailable content: application/json: schema: { $ref: '#/components/schemas/PublicationObservabilityUnavailable' } /projects/{id}/publication/stats: get: tags: [Publishing] summary: Get publication traffic and uptime stats description: | Dashboard numbers for the project's publication over the last 30 days: per-day traffic served through the platform's publication gateway (requests, 4xx and 5xx responses, bytes out, latency) and monitor probe results, window totals, probe uptime for today, 7 and 30 days, time spent in each pipeline phase across the publication's history, and a monitor summary. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Stats content: application/json: schema: { $ref: '#/components/schemas/PublicationStats' } '404': { description: "Project not found, or no publication for this project" } /projects/{id}/publication/monitors: get: tags: [Publishing] summary: List publication monitors description: | The synthetic probes of the project's publication, ordered by path then method. Empty when the project was never published. Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Monitors content: application/json: schema: type: object properties: monitors: type: array items: { $ref: '#/components/schemas/PublicationMonitor' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Publishing] summary: Add a publication monitor description: | Adds a user-defined probe (`source: user`). `method` is GET (default) or HEAD. `path` must be an absolute path of at most 512 characters, without `..`, spaces or control characters; a trailing slash is dropped unless the path has a query string. The healthy status range defaults to 200–399; a longer `description` is cut to 500 characters. Enabled monitors of a `live` publication are probed about once a minute; three consecutive failures mark the endpoint down and add an error event to the publication timeline. Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot add monitors (403). parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: application/json: schema: type: object required: [path] properties: method: { type: string, enum: [GET, HEAD], default: GET } path: { type: string, maxLength: 512, description: 'Absolute path such as /api/health' } expected_status_min: { type: integer, minimum: 100, maximum: 599, default: 200 } expected_status_max: { type: integer, minimum: 100, maximum: 599, default: 399 } description: { type: string, maxLength: 500 } responses: '201': description: Monitor created content: application/json: schema: { $ref: '#/components/schemas/PublicationMonitor' } '400': { description: "Invalid body, method, path or status range (100 <= min <= max <= 599)" } '403': { description: Requires project manage access; sandbox tokens cannot change the publication } '404': { description: "Project not found, or no publication for this project" } '409': { description: A monitor for this method and path already exists } /projects/{id}/publication/monitors/regenerate: post: tags: [Publishing] summary: Regenerate machine-generated monitors description: | Deletes the publication's `heuristic` and `ai` monitors and generates them again from the live app; monitors people created are kept. Needs a `live` publication. Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot do this (403). parameters: - { $ref: '#/components/parameters/ProjectId' } responses: '200': description: Monitors regenerated content: application/json: schema: type: object properties: generated: { type: integer, description: Number of monitors created } '403': { description: Requires project manage access; sandbox tokens cannot change the publication } '404': { description: "Project not found, or no live publication for this project" } '503': { description: Monitor generation is not available on this deployment } /projects/{id}/publication/monitors/{monitorID}: delete: tags: [Publishing] summary: Delete a publication monitor description: | Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot delete monitors (403). A deleted `heuristic` or `ai` monitor can come back when monitors are regenerated. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: monitorID, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: Deleted content: application/json: schema: type: object properties: deleted: { type: boolean, enum: [true] } '403': { description: Requires project manage access; sandbox tokens cannot change the publication } '404': { description: "Project or monitor not found" } patch: tags: [Publishing] summary: Update a publication monitor description: | Enables or disables a monitor, or changes its healthy status range or description (cut to 500 characters); omitted fields keep their values. Method and path identify the monitor and cannot change: delete it and add a new one instead. Requires project manage access (project owner or org owner/admin). Sandbox tokens cannot change monitors (403). parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: monitorID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object properties: enabled: { type: boolean } expected_status_min: { type: integer, minimum: 100, maximum: 599 } expected_status_max: { type: integer, minimum: 100, maximum: 599 } description: { type: string, maxLength: 500 } responses: '200': description: The monitor's updated settings content: application/json: schema: type: object properties: id: { type: string, format: uuid } enabled: { type: boolean } expected_status_min: { type: integer } expected_status_max: { type: integer } description: { type: string } '400': { description: "Invalid body, or status range outside 100 <= min <= max <= 599" } '403': { description: Requires project manage access; sandbox tokens cannot change the publication } '404': { description: "Project or monitor not found" } /projects/{id}/intake: get: tags: [Intake] summary: List a project's intake tickets description: | External tickets (GitHub issues, Jira tickets, Slack messages) routed to this project, newest first. `total` counts the filtered list; `counts` gives per-status totals for the whole project, ignoring the filters. List rows carry the first 500 characters of the body and no raw payload or converted spec (null). Requires project viewer access. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: status, in: query, description: Filter by intake status, schema: { type: string, enum: [received, dispatching, working, pr_ready, done, failed, dismissed, unresolved] } } - { name: source, in: query, schema: { type: string, enum: [github_issue, jira_ticket, slack_message] } } - { name: limit, in: query, description: Values above 200 are clamped to 200, schema: { type: integer, default: 50 } } - { name: offset, in: query, schema: { type: integer, default: 0 } } responses: '200': description: Tickets content: application/json: schema: type: object properties: tickets: type: array items: { $ref: '#/components/schemas/ExternalTicket' } total: { type: integer } counts: type: object additionalProperties: { type: integer } description: Ticket count per intake status '400': { description: Invalid project id } '404': { $ref: '#/components/responses/NotFound' } # ==================== PEOPLE & KNOWLEDGE: USER SETTINGS, KNOWLEDGE VERSIONS, SKILLS, PUBLICATIONS ==================== /users/me/discussion-prefs: get: tags: [Users] summary: Get discussion display preferences description: | The caller's project-discussion display preferences. Until the first PATCH creates the row, the defaults apply (nothing muted). responses: '200': description: Preferences content: application/json: schema: { $ref: '#/components/schemas/UserDiscussionPrefs' } '401': { $ref: '#/components/responses/Unauthorized' } '500': { description: Failed to get discussion prefs } patch: tags: [Users] summary: Update discussion display preferences description: | Sets `bot_muted`, a display preference that follows the user across devices: when true, the client collapses crios_bot messages locally. The event stream itself is unchanged. Viewers may call it. Personal API tokens and sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [bot_muted] properties: bot_muted: { type: boolean } responses: '200': description: Updated preferences content: application/json: schema: { $ref: '#/components/schemas/UserDiscussionPrefs' } '400': { description: 'Invalid body, or bot_muted (boolean) missing', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to update discussion prefs } /users/me/discussion-unread: get: tags: [Users] summary: List unread discussion channels description: | The unread-badge aggregate: one row per project discussion channel the caller is behind on, across the projects of the active organization the caller can view (org owners and admins: every project). Only channels the caller has opened at least once are considered, and channels with nothing unread are omitted, so the list is often empty. A message counts as unread when it is past the caller's read watermark and is not deleted, redacted, disregarded, a continuation fragment, or the caller's own message. Agent, knowledge and crios_bot posts do count. Counts stop at 200 (`unread_capped`). Returns 404 when discussion is disabled on the deployment. responses: '200': description: Channels with unread messages content: application/json: schema: type: object properties: projects: type: array items: { $ref: '#/components/schemas/UserDiscussionUnread' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: Discussion is disabled on this deployment, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to compute the unread aggregate } /users/me/discussion-unread/catch-up: post: tags: [Users] summary: Mark every discussion channel read description: | Moves the caller's read watermark to the channel head in every channel that currently has unread messages (same scope as `GET /users/me/discussion-unread`). Only the caller's own read state changes, so viewers may call it. Personal API tokens and sandbox tokens get 403. Returns 404 when discussion is disabled. responses: '200': description: Caught up content: application/json: schema: type: object properties: cleared: { type: integer, description: Number of channels that had unread messages and were marked read } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Discussion is disabled on this deployment, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to mark channels read } /users/me/project-activity: get: tags: [Users] summary: List projects with something in Sessions, Tasks or License Watch description: | The attention dots on the projects list and the project's tab strip: one row per project of the active organization the caller can view (org owners and admins: every project) in which - `sessions`: a session was updated after the caller last opened Sessions. The mark is written by `POST /users/me/project-activity/seen`; a project never opened is measured from the caller's current sign-in (`last_login_at`). - `tasks`: an open task is assigned to the caller. Cleared by finishing, dismissing or reassigning it, not by looking. - `licensewatch`: the project has an open License Watch finding and the caller can acknowledge it (editor access or above; org-role viewers never). Cleared by acknowledging every open finding; a reopened finding or a new one lights it again. Projects with nothing are omitted, so the list is often empty. Discussion is not included: it has its own read watermark (`GET /users/me/discussion-unread`). responses: '200': description: Projects with something for the caller content: application/json: schema: type: object properties: projects: type: array items: { $ref: '#/components/schemas/UserProjectActivity' } '401': { $ref: '#/components/responses/Unauthorized' } '500': { description: Failed to compute the activity aggregate } /users/me/project-activity/seen: post: tags: [Users] summary: Mark a project's Sessions as seen description: | Stamps the caller's own "last looked" mark for one area of one project to now. Only the caller's own state changes, so viewers may call it. Personal API tokens and sandbox tokens get 403. Sessions is the only area with a mark: Tasks and License Watch are cleared by acting on them, and `tasks` is refused with 400. requestBody: required: true content: application/json: schema: type: object required: [project_id, area] properties: project_id: { type: string, format: uuid } area: { type: string, enum: [sessions] } responses: '204': { description: Marked } '400': { description: Unknown area or malformed project id, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: The project does not exist or the caller cannot see it, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to write the mark } /users/me/pins: get: tags: [Users] summary: List the caller's pins description: | The caller's pinned item ids, grouped by kind. Every key is always present (empty arrays when nothing is pinned). Ids are not checked against the items they name, so a pin can outlive its item; clients drop pins whose item they do not list. responses: '200': description: Pins grouped by kind content: application/json: schema: { $ref: '#/components/schemas/UserPins' } '401': { $ref: '#/components/responses/Unauthorized' } '500': { description: Failed to get user pins } post: tags: [Users] summary: Pin or unpin an item description: | Adds or removes one pin and answers with the full updated set. Idempotent in both directions: pinning a pinned item or unpinning an item that is not pinned is a no-op that still returns 200. Pins are per-account, so viewers may call it. Personal API tokens and sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [kind, id] properties: kind: { type: string, enum: [project, workflow, agent, knowledge, agent_profile] } id: { type: string, format: uuid, description: Id of the pinned item } pinned: { type: boolean, default: false, description: 'true pins the item; false (or omitted) unpins it' } responses: '200': description: The full updated pin set content: application/json: schema: { $ref: '#/components/schemas/UserPins' } '400': { description: 'Invalid body, unknown kind, or id is not a UUID', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to update the pin } /users/me/integrations: get: tags: [Users] summary: List personal Gmail and Telegram connections description: | The caller's personal Gmail and Telegram connections (the cards on the Integrations page), plus whether each provider is configured for the caller's organization, so the UI can explain a disabled Connect button. Never returns credentials. A Gmail account connected only through the integrations hub is listed here too. The other hub providers (calendar, drive, social) are served by `/integrations`. responses: '200': description: Connections and provider availability content: application/json: schema: type: object properties: integrations: type: array items: { $ref: '#/components/schemas/UserIntegration' } providers: type: object properties: gmail: type: object properties: configured: { type: boolean, description: The organization has a Google OAuth client } telegram: type: object properties: configured: { type: boolean, description: The organization has a Telegram bot token } '401': { $ref: '#/components/responses/Unauthorized' } '500': { description: Failed to list integrations } /users/me/integrations/gmail: patch: tags: [Users] summary: Set Gmail auto-approve description: | Toggles auto-approval of blast-radius Gmail actions (send, trash, bulk modify). With it off, those actions pause in the session until the owner approves them. Applies to the Gmail connection and to every Gmail account the caller holds in the integrations hub. Viewers may call it. Personal API tokens and sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [auto_approve] properties: auto_approve: { type: boolean } responses: '200': description: Updated content: application/json: schema: type: object properties: auto_approve: { type: boolean } '400': { description: auto_approve (boolean) is required, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Gmail is not connected, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: Failed to update } /users/me/integrations/gmail/connect: post: tags: [Users] summary: Start the Gmail connect flow description: | Returns the Google consent URL the browser should open (scope `gmail.modify`, offline access, consent forced so reconnects get a fresh refresh token). The URL carries a signed state bound to the caller that is valid for 10 minutes. Google then redirects the browser to the public `GET /api/v1/integrations/gmail/callback`, which stores the connection and redirects to `/integrations?connected=gmail` (or `?connect_error=gmail&reason=…`). Viewers may call it. Personal API tokens and sandbox tokens get 403. responses: '200': description: Consent URL content: application/json: schema: type: object properties: auth_url: { type: string, format: uri } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to sign the connect state } '503': { description: 'Google OAuth is not configured for the organization, CRIOS_PUBLIC_BASE_URL is unset, or the server signing key is missing (the message says which)', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } /users/me/integrations/gmail/disconnect: post: tags: [Users] summary: Disconnect Gmail description: | Revokes the grant at Google (best effort) and deletes the connection, together with any Gmail accounts the caller holds in the integrations hub. Returns 200 when nothing was connected; without this connection the hub's Gmail accounts are left untouched (disconnect those with POST /integrations/gmail/disconnect). Viewers may call it. Personal API tokens and sandbox tokens get 403. responses: '200': description: Disconnected content: application/json: schema: type: object properties: disconnected: { type: boolean, enum: [true] } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to disconnect } /users/me/integrations/telegram/connect: post: tags: [Users] summary: Start the Telegram connect flow description: | Mints a one-time bind token (valid for 10 minutes) and returns the `t.me` deep link to open. Sending `/start ` to the bot binds the chat to the caller; the orchestrator long-polls Telegram, so no public webhook is needed. The bot then sends session notifications and accepts `/status`, plain-text steering and Approve/Reject buttons. Viewers may call it. Personal API tokens and sandbox tokens get 403. responses: '200': description: Deep link content: application/json: schema: type: object properties: deep_link: { type: string, format: uri, description: 'https://t.me/?start=' } bot_username: { type: string } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to mint a bind token } '502': { description: Telegram could not be reached to resolve the bot, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '503': { description: Telegram is not configured for the organization, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } /users/me/integrations/telegram/disconnect: post: tags: [Users] summary: Disconnect Telegram description: | Deletes the chat binding; the bot stops messaging that chat. There is nothing to revoke remotely. Returns 200 when nothing was connected. Viewers may call it. Personal API tokens and sandbox tokens get 403. responses: '200': description: Disconnected content: application/json: schema: type: object properties: disconnected: { type: boolean, enum: [true] } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to disconnect } /knowledge/{id}/versions: get: tags: [Knowledge] summary: List a prompt entry's versions description: | The immutable version history of a prompt entry, newest first. Versions are recorded only while an entry is a prompt, so a document that never was one returns an empty list. Bounded to the caller's organization; a project's entry also needs view access to the project. parameters: - { name: id, in: path, required: true, description: Knowledge entry ID, schema: { type: string, format: uuid } } responses: '200': description: Version history content: application/json: schema: type: object properties: entry_id: { type: string, format: uuid } kind: { type: string, enum: [document, prompt] } versions: type: array items: { $ref: '#/components/schemas/KnowledgeVersion' } '404': { $ref: '#/components/responses/NotFound' } /knowledge/{id}/versions/{version}: get: tags: [Knowledge] summary: Get one version of a prompt entry parameters: - { name: id, in: path, required: true, description: Knowledge entry ID, schema: { type: string, format: uuid } } - { name: version, in: path, required: true, description: Version number, schema: { type: integer, minimum: 1 } } responses: '200': description: The version content: application/json: schema: { $ref: '#/components/schemas/KnowledgeVersion' } '400': { description: version is not a positive integer, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '404': { description: Entry or version not found, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } /skills: get: tags: [Skills] summary: List skills description: | Lists the active organization's skills, ordered by scope, then identifier. Archived skills are left out unless `status=archived` is asked for. Without `project_id` every skill of the organization is returned (org-wide and every project's project-scoped skills); with it, the org-wide skills plus that project's. `skills` is `null` when nothing matches. Any authenticated member of the active organization may use the skills API. Personal API tokens need full access (`*`) and no project binding: `skills` is not a fine-grained scope resource. Session sandbox tokens may only read skills (not their credentials, export or execution history) and execute them. parameters: - { name: status, in: query, description: 'Exact lifecycle status to list (draft, installed, enabled, disabled, archived); not validated, so an unknown value matches nothing', schema: { type: string } } - { name: type, in: query, schema: { type: string, enum: [prompt, agent_profile, workflow, tool, connector, code, composite] } } - { name: project_id, in: query, description: Include this project's skills alongside the org-wide ones; must belong to the caller's organization, schema: { type: string, format: uuid } } - { name: view, in: query, description: '`summary` leaves `manifest` out of every row; every other key is unchanged. Absent returns the full rows. Any other value, an empty value or a repeated parameter answers 400', schema: { type: string, enum: [summary] } } - { name: review, in: query, description: '`pending` lists only the review queue: skills an API or MCP caller wrote that no admin has confirmed since (`external_authoring_pending`), archived ones left out. Combines with the other filters. Any other value, an empty value or a repeated parameter answers 400 `unknown review filter`', schema: { type: string, enum: [pending] } } responses: '200': description: Skills content: application/json: schema: type: object properties: skills: type: array nullable: true items: { $ref: '#/components/schemas/Skill' } '400': description: Unknown `type`, `view` or `review`, or `project_id` is not a UUID or not in this organization content: application/json: schema: { $ref: '#/components/schemas/SkillError' } post: tags: [Skills] summary: Install a skill description: | Installs a skill from its manifest (`skill.yaml`, YAML or JSON; the body is sniffed, not typed by Content-Type) or from the Studio's envelope `{manifest, files}`, whose files are packed into a `.skill` package exactly like an uploaded one. The body may be at most 11,599,872 bytes (10 MiB package + slack). The skill is validated, its dependencies must resolve to enabled skills whose active version satisfies the declared range, and workflow references must resolve. A new skill starts `installed` (or `draft` with `draft=true`: validated and versioned, but its packaged workflows are not materialized and it cannot be enabled until published). Enabling is a separate org-admin step. Viewers get 403. Non-admin callers additionally pass the workflow authoring gates before anything is stored: editor access plus `workflow.write` on the project for a project-scoped skill, and `workflow.host_access` / `workflow.api_write` when a packaged workflow carries gated host-access or write-enabled `crios.api` nodes. Org owners and admins skip these gates, except through a connected app. Dependencies and workflow references are answered within the projects the caller can open: a dependency held by a skill in a project the caller cannot open is `not installed`, exactly as an unknown identifier; no dependency cycle is reported through such a skill; a workflow in such a project is not found, and a name that one visible project and a hidden one both use is ambiguous, with no count. Identifiers are unique across the organization, so a taken one answers 409 for everyone; only a caller who can open the holder's project is told that it is archived, and its id. A connected app (an OAuth token, or a personal access token or browser token that came through the Crios MCP server) saves only its user's draft in a project. Before the authoring gate and before anything is stored, in this order: drafts from connected apps must be allowed by the deployment and the organization (403 `connected_app_drafts_disabled`, with `scope` naming the switch that is off), `draft` must be exactly `true` (403 `draft_required`), `project_id` must be set (403 `project_scope_required`), and the user must have fewer open drafts saved by connected apps than the limit (429 `draft_limit` with `limit`). Counted are only the drafts the user can still clear: in projects where they have editor access or more, in a deleted project they can restore, or organization-wide; an org owner or admin counts every project. The limit is counted again, with the same filter, under a per-user lock in the transaction that inserts, so concurrent saves never pass it. The version is recorded as written via `mcp`, which puts the skill in the review queue. Other callers are unchanged. Since P3 the envelope may carry `workflows/` files (until then 403 `packaged_workflows_require_review`): they are reviewed when a person publishes the draft (`POST /skills/{id}/publish`). For every caller, a packaged `workflows/` definition named like a workflow of the skill's project that this skill does not own (a hand-made one, another skill's, an agent's; compared case-insensitively) answers 409 `workflow_name_taken` before anything is stored, since materializing it would overwrite that workflow. The materialization write refuses it again, so a workflow saved after the check is not taken over; that late case is the 502 below. The MCP server's `skill_create` sends this save with `X-Crios-Require-Connected-App: 1`: a request the orchestrator does not take as a connected app's is then 403 `connected_app_not_recognised` before the handler runs, rather than a plain script's install outside the rules above. parameters: - { name: project_id, in: query, description: Install as a project-scoped skill of this project (must belong to the caller's organization); omit for an org-wide skill. Required for a connected app, schema: { type: string, format: uuid } } - { name: draft, in: query, description: '"true" saves the skill as a draft (any other value installs it). Required for a connected app', schema: { type: string, enum: ['true'] } } - $ref: '#/components/parameters/RequireConnectedApp' requestBody: required: true content: application/yaml: schema: { type: string, description: skill.yaml document } application/json: schema: oneOf: - $ref: '#/components/schemas/SkillManifest' - $ref: '#/components/schemas/SkillInstallEnvelope' responses: '201': description: Installed content: application/json: schema: { $ref: '#/components/schemas/Skill' } '400': description: | Invalid manifest (`fields` lists every problem), unmet dependencies, dependency cycle, unresolved workflow references, invalid packaged workflow definitions or package, packaged workflows on an org-wide skill (they need a project scope), invalid `project_id`, an oversized body, or an `X-Crios-Require-Connected-App` other than exactly `1` (`code` invalid_require_connected_app, from the auth middleware: components/responses/RequireConnectedAppInvalid) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': description: 'Viewer; a non-admin caller failing an authoring gate; a connected app refused by `code`: connected_app_drafts_disabled (with `scope`, deployment or organization; the message names the deployment''s operator, or an organization admin, as the one who can turn drafts on), draft_required or project_scope_required; or, with `X-Crios-Require-Connected-App: 1`, a request the orchestrator did not take as a connected app''s (`code` connected_app_not_recognised, from the auth middleware before the handler: components/responses/ConnectedAppNotRecognised)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '404': { description: 'Non-admin caller: the target project is not accessible' } '409': description: The identifier is already taken in this organization (for a caller who can open the holder's project, `details` names an archived holder, which can be unarchived instead), or a packaged workflow is named like a workflow of the project that the skill does not own (code workflow_name_taken, SkillWorkflowNameTaken) content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillError' - $ref: '#/components/schemas/SkillWorkflowNameTaken' '429': description: 'A connected app whose user already has `limit` open skill drafts saved by connected apps (`code` draft_limit): skills the user created that are still drafts and whose first version a connected app wrote, in projects where the user can still publish or archive them' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '500': description: 'The connected-app drafts setting could not be read (`failed to read the connected-app skill drafts setting`), or open drafts could not be counted; nothing was stored' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '502': description: 'The skill was installed, but materializing its packaged workflows failed (`skill workflow materialization failed`), also when a workflow named like a packaged one appeared in the project after the name check: the write refuses to take it over' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': { description: The authoring checks cannot run on this deployment } /skills/validate: post: tags: [Skills] summary: Validate a skill manifest description: | Checks a manifest (YAML or JSON, read up to 4 MiB) without storing anything. Always answers 200: `errors` lists every field problem, `warnings` carries non-fatal credential/permission consistency findings, and a valid manifest is echoed back parsed under `manifest`. Viewers get 403 (mutating method). requestBody: required: true content: application/yaml: schema: { type: string, description: skill.yaml document } application/json: schema: { $ref: '#/components/schemas/SkillManifest' } responses: '200': description: Validation result content: application/json: schema: { $ref: '#/components/schemas/SkillValidationResult' } '403': { $ref: '#/components/responses/Forbidden' } /skills/generate: post: tags: [Skills] summary: Draft a skill with AI description: | The Skill Creator Studio backend: drafts a manifest from a natural-language description through a multi-stage LLM pipeline (requirements, specialized stages, local security review, one repair round, sandbox pass). Nothing is stored; the Studio saves the draft through `POST /skills`. Sending `current_manifest` turns the call into a refinement of that draft. A draft that still fails validation answers 200 with `validation_errors`. Unmet dependencies of a valid draft come back as `warnings`, checked within the projects the caller can open: a dependency held by a skill in a project they cannot open is warned as not installed, never with its status. Runs on the organization's `skill_generation` model routing, is budget-enforced per organization, and is bounded to 3 minutes. Errors carry a machine-readable `code`. Viewers get 403. An app connected through the Crios MCP server (an OAuth token, or a personal access token or browser token that came through the server) is refused this route by the connected-app fence (403): its generation is a run, `POST /skills/generate/runs`, capped and recorded. Sandbox tokens are refused every method under `/skills/generate`. requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SkillGenerateRequest' } responses: '200': description: Draft (never persisted) content: application/json: schema: { $ref: '#/components/schemas/SkillGenerateResult' } '400': description: 'Invalid request (code invalid_request): missing description, a description over 4000 characters (details "skill description is too long: N chars exceeds the 4000-char cap"), current_manifest over 64 KiB, a type_hint the generator does not author, the retired tool included (error "invalid type_hint", details "must be one of prompt, agent_profile, workflow, connector, code, composite"), invalid project_id' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': { $ref: '#/components/responses/Forbidden' } '429': description: Generation budget exceeded (code budget_exceeded) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '500': { description: Failed to encode the generated manifest (code internal_error) } '502': description: Unusable model output (code invalid_model_output) or another generation failure (code generation_failed) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': description: Generation not configured (code generation_not_configured) or the model lane is unavailable (code generation_unavailable) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '504': description: Generation timed out (code generation_timeout) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } /skills/generate/runs: post: tags: [Skills] summary: Start a skill generation run description: | Starts the generation `POST /skills/generate` runs, detached from the request, and answers at once with the run's id; `GET /skills/generate/runs/{runId}` reads it. A run saves nothing. This is how the MCP server's `skill_generate` works: no MCP call waits the minutes a generation takes. The Studio uses the synchronous route. In order: no generator on this deployment is 503 `generation_not_configured`; for a connected app, drafts from apps must be allowed by the deployment and the organization (403 `connected_app_drafts_disabled` with `scope`; 500 when the switch cannot be read), checked before the body is read; the body is checked as `POST /skills/generate` checks it (400 with code `invalid_request`, a malformed `project_id` included); a run store that cannot be reached is 503 `generation_store_unavailable`; then the caps are counted and the run inserted in one transaction, under advisory locks on the user and then the organization (429 `generation_runs_limit`, nothing recorded). Only an admitted run reads the installed-skill inventory and writes the `skill.generate` audit row (`run_id`, `via_mcp`, the description's length, never its text), on the request's values without its cancellation, so a client that hangs up after the insert still leaves both. Caps: 2 running runs per user (across all of the user's organizations) and 5 per organization; runs started per user per hour (`SKILLS_GENERATE_USER_PER_HOUR`, default 10, across organizations) and per organization per day (`SKILLS_GENERATE_ORG_PER_DAY`, default 100). A run counts as running until it ends or four minutes after it started. The generation gets 3 minutes, its dependency checks 30 seconds and the write of its answer 15 seconds, all counted from just before the run was admitted. A request the generator is certain to refuse is refused at the body check, before any admission, with the 400 `POST /skills/generate` answers: a description over 4000 characters (runes after trimming) and a `type_hint` the generator does not author (the retired `tool` included) take no cap slot and write no run row and no audit row. Until the P3 review fixes both were admitted and the run failed with `invalid_request`. The dependency warnings of a done run stay within the projects the caller can open, as the synchronous route's do. A connected app may reach this route (the connected-app fence opens exactly this path and method); sandbox tokens may not. Viewers get 403. parameters: - $ref: '#/components/parameters/RequireConnectedApp' requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/SkillGenerateRequest' } responses: '202': description: The run is recorded and running content: application/json: schema: { $ref: '#/components/schemas/SkillGenerateRunStarted' } '400': description: 'Invalid request (code invalid_request, with details when there are some): missing description; a description over 4000 characters (`{"error":"invalid generation request","code":"invalid_request","details":"skill description is too long: N chars exceeds the 4000-char cap"}`, the synchronous route''s body); current_manifest over 64 KiB; a type_hint the generator does not author, the retired tool included (`{"error":"invalid type_hint","code":"invalid_request","details":"must be one of prompt, agent_profile, workflow, connector, code, composite"}`); invalid project_id; a body that is not JSON; or an `X-Crios-Require-Connected-App` other than exactly `1` (code invalid_require_connected_app, from the auth middleware: components/responses/RequireConnectedAppInvalid). Nothing is recorded or audited' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': description: 'Viewer; a sandbox token; a connected app while drafts from apps are off (code connected_app_drafts_disabled, with scope deployment or organization); or, with `X-Crios-Require-Connected-App: 1`, a request the orchestrator did not take as a connected app''s (code connected_app_not_recognised, from the auth middleware: components/responses/ConnectedAppNotRecognised)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '429': description: A cap refused the run (code generation_runs_limit); nothing was recorded or audited headers: Retry-After: description: The same whole seconds as retry_after schema: { type: integer, minimum: 1 } content: application/json: schema: { $ref: '#/components/schemas/SkillGenerateRunsLimit' } '500': description: 'A connected app''s drafts setting could not be read (failed to read the connected-app skill drafts setting); nothing was recorded' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': description: 'Generation not configured on this deployment (code generation_not_configured), or the run store could not be reached (`{"error":"generation run store unavailable","code":"generation_store_unavailable"}`)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } /skills/generate/runs/{runId}: get: tags: [Skills] summary: Read a skill generation run description: | The caller's own run: only the user who started it, in the organization it was started in, reads it; not another member, not an admin. Each read marks the run, which expires 30 minutes after it was last started, finished or read. A run still running four minutes after it started has lost its worker and is answered, and stored, as failed `generation_orphaned` by a compare-and-set; a completion that arrives later is dropped. Every row is deleted once 25 hours have passed since it started, however recently it was read: by the organization's next start and by a sweep every 15 minutes for the life of the orchestrator. A read never deletes and does not check the start, so a run read within its idle window can answer until that sweep, at most about 15 minutes past its 25 hours. Another user's or organization's run, an id that is not a UUID and an expired run all answer the same 404. A store that cannot be read answers 503, never 404, since a client takes 404 as final. Sandbox tokens are refused (403). parameters: - { name: runId, in: path, required: true, description: 'The run_id POST /skills/generate/runs answered', schema: { type: string, format: uuid } } responses: '200': description: The run content: application/json: schema: { $ref: '#/components/schemas/SkillGenerateRun' } '403': { $ref: '#/components/responses/Forbidden' } '404': description: No run of the caller's with that id, or it expired content: application/json: schema: { $ref: '#/components/schemas/SkillError' } example: { error: generation run not found, code: generation_run_not_found } '503': description: The run store could not be read (code generation_store_unavailable); the run is not known to be missing content: application/json: schema: { $ref: '#/components/schemas/SkillError' } example: { error: generation run store unavailable, code: generation_store_unavailable } /skills/import: post: tags: [Skills] summary: Import a .skill package description: | Installs a `.skill` package: a tar.gz holding `skill.yaml`, optionally `README.md` and `prompts/`, `workflows/`, `connectors/`, `src/`, `tests/`, `assets/` trees; a `SHA256SUMS` file is verified when present. Upload it as multipart form file `file` (the whole form is capped at 11,599,872 bytes) or as the raw request body. Package caps: 10 MiB decompressed, 1 MiB per file, 256 entries. Same validation, draft option and authoring gates as `POST /skills`. parameters: - { name: project_id, in: query, description: Import as a project-scoped skill; takes precedence over the form field, schema: { type: string, format: uuid } } - { name: draft, in: query, description: '"true" saves the skill as a draft', schema: { type: string, enum: ['true'] } } requestBody: required: true content: multipart/form-data: schema: type: object required: [file] properties: file: { type: string, format: binary, description: The .skill package } project_id: { type: string, format: uuid, description: Used when the query parameter is absent } application/gzip: schema: { type: string, format: binary } application/octet-stream: schema: { type: string, format: binary } responses: '201': description: Imported content: application/json: schema: { $ref: '#/components/schemas/Skill' } '400': description: Missing `file` part, invalid package or checksum mismatch, invalid manifest, unmet dependencies, unresolved workflow references, or invalid `project_id` content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Non-admin caller: the target project is not accessible' } '409': description: The identifier is already taken in this organization, or a packaged workflow is named like a workflow of the project that the skill does not own (code workflow_name_taken, SkillWorkflowNameTaken), as for POST /skills content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillError' - $ref: '#/components/schemas/SkillWorkflowNameTaken' '413': { description: Multipart upload exceeds the size cap } '502': description: The skill was imported, but materializing its packaged workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': { description: The authoring checks cannot run on this deployment } /skills/{id}: get: tags: [Skills] summary: Get a skill description: | The skill with its materialized workflows and, for executable skills, the agent tools it advertises. Composites are compiled fresh: a compile failure is reported in `composition_error`, not as an error status. Archived skills are returned too. A composite whose dependency graph reaches a skill in a project the caller cannot open answers `advertised_tools: []` and `composition_hidden: true`, without `effective_permissions`, `composition_error` or `composition_warnings`, also when the graph does not compile (the compile error names a dependency and its status). Both the graph walked whatever the statuses and what the compile read, whether or not it compiled, are checked. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Skill detail content: application/json: schema: { $ref: '#/components/schemas/SkillDetail' } '400': { $ref: '#/components/responses/BadRequest' } '404': { $ref: '#/components/responses/NotFound' } delete: tags: [Skills] summary: Archive a skill description: | Soft-uninstalls the skill: rows and versions are kept, owned workflows are deactivated, and the identifier stays reserved. `POST /skills/{id}/unarchive` reverses it. Refused while enabled skills depend on it: `dependents` names only those in projects the caller can open (it can be empty), and `hidden_dependents: true`, with no name or count, says that others exist; the system and an admin's Disable name every one. Archiving an archived skill is a no-op. Someone who cannot open the skill's project gets the 404 an unknown id gets, before any other rule. Then, when `expected_status` is given and the skill now has another status, the answer is 409 `status_changed` with the status, before the live-skill rule and the authoring gate, and nothing is archived. Archiving an enabled skill needs an org admin (403 `admin_required`). The archive is bound to `expected_status` when given, else to the status the handler read: checked again at the guarded write, so an enable that lands in between answers 409 `status_changed` with the status now, and nothing is archived. A person with manage access to a soft-deleted project archives a draft of it without the authoring gate, which answers a deleted project 404 `project not found`. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } - { name: expected_status, in: query, required: false, description: 'The status the caller loaded the skill with, read as PATCH /skills/{id} reads it. Another status answers 409 status_changed with status, before any other rule but the project check. Exactly one of the five statuses; anything else (empty, repeated, unknown, or a query pair the parser would drop) answers 400 {"error":"invalid expected_status"}, with no code, before the skill is read. Absent, the archive expects the status the handler read. The skill page sends the status it showed', schema: { type: string, enum: [draft, installed, enabled, disabled, archived] } } responses: '204': { description: Archived } '400': description: 'An unreadable `expected_status` (`{"error":"invalid expected_status"}`, no code)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Unknown skill, or the skill's project is one the caller cannot open (`skill not found`, the same answer)" } '409': description: 'Enabled skills depend on it (`skill`, `dependents` naming those the caller can view, and `hidden_dependents: true` when others exist), or it has another status than `expected_status`, or its status changed after it was read (`code` status_changed, with `status`, the status now)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '502': description: The skill was archived, but deactivating its owned workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } patch: tags: [Skills] summary: Publish a new skill version description: | Publishes a new version from a manifest or the Studio envelope `{manifest, files}` (same body forms and size cap as `POST /skills`). `metadata.identifier` must match the installed skill, `spec.type` cannot change, and `metadata.version` must be a higher semver than the active one. The new version becomes active. If the new version widens the approved capability surface (new permissions or credential slots, or a connector auth or base URL host/port change), it still goes live but the skill is disabled pending re-approval: the answer is 200 with `permission_reapproval_required`. Drafts are exempt and stay drafts. Non-admin callers pass the authoring gates against the skill's own project. Archived skills cannot be updated. Changing an enabled skill needs an org admin (403 `admin_required`), and an admin acting through a connected app is held to that too. Someone who cannot open the skill's project gets the 404 an unknown id gets (`skill not found`), for every caller, before any rule that says something about the skill. Then, when `expected_status` is given and the skill now has another status, the answer is 409 `status_changed` with the status, before any write. Every update is decided under the skill's row lock on what the caller was authorized on: the status the handler read and, when given, `expected_version`. A status that moved meanwhile (a draft published, a skill enabled or disabled) answers 409 `status_changed` with the status now, for every caller; another active version answers 409 `version_conflict` with `current_version`. Nothing is written either way. Dependencies and workflow references are answered within the projects the caller can open: a dependency held by a skill in another project is `not installed`, exactly as an unknown identifier, no dependency cycle is reported through such a skill, and a workflow in such a project is not found. A name that one visible project and a hidden one both use is ambiguous, with no count. A connected app (an OAuth token, or a personal access token or browser token that came through the Crios MCP server) changes only its user's own project drafts. In this order: drafts from connected apps must be allowed (403 `connected_app_drafts_disabled` with `scope`, checked before the body is read); the project check and `expected_status` above; an enabled skill is 403 `admin_required`; an organization-wide skill 403 `project_scope_required`; another member's skill 403 `not_your_draft`; a skill that is not a draft 409 `not_a_draft` with its `status`. Since P3 an update with files may carry `workflows/` files (until then 403 `packaged_workflows_require_review`). An update with no files then must validate (400 `invalid skill manifest` with `fields`) and must not drop package files: when the draft's active package holds paths a manifest-only update would not write (a code skill's `src/`, `workflows/`, `connectors/`, `assets/`, extra prompts), the answer is 409 `draft_has_package_files` with `files`, and a person edits the draft in Crios. A `prompts/main.md` that is only the copy of the stored version's inline instructions does not count. Such an update is bound to the version it was checked on: one naming another `expected_version` than the active one answers 409 `version_conflict` with `current_version` at once, before the authoring gate, and one naming none expects the version it read, so a save landing meanwhile is 409 `version_conflict`. For every caller, an update whose files carry a packaged `workflows/` definition named like a workflow of the skill's project that this skill does not own answers 409 `workflow_name_taken`, and no version is written. The skill's own workflows, retired ones included (a definition an earlier version dropped), stay its own, so a definition that comes back is not refused. The MCP server's `skill_update` sends this update with `X-Crios-Require-Connected-App: 1`: a request the orchestrator does not take as a connected app's is then 403 `connected_app_not_recognised` before the handler runs. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } - $ref: '#/components/parameters/RequireConnectedApp' - { name: expected_version, in: query, required: false, description: 'The active version the caller edited. Another active version under the row lock answers 409 version_conflict with current_version. Exactly one decimal integer of at least 1; anything else (empty, repeated, signed, 0, or a query pair the parser would drop, such as one holding a semicolon) answers 400 before the skill is read. Absent, no version is compared', schema: { type: integer, minimum: 1 } } - { name: expected_status, in: query, required: false, description: 'The status the caller loaded the skill with. Another status answers 409 status_changed with status, before any write: publish and enable change the status without moving the active version. Exactly one of the five statuses; anything else (empty, repeated, unknown, or a query pair the parser would drop) answers 400 {"error":"invalid expected_status"}, with no code, before the skill is read. Absent, compared only with the handler''s own read under the lock. The Studio sends it on every save, and the MCP server''s skill_update sends draft', schema: { type: string, enum: [draft, installed, enabled, disabled, archived] } } requestBody: required: true content: application/yaml: schema: { type: string, description: skill.yaml document } application/json: schema: oneOf: - $ref: '#/components/schemas/SkillManifest' - $ref: '#/components/schemas/SkillInstallEnvelope' responses: '200': description: The new active version, or the re-approval payload when permissions widened content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillVersion' - $ref: '#/components/schemas/SkillReapproval' '400': description: 'Invalid manifest or package, identifier or type change, version not higher than the active one, unmet dependencies, dependency cycle, unresolved workflow references, an unreadable `expected_version` or `expected_status` (`{"error":"invalid expected_version"}`, `{"error":"invalid expected_status"}`, no code), or an `X-Crios-Require-Connected-App` other than exactly `1` (`code` invalid_require_connected_app, from the auth middleware: components/responses/RequireConnectedAppInvalid)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': description: 'Viewer; a non-admin caller failing an authoring gate; an enabled skill changed by a member or by any connected app (`code` admin_required); a connected app refused by `code`: connected_app_drafts_disabled (with `scope`), project_scope_required or not_your_draft; or, with `X-Crios-Require-Connected-App: 1`, a request the orchestrator did not take as a connected app''s (`code` connected_app_not_recognised, from the auth middleware before the handler: components/responses/ConnectedAppNotRecognised)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '404': { description: "Unknown skill, or a skill in a project the caller cannot open, answered `skill not found` alike and before any other rule, for every caller" } '409': description: 'The skill is archived (`invalid skill status transition`); it has another status than `expected_status`, or its status changed after it was read (`code` status_changed, with `status`, the status now); another version is active than `expected_version`, under the row lock or, for a connected app''s update with no files, at once (`code` version_conflict, with `current_version`); a connected app''s skill is not a draft (`code` not_a_draft, with `status`); a connected app''s update with no files would drop the draft''s package files (`code` draft_has_package_files, with `files`); a packaged workflow is named like a workflow of the project that the skill does not own (`code` workflow_name_taken, SkillWorkflowNameTaken); or a concurrent update took the same version number (`skill version conflict` with `details`, no code)' content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillError' - $ref: '#/components/schemas/SkillWorkflowNameTaken' '500': description: 'The connected-app drafts setting could not be read, or (a connected app''s update with no files) the draft''s package could not be read (`failed to read the skill''s package`); nothing was written' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '502': description: The version was published, but re-materializing its packaged workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': { description: The authoring checks cannot run on this deployment } /skills/{id}/publish: post: tags: [Skills] summary: Publish a draft skill description: | Moves a draft to `installed`, re-running the dependency, cycle and workflow-reference checks against the current organization state and materializing its packaged workflows. Non-admin callers re-pass the authoring gates against the stored package. Enabling stays a separate org-admin step. The publish is bound to one version: the one whose package the authoring gate checked is the one checked, installed (a compare-and-set on the draft status and that active version) and materialized. A save that lands during the publish answers 409 `version_conflict` with `current_version`, and a skill that stopped being a draft meanwhile 409 `status_changed` with `status`; nothing is installed or materialized. A skill the first read already finds not a draft answers the same code and status, keeping its `error` `skill is not a draft` and its `details`. Someone who cannot open the skill's project gets the 404 an unknown id gets, before either 409. The dependency, cycle and workflow-reference checks answer within the projects the caller can open, as a save does: a dependency held by a skill in a project the caller cannot open is `not installed`, exactly as an unknown identifier, also when it is enabled and in range; no cycle is walked through it; and a workflow in such a project is not found, a name a hidden project also uses ambiguous with no count. Enable, an admin's act, still walks the whole graph for a cycle. A packaged workflow named like a workflow of the project that the skill does not own answers 409 `workflow_name_taken` (SkillWorkflowNameTaken), before the review below and with or without a confirmation; nothing moves. **The publish review.** When an API or MCP caller wrote the skill (`external_authoring_pending`) and the active version's package ships at least one `workflows/` definition (`.json`, `.yaml`, `.yml`), publishing would install those workflows in the project, so the person publishing confirms them first. Without the body `{"confirm": true, "reviewed_version": N}` the answer is 409 `publish_review_required` (SkillPublishReview) with `active_version` and the workflows: each one's trigger types, the hosts it names (`host_access`, with `(dynamic)` for a host decided at run time or reached through something named by id), its server-access node types (`host_nodes`), the node types that call an integration through a connector or credential (`integrations`) and whether it writes through Crios or a database (`api_write`); SkillPackagedWorkflowReview has every rule. This holds for every caller that may publish, an admin's personal access token used directly included. The decision is taken after the gates above, on the manager's own read of the row and the package those gates read. With a confirmation the handler skips its own `expected_version` check and the install is bound to `reviewed_version` by the compare-and-set; when another version is active by then (an app's save after the review was shown, before or during the publish), the answer is 409 `review_outdated` with that version's list if it needs a review too, else `version_conflict` or `status_changed`. Nothing is installed or materialized on any refusal. The `skill.publish` audit row carries `reviewed_version`. A skill nobody outside the editor wrote, or whose version packages no definition, publishes as before, with or without a body. Published workflows start inactive. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } - { name: expected_version, in: query, required: false, description: 'The active version the caller saw. Another active version answers 409 version_conflict with current_version. Read as PATCH /skills/{id} reads it: exactly one decimal integer of at least 1, else 400 {"error":"invalid expected_version"}, with no code. Absent, the version the handler read is still the one installed. With a confirmation it must equal reviewed_version (400 invalid_request otherwise)', schema: { type: integer, minimum: 1 } } requestBody: required: false description: Absent for an ordinary publish; the confirmation of the publish review otherwise content: application/json: schema: { $ref: '#/components/schemas/SkillPublishReviewRequest' } responses: '200': description: 'Published (status installed): the skill row as stored by the transition, external_authoring_pending and updated_at included' content: application/json: schema: { $ref: '#/components/schemas/Skill' } '400': description: 'Unmet dependencies, dependency cycle, unresolved workflow references, packaged workflows on an org-wide skill, an unreadable `expected_version`, or a review body that does not say which version was reviewed (code invalid_request: confirm without reviewed_version or the reverse, a reviewed_version that is not a whole number of at least 1, a body that is not a JSON object, an `expected_version` naming another version), checked before the skill is read' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Unknown skill, or a skill in a project the caller cannot open, answered `skill not found` alike and before any other rule" } '409': description: 'The first read finds the skill not a draft (`{"error":"skill is not a draft","details":"skill is not a draft: is ","code":"status_changed","status":""}`; an older server answers it without code and status); another version is active than `expected_version`, or a save landed during the publish (`code` version_conflict, with `current_version`); the skill stopped being a draft during the publish (`code` status_changed, with `status`); a packaged workflow is named like a workflow of the project that the skill does not own (`code` workflow_name_taken, SkillWorkflowNameTaken); the version installs packaged workflows an API or MCP caller wrote and no confirmation was sent (`code` publish_review_required, SkillPublishReview); or the confirmation named another version than the one now active, which needs a review too (`code` review_outdated, SkillPublishReview, with that version''s list)' content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillError' - $ref: '#/components/schemas/SkillPublishReview' - $ref: '#/components/schemas/SkillWorkflowNameTaken' examples: notADraft: value: { error: skill is not a draft, details: 'skill is not a draft: weekly-digest is installed', code: status_changed, status: installed } reviewRequired: value: error: publishing this skill installs workflows an app wrote; review them first code: publish_review_required active_version: 1 workflows: - { name: Cleanup, triggers: [crios.trigger.webhook], host_access: [], api_write: false, host_nodes: [], integrations: [] } - { name: Nightly report, triggers: [crios.trigger.schedule], host_access: ['(dynamic)', api.example.com], api_write: true, host_nodes: [], integrations: [crios.db.write, crios.webhook.call] } - { name: Server ops, triggers: [crios.trigger.schedule], host_access: [], api_write: false, host_nodes: [crios.ssh], integrations: [crios.slack, crios.ssh] } reviewOutdated: value: error: the skill changed after its workflows were reviewed; review them again code: review_outdated active_version: 3 workflows: - { name: Nightly report, triggers: [crios.trigger.schedule], host_access: [api.example.com], api_write: true, host_nodes: [], integrations: [crios.webhook.call] } workflowNameTaken: value: { error: a workflow named Cleanup already exists in this project, code: workflow_name_taken, workflow: Cleanup } '500': { description: 'The publish review''s list could not be built (`{"error":"failed to build the publish review"}`); nothing was published' } '502': description: Published, but materializing its packaged workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': { description: The authoring checks cannot run on this deployment } /skills/{id}/enable: post: tags: [Skills] summary: Enable a skill description: | Requires org admin (owner or admin role in the active organization). Makes the skill live for the whole organization and activates its owned workflows. A skill that declares permissions or credentials, or that an API or MCP caller wrote and no admin has confirmed since (`external_authoring_pending`), needs `confirm_permissions: true`; without it the answer is 409 with the declared grants and, for the latter, a `review`, so the UI can show a review dialog. This holds for an admin's personal access token too: who enables does not matter, only who wrote. Every dependency must be enabled with a matching version, and the skill must sit on no dependency cycle anywhere in the organization (the whole graph is walked, since a save, and a person's publish, rollback or unarchive, check only the projects their caller can open). A confirmation should name the version it reviewed (`reviewed_version`). If another version became active since, the answer is 409 `review_outdated` with the current grants and review, and nothing changes. A confirmed enable clears `external_authoring_pending` and sets `last_confirmed_version`; on an already enabled skill it does only that. An enable may name the status the approver saw (`expected_status`). It is decided first, under the row lock: another status answers 409 `status_changed` with the status now, and nothing changes. The Studio's review of a live skill sends `enabled`, so a review never switches back on a skill another admin disabled meanwhile. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } requestBody: content: application/json: schema: type: object properties: confirm_permissions: { type: boolean, description: "The approver has reviewed the declared permissions and credentials, and the review when there is one" } reviewed_version: { type: integer, description: 'With confirm_permissions: the active_version the approver reviewed. A different active version answers 409 review_outdated' } expected_status: { type: string, description: 'The status the approver saw. When present (an empty string included) and the skill has another status under the row lock, the answer is 409 status_changed and nothing changes. Absent or null compares nothing' } responses: '200': description: Enabled content: application/json: schema: type: object properties: status: { type: string, enum: [enabled] } '400': description: Unmet dependencies, or a dependency cycle (`skill dependency cycle detected` with `path`) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: 'Confirmation required (`error` is `permission_confirmation_required`), a stale confirmation (`code` is `review_outdated`), a status other than `expected_status` (`code` is `status_changed`, with `status`), or the status cannot move to enabled (draft, archived). The first two carry `active_version`, `permissions` and `credentials`, plus `review` while `external_authoring_pending` is set' content: application/json: schema: type: object properties: error: { type: string } code: { type: string, enum: [review_outdated, status_changed] } status: { type: string, description: 'code status_changed: the skill''s status now' } details: { type: string } active_version: { type: integer, description: The version the refusal was decided on; a confirmation names it as reviewed_version } permissions: { type: array, items: { type: string } } credentials: { type: array, items: { type: string } } review: { $ref: '#/components/schemas/SkillEnableReview' } '502': description: Enabled, but activating its owned workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } /skills/{id}/disable: post: tags: [Skills] summary: Disable a skill description: | Requires org admin (owner or admin role in the active organization). Takes the skill offline for the organization and deactivates its owned workflows. Refused while enabled skills depend on it. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Disabled content: application/json: schema: type: object properties: status: { type: string, enum: [disabled] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: Enabled skills depend on it, or the status cannot move to disabled (draft, archived) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '502': description: Disabled, but deactivating its owned workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } /skills/{id}/unarchive: post: tags: [Skills] summary: Restore an archived skill description: | Moves an archived skill back to `installed`, through the same gates as publish (an archived skill may be an archived draft): non-admin callers re-pass the authoring gates against the stored package, the dependency, cycle and workflow-reference checks re-run against the current organization state, and the packaged workflows materialize. Only an archived skill moves. Re-enabling stays a separate org-admin step. The checks answer within the projects the caller can open, as for publish: a dependency in a project the caller cannot open is `not installed`, exactly as an unknown identifier. A packaged workflow named like a workflow of the project that the skill does not own answers 409 `workflow_name_taken`. Unarchive installs the active version's packaged workflows, so it asks the publish review as publish does (an app's archived draft, for one): without `{"confirm": true, "reviewed_version": N}` the answer is 409 `publish_review_required` with the error `unarchiving this skill installs workflows an app wrote; review them first`. A confirmation of another version than the active one is 409 `review_outdated` with the active version's list when the active version needs a review too, and otherwise 409 `{"error":"skill version conflict","code":"version_conflict","current_version":M}` (a person's archived skill that needs no review, or one that left the archive, moved to a version that needs none and was archived again after the dialog was shown); nothing moves. The move is bound to the confirmed version (a compare-and-set on the archived status and that active version, read again on a miss), and the `skill.unarchive` audit row carries `reviewed_version`. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } requestBody: required: false description: Absent for an ordinary unarchive; the confirmation of the publish review otherwise content: application/json: schema: { $ref: '#/components/schemas/SkillPublishReviewRequest' } responses: '200': description: Restored content: application/json: schema: type: object properties: status: { type: string, enum: [installed] } '400': description: 'Unmet dependencies, dependency cycle, unresolved workflow references, packaged workflows on an org-wide skill, or a review body that does not say which version was reviewed (code invalid_request), checked before the skill is read' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Unknown skill, or a skill in a project the caller cannot open, answered `skill not found` alike and before the status is named" } '409': description: 'The skill is not archived (draft, installed, enabled or disabled); a packaged workflow is named like a workflow of the project that the skill does not own (code workflow_name_taken); the version installs packaged workflows an API or MCP caller wrote and no confirmation was sent (code publish_review_required); the confirmation named another version than the active one, which needs a review too (code review_outdated, with its list); or the confirmation named another version and the active one needs no review (code version_conflict, with current_version)' content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillError' - $ref: '#/components/schemas/SkillPublishReview' - $ref: '#/components/schemas/SkillWorkflowNameTaken' '500': { description: 'The publish review''s list could not be built; nothing was unarchived' } '502': description: Restored, but materializing its packaged workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': { description: The authoring checks cannot run on this deployment } /skills/{id}/rollback: post: tags: [Skills] summary: Roll back to a prior version description: | Makes an earlier version active again and re-materializes that version's packaged workflows. The target version passes the same gates as publish: non-admin callers re-pass the authoring gates against the target version's stored package, and the dependency, cycle and workflow-reference checks re-run against the current organization state. Rolling back to the active version is a no-op. A target that widens the approved capability surface still rolls back, but the skill is disabled pending re-approval (200 with `permission_reapproval_required`). Archived skills cannot be rolled back. Someone who cannot open the skill's project gets the 404 an unknown id gets, before the live-skill rule and before the version asked for is looked up. Then, when the body's `expected_status` is given and the skill now has another status, the answer is 409 `status_changed` with the status, before the live-skill rule and the authoring gate, and the active version does not move. Rolling back an enabled skill needs an org admin (403 `admin_required`). The rollback is bound to `expected_status` when given, else to the status the handler read: checked again under the row lock, so an enable that lands in between answers 409 `status_changed` with the status now, and the active version does not move. The dependency, cycle and workflow-reference checks on the target version answer within the projects the caller can open, as for publish. Rollback reads its status guard from the body only. `expected_status` in the query, where PATCH and archive read it, answers 400 `{"error":"invalid expected_status"}` however it is spelt (escaped, repeated, a pair the parser would drop), before the skill is read, rather than being ignored. A packaged workflow of the target named like a workflow of the project that the skill does not own answers 409 `workflow_name_taken`; the skill's own workflows, retired ones included (a definition a later version dropped), stay its own. A rollback of a skill that is not a draft installs the target's packaged workflows, so when the target's package ships at least one definition and the skill awaits a person's review, or would after the move (the flag is set, or the target is not `last_confirmed_version` and an API or MCP caller wrote a version at or below it), the publish review is asked of the target: without `"confirm": true` the answer is 409 `publish_review_required` with the error `rolling back to this version installs workflows an app wrote; review them first`, the target in `active_version` and the target's list. The target is the version confirmed; a `reviewed_version`, when sent, must equal `version`. Version rows never change, so this confirmation is never `review_outdated`. The `skill.rollback` audit row carries `reviewed_version`. A draft's rollback installs nothing and asks nothing. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [version] properties: version: { type: integer, minimum: 1, description: Version number to activate } expected_status: { type: string, enum: [draft, installed, enabled, disabled, archived], description: 'The status the caller loaded the skill with. Another status answers 409 status_changed with status, before any other rule but the project check, and nothing moves. Optional; when present it must be a JSON string naming one of the five statuses, given once: null, "", another JSON type, an unknown status or the key twice in any letter case answers 400 {"error":"invalid expected_status"}, with no code, before the skill is read. Absent, the rollback expects the status the handler read. The skill page''s versions card sends the status it showed' } confirm: { type: boolean, description: 'true confirms the publish review of the target''s packaged workflows (the 409 publish_review_required this rollback answered without it). Absent or null is no confirmation; another JSON type answers 400 invalid_request' } reviewed_version: { type: integer, minimum: 1, description: 'Optional with confirm true, and then it must equal version; sent without confirm true, or naming another version, it answers 400 invalid_request' } responses: '200': description: The now-active version, or the re-approval payload when permissions widened content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillVersion' - $ref: '#/components/schemas/SkillReapproval' '400': description: 'Invalid version, unmet dependencies, dependency cycle, unresolved workflow references, packaged workflows on an org-wide skill, or an unreadable `expected_status` in the body, or any `expected_status` in the query (`{"error":"invalid expected_status"}`, no code), or an unreadable review confirmation (code invalid_request)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Unknown skill or version, or a skill in a project the caller cannot open (`skill not found`, checked before the version)" } '409': description: 'The skill is archived, or it has another status than `expected_status`, or its status changed after it was read (`code` status_changed, with `status`, the status now); a packaged workflow of the target is named like a workflow of the project that the skill does not own (`code` workflow_name_taken); or the target installs packaged workflows an API or MCP caller may have written and no confirmation was sent (`code` publish_review_required, with the target in `active_version`)' content: application/json: schema: oneOf: - $ref: '#/components/schemas/SkillError' - $ref: '#/components/schemas/SkillPublishReview' - $ref: '#/components/schemas/SkillWorkflowNameTaken' example: { error: skill status changed, code: status_changed, status: enabled } '500': { description: 'The publish review''s list of the target could not be built; nothing was rolled back' } '502': description: Rolled back, but re-materializing the target version's workflows failed content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': { description: The authoring checks cannot run on this deployment } /skills/{id}/versions: get: tags: [Skills] summary: List skill versions description: | For a Team Playbook playbook, leaves out every version that rests on a session the organization may no longer read (the check Restore makes), for everyone, owners and admins included, and for anyone but owners and admins also every version that was proposed and never approved. A version left out answers the diff as a version that doesn't exist. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Every published version, newest first content: application/json: schema: type: object properties: versions: type: array items: { $ref: '#/components/schemas/SkillVersion' } '404': { $ref: '#/components/responses/NotFound' } /skills/{id}/versions/{version}/diff: get: tags: [Skills] summary: Diff two skill versions description: Unified diff (3 lines of context) of the canonical manifest YAML, going from the `against` version to `{version}`. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } - { name: version, in: path, required: true, description: Target version number, schema: { type: integer, minimum: 1 } } - { name: against, in: query, description: Base version number; defaults to the active version, schema: { type: integer, minimum: 1 } } responses: '200': description: Diff content: application/json: schema: type: object properties: diff: { $ref: '#/components/schemas/SkillVersionDiff' } '400': { $ref: '#/components/responses/BadRequest' } '404': { description: 'Unknown skill or version, or on either side a version the version list leaves out for the caller' } /skills/{id}/export: get: tags: [Skills] summary: Export a skill as a .skill package description: | Downloads the active version as a `.skill` package (tar.gz) named `.skill`. The original uploaded archive is returned when one was stored, so `workflows/`, `src/` and other package files survive a round trip. Session sandbox tokens get 403. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Package bytes (Content-Disposition attachment) content: application/gzip: schema: { type: string, format: binary } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': description: Archived skills cannot be exported content: application/json: schema: { $ref: '#/components/schemas/SkillError' } /skills/{id}/dependencies: get: tags: [Skills] summary: Resolve a skill's dependency tree description: | The declared dependency closure, resolved tolerantly: a missing, disabled or version-mismatched dependency is reported on its node instead of failing the request. Empty when the skill declares no dependencies. Walks stop at cycles and after 256 nodes. A dependency held by a skill in a project the caller cannot open is exactly `{"identifier", "version_range", "status": "hidden"}`, with no other key and no children. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Dependency tree content: application/json: schema: type: object properties: dependencies: type: array items: { $ref: '#/components/schemas/SkillDependencyNode' } '404': { $ref: '#/components/responses/NotFound' } /skills/{id}/credentials: get: tags: [Skills] summary: Check a skill's credential slots description: | Resolution status of every credential slot (`_`) the active manifest declares, in declaration order. Sources are checked in precedence order: org connector configuration, connected user accounts, then the project's workflow credentials (project-scoped skills only). Statuses and references only, never secret values. Session sandbox tokens get 403. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Slot statuses (empty when the manifest declares none) content: application/json: schema: type: object properties: credentials: type: array items: { $ref: '#/components/schemas/SkillCredentialStatus' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Credential checking is not configured } /skills/{id}/credentials/plan: get: tags: [Skills] summary: Plan how to fill credential slots description: | The Studio's setup guide: each declared slot's status plus, when unsatisfied, the existing flows that can fill it (a project workflow credential, a connected account granted to the project, or the org connector an admin configures). Creates nothing. Session sandbox tokens get 403. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Credential plan content: application/json: schema: type: object properties: slots: type: array items: { $ref: '#/components/schemas/SkillCredentialPlanSlot' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '503': { description: Credential checking is not configured } /skills/{id}/health: get: tags: [Skills] summary: Report a skill's runtime availability description: Lifecycle status plus whether this deployment can execute the skill's type right now. No liveness probe is run. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Health content: application/json: schema: { $ref: '#/components/schemas/SkillHealth' } '404': { $ref: '#/components/responses/NotFound' } /skills/{id}/execute: post: tags: [Skills] summary: Execute a skill description: | Runs one enabled skill with caller-supplied inputs: the Studio test panel, agent tool calls and API callers. The result shape depends on the skill type (see the response). Connector skills need `action`; composites return their composition report unless `tool` names one of their tools, which is then routed to the dependency that owns it. The body is capped at 12 MiB. Every run passes per-replica admission limits (defaults: 120 runs a minute per organization, 30 per skill, 8 concurrent per organization, 2 per skill; 429 when exceeded) and a per-type deadline (5 s declarative, 10 s connector, 30 s workflow, 5 min code and composite), and is recorded in the execution history (origin `test` for a member's own token, `agent` for a sandbox token, `api` for a personal API token). Sandbox tokens must send `session_id`: the session must belong to the token's user, organization and project, allow the skill's session types, and have the skill attached to its project or pinned; otherwise 403 with a `kind`. Agent results over 256 KiB are replaced by a 422. Viewers get 403. A personal access token or connected app that runs a workflow skill also needs editor access and `execution.run` in the workflow's project, and a composite tool needs access to its dependency's project. A composite's composition report (no `tool`) needs, for every skill in its graph, the access running that skill directly takes (viewer for a prompt or agent_profile skill, editor for the others), also when the graph does not compile, checked on what the compile read (a dependency the session type skipped takes viewer access, so the answer does not depend on `session_type`). When the graph reaches a skill in a project the caller cannot open, any tool call is refused with one answer unless the tool runs a skill the caller can open that the composite, or a composite reached only through composites the caller can open, names: 403 `dependency_project_access_required` with `"error": "access to the dependency's project is required"`, naming the first such skill, whatever the tool and whether or not the graph compiles. The refusal names an access level only to a caller who can view the dependency's project. A person's own browser session (origin `test`, the Studio) running a composite whose graph reaches a skill in a project they cannot open gets that same level-free 403, one body for the composition report and every tool, unless the tool runs a skill they can open on such a path: the rule behind `GET /skills/{id}`'s `composition_hidden`. Only view access is asked of a Studio test; org owners and admins open every project, and a sandbox token's call is unchanged. These checks run before admission and again in dispatch, so a refusal spends no budget and leaves no history row, only a coalesced `skill.execution_denied` audit row. Connector skills dial only public addresses unless the operator allow-lists a host (`CRIOS_WORKFLOW_EGRESS_ALLOW_HOSTS`); metadata addresses are never allowed, and no HTTP proxy is used. A credential is sent only to its own provider's host. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } requestBody: content: application/json: schema: { $ref: '#/components/schemas/SkillExecuteRequest' } responses: '200': description: Runtime result content: application/json: schema: { $ref: '#/components/schemas/SkillExecuteResult' } '400': description: Invalid body or `session_id`, a missing required input, a prompt or agent_profile skill whose inputs would render more than 4 MiB of text (`skill execution failed`), a missing or unknown connector `action`, an unknown composite `tool`, a workflow skill with more than one workflow reference, the skill's own code failing, or the code runner refusing the request (4xx) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': description: Viewer; sandbox session scope denied (`kind` is session_required, session_not_found, session_mismatch, session_type or not_attached); a workflow skill references a workflow it does not own without declaring the `workflow.execute` permission; an API caller lacks access to the workflow's project, to the dependency's project, to the project of a skill in a composite's composition report, or calls a tool of a composite that reaches a skill in a project it cannot open (`code` is workflow_project_access_required or dependency_project_access_required); or a person's own browser session (origin test) asks for the composition report, or a tool, of a composite that reaches a skill in a project they cannot open (`code` dependency_project_access_required, `error` "access to the dependency's project is required", one body for the report and every tool) content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '404': { description: 'Unknown skill, or its referenced workflow is gone' } '409': description: The skill is not enabled, a connector or code credential is unresolved (including one whose provider host does not match the connector's), the referenced workflow has no runnable active version, or a composite dependency is missing or disabled content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '422': description: Retired `tool` type, a composite that does not compile, an unsupported entrypoint (wasm), connector egress not granted, the egress guard refused the address a connector's base_url resolved to (`code` is connector_address_denied; nothing was sent), or an agent result over 256 KiB content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '429': description: Admission denied (`kind` is org_rate_limited, skill_rate_limited, org_concurrency or skill_concurrency; an API caller (PAT, OAuth token or connected app) can also get api_org_rate_limited, api_actor_rate_limited, api_skill_rate_limited, api_org_concurrency or api_skill_concurrency). A denied call spends no budget. content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '500': description: 'An API caller''s project access check could not run (`error` is "workflow access check failed"); nothing ran' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '502': description: 'Upstream failure (connector request, workflow start, code runner). A connector failure carries `code`: connector_upstream_error with `upstream_status` (the upstream answered, so it may have acted), or connector_transport_error (no answer came; whether it saw the request is unknown)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '503': description: The runtime (or credential resolution) for this skill type is not configured, or the code runner is unavailable content: application/json: schema: { $ref: '#/components/schemas/SkillError' } /skills/{id}/preview: post: tags: [Skills] summary: Preview a prompt or agent_profile skill description: | Renders the active version of a `prompt` or `agent_profile` skill with the caller's `inputs`, as the declarative runtime would render it once the skill is enabled, whatever its status but archived: draft, installed, enabled or disabled. It is how whoever wrote a draft (a person, or an app connected through the Crios MCP server) sees what its text becomes before anyone enables it. A preview is a read: it returns nothing `GET /skills/{id}` does not, only rendered, so it takes the same access. Anyone who may read the skill may preview it, a project viewer and an org-role viewer included, and anyone else gets 404. It stays open past the license grace, like the read. A connected app reaches it; a sandbox token, a token bound to one project and a fine-grained token do not. Nothing runs: no execution-gateway admission and no budget spent, no execution-history row and no audit row. The body takes at most 1 MiB, and a render over 4 MiB (the instructions with their placeholders filled, plus the listed input values) is refused as an input error. The stored manifest is checked as the runtime checks it before rendering. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } requestBody: content: application/json: schema: type: object properties: inputs: { type: object, additionalProperties: true, description: 'Input values by name. A value that is not a string is rendered as its JSON text; a declared default fills an input left out' } session_type: { type: string, description: 'The session type to render for; one the skill does not apply to answers 400' } responses: '200': description: The rendered text content: application/json: schema: type: object required: [appendix, version, status] properties: appendix: { type: string, description: The text the runtime would append to an agent's system prompt } version: { type: integer, description: The active version that was rendered } status: { type: string, enum: [draft, installed, enabled, disabled], description: 'The skill''s status at the read, so a draft''s preview is never taken for live guidance' } '400': description: 'Invalid id; a body that is not JSON, whose `inputs` is not an object, or over 1 MiB (`invalid request body`); a missing required input, a session type the skill does not apply to, or a render over 4 MiB (`error` is "skill execution failed", the reason in `details`); or a stored manifest that fails validation (`invalid skill manifest` with `fields`)' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '403': description: 'A sandbox token ("sandbox tokens can only read and execute skills"), a token bound to one project (organization-wide route), or a fine-grained token' content: application/json: schema: { $ref: '#/components/schemas/Error' } '404': { description: "Unknown skill, no read access to its project, or its active version row is missing" } '409': description: 'The skill is archived: `{"error":"skill is archived","code":"skill_archived"}`' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } '422': description: 'The skill is not a prompt or agent_profile skill, or its stored manifest is of another type: `{"error":"preview renders prompt and agent_profile skills only","code":"preview_unsupported_type"}`. Checked before the archived check' content: application/json: schema: { $ref: '#/components/schemas/SkillError' } /skills/{id}/executions: get: tags: [Skills] summary: List a skill's execution history description: | Newest first. Rows carry outcomes and sizes, never inputs or outputs. Denied admissions are not recorded. History is pruned after the retention window (720 h by default). Session sandbox tokens get 403. For a composite whose dependency graph reaches a skill in a project the caller cannot open (the rule behind `GET /skills/{id}`'s `composition_hidden`), every row leaves out `tool`, `error_message` and `workflow_execution_id`, whoever ran it, and the answer adds `details_hidden: true`; when, origin, actor, outcome, error kind and sizes stay. The rule follows the graph as it is now. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } - { name: limit, in: query, description: 'Page size; values above 200 are clamped, below 1 rejected', schema: { type: integer, minimum: 1, maximum: 200, default: 50 } } - { name: before, in: query, description: RFC 3339 timestamp; returns rows created strictly earlier (pass the previous page's oldest created_at), schema: { type: string, format: date-time } } - { name: origin, in: query, schema: { type: string, enum: [test, agent, api] } } - { name: status, in: query, schema: { type: string, enum: [success, error] } } - { name: session_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Executions content: application/json: schema: type: object properties: executions: type: array items: { $ref: '#/components/schemas/SkillExecution' } details_hidden: { type: boolean, description: 'Present, and true, only for a composite whose graph reaches a skill in a project the caller cannot open: every row''s tool, error_message and workflow_execution_id were left out' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /skills/{id}/stats: get: tags: [Skills] summary: Get a skill's execution stats description: Totals and latency percentiles over the retained history, the origin split, and a zero-filled runs-per-day series for the last 14 UTC days. parameters: - { name: id, in: path, required: true, description: Skill ID, schema: { type: string, format: uuid } } responses: '200': description: Stats content: application/json: schema: type: object properties: stats: { $ref: '#/components/schemas/SkillExecutionStats' } '404': { $ref: '#/components/responses/NotFound' } /publications: get: tags: [Publishing] summary: List publications across the organization description: | Every publication in the caller's active organization, most recently updated first, each with its project's name (the Publications tab). Org owners and admins see all of them; everyone else sees only publications of projects they can at least view. Projects that were deleted are left out. Personal API tokens need full access ("*") and no project binding; fine-grained or project-bound tokens get 403. responses: '200': description: Publications content: application/json: schema: type: object properties: publications: type: array items: allOf: - $ref: '#/components/schemas/Publication' - type: object properties: project_name: { type: string } '401': { $ref: '#/components/responses/Unauthorized' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Failed to list publications } # ==================== ORG ADMIN (/organizations/{id}) + INSTANCE ADMIN (/admin) ==================== /organizations/{id}/export: get: tags: [Organizations] summary: Export the organization's data description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Streams a gzip-compressed tar archive (`crios-org-export--.tar.gz`) of the organization's control-plane rows as NDJSON, one directory per table (`data//part-00001.ndjson`, chunked at 10,000 rows or 4 MiB). Secrets are excluded by construction (password and TOTP hashes, API key hashes, OAuth/refresh tokens, provider keys, SMTP credentials, share/invitation token hashes, binary blobs), as are auth-only tables and per-project database credentials. `manifest.json` (`format` = `crios-org-export/v1`, per-table `rows`/`parts`/`columns`, `complete: true`) is written last: an archive without it is incomplete (a mid-stream failure writes `export-error.txt` instead). One export per organization at a time. Each export is recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } - name: include in: query description: Comma-separated opt-in table groups that dominate row counts. `events` adds session and agent events; `llm_calls` adds per-call LLM records. schema: { type: string, example: 'events,llm_calls' } responses: '200': description: Archive stream content: application/gzip: schema: { type: string, format: binary } '400': { description: "`include` holds something other than events/llm_calls" } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: An export for this organization is already running } /organizations/{id}/signing/providers: get: tags: [PDF Signing] summary: List signing providers description: | Org admin only (owner or admin). The key holders an identity can be created with, each with the JSON Schemas of its settings and of its credential (`secrets_schema`; every field there carries `x-secret: true` and is write-only). The development provider (`softkey`, `dev: true`) is listed only where the deployment allows development identities. The Settings → Signing tab uses this read as its probe: 404 means signing is not enabled. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: The provider forms, sorted by provider key content: application/json: schema: type: object properties: providers: { type: array, items: { $ref: '#/components/schemas/SigningProviderForm' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities: get: tags: [PDF Signing] summary: List signing identities description: | Org admin only (owner or admin). Never returns a credential. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: The organization's identities content: application/json: schema: type: object properties: identities: { type: array, items: { $ref: '#/components/schemas/SigningIdentity' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } post: tags: [PDF Signing] summary: Create a signing identity description: | Org admin only (owner or admin). Stores the credential at the signing service's own Vault path (never returned), opens the key holder with it, reads and pins the key's public key, and installs a certificate the key holder already carries (the identity is then `active`; otherwise `pending_certificate`). `generate_key` creates a development key (softkey, on deployments that allow development identities only). Audited as `signing.identity.create` and `signing.identity.credential_set`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: { schema: { $ref: '#/components/schemas/SigningIdentityInput' } } responses: '201': description: Created content: application/json: { schema: { $ref: '#/components/schemas/SigningIdentity' } } '400': { $ref: '#/components/responses/SigningBadRequest' } '403': { description: 'Not an owner or admin, or a development identity on a deployment that allows none (code dev_identities_off)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '404': { $ref: '#/components/responses/SigningNotFound' } '409': { description: 'An identity of that name exists (code name_taken)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '422': { description: 'The key holder could not be opened or did not describe the key (key_unreachable), the key or algorithm is not one Crios signs with (unsupported_key, algorithm_unsupported), or a certificate it carried was refused (certificate_refused, with rule)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities/{sid}: get: tags: [PDF Signing] summary: Get a signing identity description: | Org admin only (owner or admin). Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`, or when the identity is not the organization's. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } responses: '200': description: The identity content: application/json: { schema: { $ref: '#/components/schemas/SigningIdentity' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } patch: tags: [PDF Signing] summary: Edit a signing identity description: | Org admin only (owner or admin). Name, `defaults`, `policy`, `settings`, and `secrets` (replaces the stored credential; write-only). `provider`, `key_ref`, `algorithm` and `generate_key` are refused (code immutable): a new key is a new identity. A field left out is kept; `defaults` and `policy` are replaced whole. Audited as `signing.identity.update` (and `signing.identity.credential_set` for a new credential). Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } requestBody: required: true content: application/json: { schema: { $ref: '#/components/schemas/SigningIdentityInput' } } responses: '200': description: The edited identity content: application/json: { schema: { $ref: '#/components/schemas/SigningIdentity' } } '400': { $ref: '#/components/responses/SigningBadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '409': { description: 'An identity of that name exists (code name_taken)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } delete: tags: [PDF Signing] summary: Delete a signing identity description: | Org admin only (owner or admin). Purges its provider credential, withdraws every grant and deletes the `signing_identity` connections those grants minted in projects (each audited as `credential.delete`); its signing-log rows stay. Audited as `signing.identity.delete`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities/{sid}/csr: post: tags: [PDF Signing] summary: Create a certificate signing request description: | Org admin only (owner or admin). A PKCS#10 request over the given subject and SANs, signed by the identity's key in its key holder, with the key holder's attestation when it gives one (public CAs issuing document-signing certificates may ask for it). Refused for an RSA key below the profile's size after the RSA sunset (rsa_sunset). Audited as `signing.certificate.csr_create`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } requestBody: required: true content: application/json: { schema: { $ref: '#/components/schemas/SigningCSRInput' } } responses: '200': description: The request, PEM content: application/json: { schema: { $ref: '#/components/schemas/SigningCSRResult' } } '400': { $ref: '#/components/responses/SigningBadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '422': { description: 'The key cannot be certified any more (rsa_sunset)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities/{sid}/certificate: post: tags: [PDF Signing] summary: Install a certificate description: | Org admin only (owner or admin). The leaf, then its chain, PEM. Checks: the leaf's public key is the identity's pinned key, it is valid now and not known revoked, its key usage allows signing (digitalSignature or nonRepudiation), its key and algorithm pass the signing profile, and each chain certificate issued the one before it. A failed check refuses the install (422 certificate_refused, `rule` one of key_mismatch, revoked, expired, key_usage, algorithm, chain; audited as `signing.certificate.install_refused`). A certificate without an OCSP or CRL pointer is installed with a warning. The identity becomes `active` unless it is disabled. Audited as `signing.certificate.install`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } requestBody: required: true content: application/json: { schema: { $ref: '#/components/schemas/SigningCertificateInput' } } responses: '200': description: Installed content: application/json: { schema: { $ref: '#/components/schemas/SigningCertificateResult' } } '400': { $ref: '#/components/responses/SigningBadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '422': { description: 'Refused (code certificate_refused) with the rule that refused it', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities/{sid}/test: post: tags: [PDF Signing] summary: Test a signing identity description: | Org admin only (owner or admin). A probe signature by the key holder, verified against the pinned key, and a timestamp round trip when the identity's defaults name a TSA. No document is signed; it works before a certificate is installed. A failed test is a 200 with `ok: false`, the stage and the key holder's error kind. Audited as `signing.identity.test`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } requestBody: required: false content: application/json: { schema: { type: object, description: 'Empty' } } responses: '200': description: The test's result content: application/json: { schema: { $ref: '#/components/schemas/SigningTestResult' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities/{sid}/enable: post: tags: [PDF Signing] summary: Enable a signing identity description: | Org admin only (owner or admin). Returns a disabled identity to the status its certificate gives it (`active`, `pending_certificate`, `expired` or `revoked`); an identity already there is answered unchanged. Audited as `signing.identity.enable`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } requestBody: required: false content: application/json: { schema: { $ref: '#/components/schemas/SigningSwitchInput' } } responses: '200': description: The identity content: application/json: { schema: { $ref: '#/components/schemas/SigningIdentityResult' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '409': { description: 'The status machine does not allow it (code bad_transition)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities/{sid}/disable: post: tags: [PDF Signing] summary: Disable a signing identity description: | Org admin only (owner or admin). A disabled identity refuses every signature until enabled. Audited as `signing.identity.disable`, with the reason when given. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } requestBody: required: false content: application/json: { schema: { $ref: '#/components/schemas/SigningSwitchInput' } } responses: '200': description: The identity content: application/json: { schema: { $ref: '#/components/schemas/SigningIdentityResult' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/identities/{sid}/grants: get: tags: [PDF Signing] summary: List an identity's grants description: | Org admin only (owner or admin). The projects the identity is granted to. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } responses: '200': description: The grants content: application/json: schema: type: object properties: grants: { type: array, items: { $ref: '#/components/schemas/SigningGrant' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } post: tags: [PDF Signing] summary: Grant an identity to a project description: | Org admin only (owner or admin). The project must be in the organization. Mints the project's `signing_identity` connection, named "Signing: ", whose one secret is the grant's handle (never shown; the service keeps only its hash); a grant whose connection cannot be minted or recorded is withdrawn again (503 mint_failed). Audited as `credential.create` and `signing.grant.create`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } requestBody: required: true content: application/json: schema: type: object required: [project_id] properties: project_id: { type: string, format: uuid } responses: '201': description: Granted; `credential_id` is the minted connection content: application/json: { schema: { $ref: '#/components/schemas/SigningGrant' } } '400': { $ref: '#/components/responses/SigningBadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Signing is not enabled, or no such identity or project in this organization', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '409': { description: 'Already granted to the project (code already_granted)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { description: 'The signing service is unavailable (signing_unavailable), or the project connection could not be minted or recorded (mint_failed, connections_unavailable)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } /organizations/{id}/signing/identities/{sid}/grants/{pid}: delete: tags: [PDF Signing] summary: Withdraw a grant description: | Org admin only (owner or admin). Deletes the grant, then the project's minted connection (audited as `credential.delete`); workflows that sign with it fail from then on. Audited as `signing.grant.delete`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { $ref: '#/components/parameters/SigningIdentityId' } - { name: pid, in: path, required: true, description: Project ID, schema: { type: string, format: uuid } } responses: '204': { description: Withdrawn } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'Signing is not enabled, or the identity is not granted to the project (code not_granted)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/log: get: tags: [PDF Signing] summary: Read the signing log description: | Org admin only (owner or admin). The organization's signing log (ch. 43 §8.4): append-only and hash-chained, one row per signature attempt (`started`) and one per its outcome (`succeeded`, `failed`, `abandoned`), newest first. Page with `before`: the lowest `seq` of the page you have. `identity_id` lists one identity's rows only, paged the same way. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: identity_id, in: query, required: false, description: 'Only this identity''s rows, paged within them by `before`. A value that is not a uuid is refused (400 bad_identity)', schema: { type: string, format: uuid } } - { name: before, in: query, required: false, description: 'Rows with a sequence number below this one. Default: the newest', schema: { type: integer, format: int64, minimum: 1 } } - { name: limit, in: query, required: false, description: 'Default 100, at most 500', schema: { type: integer, minimum: 1, maximum: 500 } } responses: '200': description: A page of rows content: application/json: schema: type: object properties: entries: { type: array, items: { $ref: '#/components/schemas/SigningLogEntry' } } '400': { description: 'identity_id is not a uuid (code bad_identity)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/log/verify: get: tags: [PDF Signing] summary: Verify the signing log's chain description: | Org admin only (owner or admin). Recomputes every row's hash in order; names the first row that does not follow and why. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: The chain's state content: application/json: { schema: { $ref: '#/components/schemas/SigningLogVerifyResult' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/log/export: post: tags: [PDF Signing] summary: Export the signing log description: | Org admin only (owner or admin). Every row (at most 100 000), newest first. Audited as `signing.log.export`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: false content: application/json: { schema: { type: object, description: 'Empty' } } responses: '200': description: The rows content: application/json: schema: type: object properties: entries: { type: array, items: { $ref: '#/components/schemas/SigningLogEntry' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/audit: get: tags: [PDF Signing] summary: Read the organization's signing audit description: | Org admin only (owner or admin). The organization's own `signing.*` rows of the audit log (ch. 43 §8.7), newest first; the payloads carry facts only, never a secret, a Vault path, a document, a signature value or a subject DN. `/admin/audit-log` is the instance admins'. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: days, in: query, required: false, description: 'The window, in days. Default 30; 1 to 365', schema: { type: integer, minimum: 1, maximum: 365 } } - { name: limit, in: query, required: false, description: 'Default 100, at most 500', schema: { type: integer, minimum: 1, maximum: 500 } } responses: '200': description: The rows content: application/json: schema: type: object properties: days: { type: integer, description: The window applied } entries: { type: array, items: { $ref: '#/components/schemas/SigningAuditEntry' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { description: No database } /organizations/{id}/signing/trust-anchors: get: tags: [PDF Signing] summary: List trust anchors description: | Org admin only (owner or admin). The certificates the organization's verifications trust (D43-14); a verification may also consult the EU trusted lists when it asks to. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: The anchors content: application/json: schema: type: object properties: anchors: { type: array, items: { $ref: '#/components/schemas/SigningTrustAnchor' } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } post: tags: [PDF Signing] summary: Add a trust anchor description: | Org admin only (owner or admin). One CA certificate, PEM. Audited as `signing.trust_anchor.add`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [certificate_pem] properties: certificate_pem: { type: string, description: 'One certificate, PEM' } responses: '201': description: Added content: application/json: { schema: { $ref: '#/components/schemas/SigningTrustAnchor' } } '400': { $ref: '#/components/responses/SigningBadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '409': { description: 'The certificate is already an anchor (code already_trusted)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/signing/trust-anchors/{aid}: delete: tags: [PDF Signing] summary: Remove a trust anchor description: | Org admin only (owner or admin). Verifications stop trusting certificates that chain to it. Audited as `signing.trust_anchor.remove`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: aid, in: path, required: true, description: Trust anchor ID, schema: { type: string, format: uuid } } responses: '204': { description: Removed } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '503': { $ref: '#/components/responses/SigningUnavailable' } /projects/{id}/signing/sign: post: tags: [PDF Signing] summary: Sign a PDF description: | Project editor, with an identity granted to the project: the grant's handle comes from the project's own `signing_identity` connection, so an identity id alone signs nothing. Multipart: `file` (the PDF), `options` (JSON, `SigningSignOptions`) and, for a visible signature with a picture, `image` (a PNG or JPEG of at most 1 MiB; an image part alone asks for a visible signature with the default text). A visible signature is drawn in a new field placed by `appearance.rect` (default user space) or `appearance.position` (as the page is displayed, after its rotation and crop), or in the existing empty field `field_name` names, at that field's own rectangle and page. A certification signature (`certification_permissions` 1, 2 or 3) needs the identity's `allow_certification` policy and must be the document's first signature; an identity with `require_visible` refuses a request without `appearance` or `image`. An `Idempotency-Key` header makes a retry within 24 hours not sign again: it answers the first signature's file, kept sealed for that window, with `X-Signing-Replayed: true`. The answer is the signed file; `X-Signing-Log-Id`, `X-Signing-Level` and `X-Signing-Output-Sha256` describe it. Every attempt is written to the signing log before the key holder is asked; audited as `signing.sign`, `signing.sign_refused` or `signing.sign_failed` (origin `api`, or `mcp` from the MCP server). The API router's 32 MiB body limit applies. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/ProjectId' } - { name: Idempotency-Key, in: header, required: false, description: 'A key of your own for this signature: a retry with the same key within 24 hours answers the first file instead of signing again', schema: { type: string, maxLength: 200 } } requestBody: required: true content: multipart/form-data: schema: type: object required: [file, options] properties: file: { type: string, format: binary, description: The PDF } options: { $ref: '#/components/schemas/SigningSignOptions' } image: { type: string, format: binary, description: 'PNG or JPEG for the appearance, at most 1 MiB' } encoding: options: { contentType: application/json } image: { contentType: 'image/png, image/jpeg' } responses: '200': description: The signed PDF headers: X-Signing-Log-Id: { description: The signing-log row of this signature, schema: { type: string, format: uuid } } X-Signing-Level: { description: 'The level reached: B-B, B-T, B-LT or B-LTA', schema: { type: string, enum: [B-B, B-T, B-LT, B-LTA] } } X-Signing-Output-Sha256: { description: 'SHA-256 of the signed file, hex', schema: { type: string } } X-Signing-Replayed: { description: 'true when the Idempotency-Key was used by a signature in the last 24 hours and this is that signature''s file: nothing was signed now. Absent otherwise', schema: { type: string, enum: ['true'] } } content: application/pdf: { schema: { type: string, format: binary } } '400': { description: 'Not a multipart body with a file part, malformed options, an image part over 1 MiB, or a request the service refuses as malformed (bad_level, bad_appearance, bad_certification, no_document, no_tsa, …)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '403': { description: 'Not an editor of the project, or the identity is not granted to it (no_grant)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '404': { $ref: '#/components/responses/SigningNotFound' } '409': { description: 'The idempotency key was used: already_signed, or in_progress until the attempt closes', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '413': { description: 'Larger than the identity''s or the service''s document limit (too_large)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '422': { description: 'Refused before the key holder was called (sign_refused, with the policy rule and the log id) or failed (sign_failed, with the stage); a file the service cannot read (unreadable)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /projects/{id}/signing/augment: post: tags: [PDF Signing] summary: Raise a signed PDF's level description: | Project editor. Multipart: `file` (a signed PDF) and `options` (JSON, `SigningAugmentOptions`). Adds a document timestamp (B-T), the validation data (B-LT), or both and an archive timestamp (B-LTA); on a B-LTA file, renews it. Every signature in the file is augmented, whoever made it; no identity or key is needed. Audited as `signing.augment`. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: multipart/form-data: schema: type: object required: [file, options] properties: file: { type: string, format: binary, description: The signed PDF } options: { $ref: '#/components/schemas/SigningAugmentOptions' } encoding: options: { contentType: application/json } responses: '200': description: The augmented PDF headers: X-Signing-Log-Id: { description: The signing-log row of this operation, schema: { type: string, format: uuid } } X-Signing-Level: { description: The level after the operation, schema: { type: string, enum: [B-B, B-T, B-LT, B-LTA] } } content: application/pdf: { schema: { type: string, format: binary } } '400': { description: 'Not a multipart body with a file part, malformed options, or a level or TSA the service refuses (bad_level, no_tsa, bad_url)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '422': { description: 'An unsigned or unreadable file, a TSA that refused, or validation data that could not be gathered (augment_failed, tsa_failed, unreadable)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /projects/{id}/signing/verify: post: tags: [PDF Signing] summary: Verify a signed PDF description: | Any project member, viewers included (a read). Multipart: `file` and `options` (JSON, `SigningVerifyOptions`). The validation report of ETSI EN 319 102-1 against the organization's trust anchors and, when asked, the EU trusted lists. The report never calls a signature qualified (`qualified_status` is always `not_assessed`); a signature trusted through an EU list says so in its trust anchor's `trusted_via`. Not audited. Answers 404 unless the licence has `pdf-signing` and the organization has `signing.pdf`. parameters: - { $ref: '#/components/parameters/ProjectId' } requestBody: required: true content: multipart/form-data: schema: type: object required: [file] properties: file: { type: string, format: binary, description: The PDF } options: { $ref: '#/components/schemas/SigningVerifyOptions' } encoding: options: { contentType: application/json } responses: '200': description: The validation report content: application/json: { schema: { $ref: '#/components/schemas/SigningVerifyReport' } } '400': { description: 'Not a multipart body with a file part, malformed options, or `at` outside 10 minutes of the service''s clock (bad_time)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/SigningNotFound' } '422': { description: 'A file the service cannot read (unreadable)', content: { application/json: { schema: { $ref: '#/components/schemas/SigningError' } } } } '503': { $ref: '#/components/responses/SigningUnavailable' } /organizations/{id}/settings: get: tags: [Organizations] summary: Get organization settings description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Same values as the member-readable `GET /org-settings`. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Settings content: application/json: schema: { $ref: '#/components/schemas/OrgSettings' } '403': { $ref: '#/components/responses/Forbidden' } put: tags: [Organizations] summary: Update organization settings description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Identical to PATCH: a partial update, omitted fields keep their value. Only these toggles are org-admin editable; rename, budgets and SMTP stay with the instance admin under `/admin`. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/OrgSettingsUpdate' } responses: '200': description: Updated settings content: application/json: schema: { $ref: '#/components/schemas/OrgSettings' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: '`{"error", "code": "allow_signups_not_applicable"}`: allow_signups was changed where registration does not read it (allow_signups_applies false)' } patch: tags: [Organizations] summary: Update organization settings description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Partial update: at least one field is required and omitted fields keep their value. The change is recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/OrgSettingsUpdate' } responses: '200': description: Updated settings content: application/json: schema: { $ref: '#/components/schemas/OrgSettings' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: '`{"error", "code": "allow_signups_not_applicable"}`: allow_signups was changed where registration does not read it (allow_signups_applies false)' } /organizations/{id}/org-agents: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: Get the Team Playbook tab description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:read`. Everything the Team Playbook tab shows: the lessons lane, this month's tokens and cost against the cap, the latest run, how many playbooks each filter covers (`agent_counts`), the drafts waiting for review with what would block their one-click enable (`needs_review`), the projects the Team Playbook may read, the caller's own private projects with their consent, the scope and the automatic runs. While the organization has the Team Playbook off (its `org_agents` flag), it answers `{"enabled": false}` and nothing else. Three counts get 2 seconds each, and the rest of the tab answers without them: `ready_sessions` is null when its count takes longer, and `pending_sweep_agents` and `opted_in_people` are null when theirs fail or take longer. Writes nothing. responses: '200': description: 'The tab, or `{"enabled": false}` alone while the Team Playbook is off' content: application/json: schema: { $ref: '#/components/schemas/OrgAgentsTab' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/agents: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: List the Team Playbook's playbooks description: | Org admin only (owner or admin), with their own sign-in or token. `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:read`. Members never read it. A page of the organization's playbooks, searched, filtered and ordered as the Agents view shows them: - `status` is one of the view's four groups: `review` (a draft), `enabled`, `off` (any status other than those three, `disabled` today) or `discarded`. Absent, empty or `all` is every group. - `q` is the search: every word, in any order, ignoring case and accents, over the playbook's name, description, when to use, kind, stack, rules, memory (fact, why, apply), preferences and knowledge (title and text). `%`, `_` and `\` are plain characters. - The order is the groups (needs review, enabled, turned off, discarded), in each the latest change first (the latest of when it was drafted, enabled, discarded and turned off by a privacy sweep), then name, then `skill_id`. - A page continues strictly after the row `before` names, even when that row has changed or gone since. Each playbook is the tab's, with its blockers, uses and open proposal worked out for the playbooks on the page only. Writes nothing. parameters: - { name: status, in: query, required: false, schema: { type: string, enum: [all, review, enabled, off, discarded] }, description: 'A group, or all. Anything else is 400' } - { name: q, in: query, required: false, schema: { type: string, maxLength: 200 }, description: 'The search. Longer than 200 characters is 400' } - { name: limit, in: query, required: false, schema: { type: integer, minimum: 1, maximum: 100, default: 25 }, description: 'Playbooks per page, 1 to 100. Absent or empty, 25. Anything else, a value that is not an integer included, is 400' } - { name: before, in: query, required: false, schema: { type: string }, description: 'A page''s `next`. Absent or empty for the first page. A value that is not a `next` is 400' } responses: '200': description: A page of playbooks content: application/json: schema: { $ref: '#/components/schemas/OrgAgentsListPage' } '400': { description: 'A parameter is out of range (`{"code": "invalid_request"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:read` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/runs: parameters: [{ $ref: '#/components/parameters/OrgId' }] post: tags: [Organizations] summary: Start a Team Playbook run description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. Takes no body. Run now. First the privacy sweep disables every enabled playbook that learned from a session the Team Playbook may no longer read. If the sweep fails, no run starts (503), and what it disabled stays disabled. Then a run starts in the background. It reads the organization's settled sessions, at most 200, and drafts playbooks from them. The answer comes at once, with the run still running. An organization has one run at a time: while one runs, the answer is 409 with that run, and the sweep has still run. A running run with no heartbeat for 15 minutes is marked failed (`stale`) before the new one starts. While the Team Playbook is on, a started run also arms a `daily` or `weekly` schedule that isn't armed, a paused one included. That arming is best effort: if it fails, the answer is still 202. Not idempotent. Audited: - each playbook the sweep disables (`org_agent.auto.privacy_removal`, trigger `run_start`, no actor); - the arming (`org_agent.schedule.set`, reason `run_now`); - later, from the run, each draft (`org_agent.draft.create`) and the run's end (`org_agent.miner.run`). All but the sweep's rows name the caller as the actor. responses: '202': description: The run, started and still running content: application/json: schema: type: object properties: run: { $ref: '#/components/schemas/OrgAgentsRun' } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': description: 'A run is already running (`{"code": "run_in_progress", "run"}`, no `error`). `run` is that run' content: application/json: schema: type: object properties: code: { type: string, enum: [run_in_progress] } run: { $ref: '#/components/schemas/OrgAgentsRun' } '500': { description: 'The run could not be started (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'The privacy sweep failed, so no run started; try again in a minute. Or this installation can''t run the Team Playbook. Both `{"error", "code": "org_agents_unavailable"}`', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } get: tags: [Organizations] summary: List Team Playbook runs description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:read`. The organization's runs, newest first, a page at a time. Pass a page's `next` as `before` to get the page after it. Writes nothing. parameters: - { name: limit, in: query, required: false, schema: { type: integer, minimum: 1, maximum: 100, default: 20 }, description: 'Runs per page, 1 to 100. Absent or empty, 20. Anything else, a value that is not an integer included, is 400' } - { name: before, in: query, required: false, schema: { type: string, format: uuid }, description: 'A page''s `next`: the id of its last run. Absent or empty for the first page. An id that is not one of the organization''s runs is 404' } responses: '200': description: A page of runs content: application/json: schema: type: object properties: runs: { type: array, items: { $ref: '#/components/schemas/OrgAgentsRun' }, description: 'Newest first, by started_at; never null' } next: { type: string, format: uuid, nullable: true, description: 'The `before` of the next page; null when no older run is left' } '400': { description: '`limit` is not an integer from 1 to 100 (`{"code": "invalid_request"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:read` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: '`before` is not one of the organization''s runs (`{"code": "not_found"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/runs/{runId}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: runId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The run''s id' } get: tags: [Organizations] summary: Get a Team Playbook run description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:read`. One run of the organization, as the list shows it. Writes nothing. responses: '200': description: The run content: application/json: schema: type: object properties: run: { $ref: '#/components/schemas/OrgAgentsRun' } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:read` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such run in the organization, an id that is not a UUID included (`{"error": "run not found", "code": "not_found"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } get: tags: [Organizations] summary: Get one playbook description: | Org admin only (owner or admin), with their own sign-in or token. `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:read`. Members never read it. One playbook of the organization, filled as the tab and the list fill it (blockers, uses, open proposal): what the playbook's page shows. Writes nothing. responses: '200': description: The playbook content: application/json: schema: type: object properties: agent: { $ref: '#/components/schemas/OrgAgentsAgent' } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:read` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook in the organization, an id that is not a UUID or is another organization''s included (`{"error": "playbook not found", "code": "not_found"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/enable: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } post: tags: [Organizations] summary: Enable a playbook description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. The body names the version the page showed, `{"version"}`. The one-click enable. It publishes a draft, enables that version as reviewed by the caller, and adds its knowledge items to the organization's knowledge, all at once. A disabled playbook is enabled again the same way. It refuses (409) a discarded playbook, a playbook with a blocker, naming the first blocker in the order the tab lists them, and one whose active version is no longer `version`, so what goes live is always what the caller read. A playbook that is enabled already answers 200 as it is, whatever `version` says, and is not audited. It writes no entry back, so one an owner or admin deleted stays deleted. Only entries that were never written are written then, such as those held back while its evidence named a project the Team Playbook could not read, once it can. Audited (`org_agent.enable`) when the call enables the playbook. requestBody: required: true content: application/json: schema: type: object required: [version] properties: version: { type: integer, minimum: 1, description: 'The playbook''s `version` as the page showed it: the version the click enables' } responses: '200': description: The playbook, enabled content: application/json: schema: type: object properties: agent: { $ref: '#/components/schemas/OrgAgentsAgent' } '400': { description: 'The body is not JSON (`{"error", "code": "invalid_request"}`), or `version` is missing or not a positive integer (`{"error", "code": "version_required"}`, which the page words in each language)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook in the organization, an id that is not a UUID included (`{"error": "playbook not found", "code": "not_found"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': description: | Refused, with `{"code"}` and no `error`: - `agent_discarded`: the playbook is discarded, or its skill is archived. - `edited_after_drafting`: someone edited the draft, and the edit doesn't pass the privacy check that runs on it again. This one also carries `reason` and an `error` in words: `changes_beyond_items` (it changed more than the name, description, when to use, session types and instructions), `text_beside_items` (the instructions hold text that is no rule, memory line or preference), `no_items`, `names_a_member`, `holds_a_secret`, `holds_personal_data`, or `unreadable` (it couldn't be checked). Enable it from Skills, after a review. An edit that passes is enabled like any draft, and the click counts as the review of the edit. - `evidence_project_private`: it learned from a session the Team Playbook may no longer read. Its project went private without the consents it needs, a consent lapsed or was withdrawn, or the project moved or is gone. - `review_required`: it declares permissions, credentials, dependencies or workflows, or it isn't an agent profile. Enable it from Skills, whose review shows them. `status_changed` (`{"error", "code"}`): the playbook changed meanwhile, or its active version is no longer `version` (another admin's edit, a Restore). Nothing is enabled. Reload it. content: application/json: schema: { $ref: '#/components/schemas/OrgAgentsError' } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`). This includes reading the playbook back after the enable. In that case the enable stands and is audited', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/discard: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } post: tags: [Organizations] summary: Discard a playbook description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. Archives the playbook's skill, deletes its knowledge entries, and records the discard with its reason. Runs don't draft its theme again for 90 days. It refuses an enabled playbook (disable it first) and one discarded already. A playbook whose skill was archived under Skills is discarded without a second archive. Audited (`org_agent.discard`, with the reason). requestBody: required: true content: application/json: schema: type: object required: [reason] properties: reason: { type: string, minLength: 1, maxLength: 500, description: 'Why it is discarded: 1 to 500 characters once spaces at either end are trimmed' } responses: '200': description: The playbook, discarded content: application/json: schema: type: object properties: agent: { $ref: '#/components/schemas/OrgAgentsAgent' } '400': { description: 'The body does not decode or is over 64 KiB (`{"error", "code": "invalid_request"}`). Or, once trimmed, `reason` is empty (`reason_required`) or longer than 500 characters (`reason_too_long`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook in the organization, an id that is not a UUID included (`{"error": "playbook not found", "code": "not_found"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': description: | - `agent_discarded`: discarded already (`{"code"}`, no `error`). - `agent_enabled`: enabled. Disable it first (`{"code"}`, no `error`). - `has_dependents`: enabled skills depend on it (`{"error", "code"}`). - `status_changed`: it changed meanwhile. Reload it (`{"error", "code"}`). content: application/json: schema: { $ref: '#/components/schemas/OrgAgentsError' } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`). This includes reading the playbook back after the discard. In that case the discard stands and is audited', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/proposals: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } get: tags: [Organizations] summary: List a playbook's proposed versions and restores description: | Org admin only (owner or admin), with their own sign-in or token. `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403). Members never read any of it, on any route. The playbook's decision log, newest first: each version Crios proposed (`new_version`) with what it would say, and each restore (`rollback`). A proposed version is not active until an owner or admin approves it. What it rests on is counts only. What changed against the active version is `GET /skills/{skillId}/versions/{version}/diff?against={from_version}`. responses: '200': description: The decision log content: application/json: schema: type: object properties: proposals: { type: array, items: { $ref: '#/components/schemas/OrgAgentsProposal' } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app (`admin_required` when it reaches the route), or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook in the organization (`{"error": "playbook not found", "code": "not_found"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/proposals/{proposalId}/approve: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } - { name: proposalId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The proposal''s `id`' } post: tags: [Organizations] summary: Approve a proposed version description: | Org admin only, as the list. Makes the proposal's version the playbook's active one. The body carries what the approver looked at: the version the proposal was compared with and the playbook's status. If another version became active since the proposal was made, the proposal is superseded and nothing else changes: a stale proposal never replaces a newer change. The playbook's status never moves. The approval counts as the person's review of the version. The playbook then rests on the version's evidence and holds its knowledge. Audited (`org_agent.version.approve`). A proposal of kind `rollback` (the scorecards' proposal to go back to the version the live one replaced) is approved here too. It moves the playbook back as a restore does, with the same rules (never to a version that was not live, never onto evidence the organization can no longer read). The approval is the person's confirmation of that version: it stamps the skill's last confirmed version and clears its review flag, as for a proposed version. requestBody: required: true content: application/json: schema: type: object required: [from_version, expected_status] properties: from_version: { type: integer, minimum: 1, description: 'The proposal''s `from_version`, the version the approver compared it with' } expected_status: { type: string, enum: [draft, enabled, disabled], description: 'The playbook''s `status` as the approver saw it' } responses: '200': description: The playbook, with the version active content: application/json: schema: type: object properties: agent: { $ref: '#/components/schemas/OrgAgentsAgent' } '400': { description: 'The body does not decode, or lacks `from_version` or `expected_status` (`invalid_request`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app (`admin_required` when it reaches the route), or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook, or no such proposal of it (`not_found`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': description: | - `proposal_superseded`: another version is active now (`active_version`). The proposal is superseded. - `proposal_not_open`: it is no longer open (`state`: `approved`, `rejected`, or `superseded` for one set aside before anyone decided on it). - `version_conflict`: `from_version` is not the proposal's. - `status_changed`: the playbook's status is another (`status`). The proposal stays open. - `evidence_project_private`: the organization can no longer read what the version rests on, the sessions behind a removal's reason included. - `review_required`: the version declares what this route doesn't show. - `agent_discarded`: the playbook was discarded. content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/proposals/{proposalId}/reject: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } - { name: proposalId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The proposal''s `id`' } post: tags: [Organizations] summary: Reject a proposed version description: | Org admin only, as the list. Closes the open proposal with a reason. Its version stays in the history, was never active and can't be restored. Audited (`org_agent.version.reject`, with the reason). A rollback proposal (kind `rollback`, TP-4) only closes: the playbook stays as it is, and the version it would have gone back to stays restorable. Its audit row records the kind and both versions (`from_version`, `to_version`), never a `rejected_version`. requestBody: required: true content: application/json: schema: type: object required: [reason] properties: reason: { type: string, minLength: 1, maxLength: 500, description: 'Why it is rejected: 1 to 500 characters once trimmed' } responses: '200': description: The playbook, unchanged, with no open proposal content: application/json: schema: type: object properties: agent: { $ref: '#/components/schemas/OrgAgentsAgent' } '400': { description: '`invalid_request`, `reason_required` or `reason_too_long`', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app (`admin_required` when it reaches the route), or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook, or no such proposal of it (`not_found`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': { description: '`proposal_not_open`: it is no longer open (`state`: `approved`, `rejected`, or `superseded` for one set aside before anyone decided on it)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/versions: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } get: tags: [Organizations] summary: List a playbook's version history description: | Org admin only, as the proposals. The playbook's versions, newest first (at most 100), each with who wrote it (Crios or a person, never who), where it stands, and whether it can be restored. responses: '200': description: The versions content: application/json: schema: type: object properties: versions: { type: array, items: { $ref: '#/components/schemas/OrgAgentsVersion' } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app (`admin_required` when it reaches the route), or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook in the organization (`not_found`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/scorecards: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } get: tags: [Organizations] summary: Read a playbook's version scorecards description: | Org admin only, as the proposals. Sandbox tokens and connected apps are refused (403). Members never read any of it, on any route. The stored counts of how the sessions each version was applied to fared (migration 240), newest version first (at most 100), with the comparison against the version it replaced. A session that applied several playbooks counts for each. A nightly job folds each session in once, 48 hours after its use, so the numbers lag a little, and only by batches: the sessions in which the version was the only playbook applied, and those beside another, each fold only once at least `min_sessions` of them from `people_floor` people are waiting, so `all`, `alone` and their difference never move by fewer sessions. A session the guard can't read when its batch folds is never counted. A card under the privacy floor (fewer than `min_sessions` sessions, or sessions of fewer than `people_floor` people) shows no number, and its days are months. Under the floor on either side a comparison is `too_few`. When the live version is clearly worse than the one it replaced, the job opens a proposal of kind `rollback` (`GET …/proposals`) and audits it as `org_agent.rollback.propose`; it never activates anything, and an owner or admin approves it through the same route as any version. responses: '200': description: The scorecards content: application/json: schema: type: object properties: scorecards: type: object properties: active_version: { type: integer } min_sessions: { type: integer, description: 'The floor''s sessions (10 today)' } people_floor: { type: integer, description: 'The floor''s people (3 today)' } verified_sessions: { type: integer } versions: { type: array, items: { $ref: '#/components/schemas/OrgAgentsScorecard' } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app (`admin_required` when it reaches the route), or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook in the organization (`not_found`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/{skillId}/versions/{version}/restore: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: skillId, in: path, required: true, schema: { type: string, format: uuid }, description: 'The playbook''s `skill_id`' } - { name: version, in: path, required: true, schema: { type: integer, minimum: 1 }, description: 'The version to make active again' } post: tags: [Organizations] summary: Restore an earlier version of a playbook description: | Org admin only, as the proposals. Makes an earlier version active again, with the knowledge it held. Only a version that was active before, or that a person wrote, can be restored: never one that was proposed and not approved, and never one resting on sessions the organization can no longer read (a project that went private, a withdrawn opt-in, a deleted project). An open proposal is superseded. `POST /skills/{skillId}/rollback` applies the same rules to a playbook. Audited (`org_agent.version.restore`). requestBody: required: true content: application/json: schema: type: object required: [expected_status] properties: expected_status: { type: string, enum: [draft, enabled, disabled], description: 'The playbook''s `status` as the person saw it' } responses: '200': description: | The playbook, with the version active. The version moved even when something came beside it, and the audit row says what: - `permission_reapproval_required` with `added`: the version asks for more than the one it replaced, so the playbook is now `disabled` until an admin reviews and enables it under Skills, as after `POST /skills/{skillId}/rollback` (audited with `disabled` and `added`). - `materialization_error`: the version's packaged workflows failed after the move (audited with it). content: application/json: schema: type: object properties: agent: { $ref: '#/components/schemas/OrgAgentsAgent' } permission_reapproval_required: { type: boolean, enum: [true], description: Present when the restore disabled the playbook for review } added: { type: array, items: { type: string }, description: 'With `permission_reapproval_required`: the widened grants (credential slots as "credential:")' } materialization_error: { type: string, description: Present when the packaged workflows failed after the move } '400': { description: 'The version is not a positive integer, or `expected_status` is missing (`invalid_request`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app (`admin_required` when it reaches the route), or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '404': { description: 'No such playbook, or no such version of it (`not_found`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': description: | - `version_never_live`: the version was proposed and never approved. - `evidence_project_private`: the organization can no longer read what the version rests on. - `version_active`: it is the active version. - `version_conflict`: another version became active after the playbook was read, by another restore or an approval that committed first; nothing moved (`from_version`: the version active now). - `status_changed`: the playbook's status is another (`status`). - `review_required`, `agent_discarded`: as on approve. content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/scope: parameters: [{ $ref: '#/components/parameters/OrgId' }] put: tags: [Organizations] summary: Set what the Team Playbook learns from description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. The two scopes: - `opt_in` (the default): projects shared with the organization, and in private projects the sessions whose writers all opted in, each person for their own words. - `all`: every session in the organization, except those that hold an external sender's words. Sending the scope it has already changes nothing and is not audited. Whenever the scope is `opt_in` after the request, changed or not, the privacy sweep runs. It disables every enabled playbook that learned from a session the Team Playbook may no longer read, so sending `opt_in` again finishes a sweep that failed. Audited: - a change of scope (`org_agent.scope.set`, reason `org_admin`); - each playbook the sweep disables (`org_agent.auto.privacy_removal`, trigger `scope_opt_in`, no actor). requestBody: required: true content: application/json: schema: type: object required: [scope] properties: scope: { type: string, enum: [opt_in, all] } responses: '200': description: The scope after the request content: application/json: schema: type: object properties: scope: { type: string, enum: [opt_in, all] } scope_set_at: { type: string, format: date-time, nullable: true, description: 'When the scope was set last. Null only for an opt_in that was never set' } disabled_agents: { type: integer, minimum: 0, description: 'The playbooks the privacy sweep disabled, 0 included. Always 0 under all' } narrowed_agents: { type: integer, minimum: 0, description: 'The playbooks the privacy sweep kept on, on a version without what they learned from a session it may no longer read, 0 included. Always 0 under all' } '400': { description: 'The body does not decode or is over 4 KiB (`{"error", "code": "invalid_request"}`), or `scope` is neither `opt_in` nor `all` (`invalid_scope`; case matters)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': { description: '`all` while the Team Playbook was turned off in the organization as the request came in (`{"error", "code": "org_agents_off"}`). `opt_in` is never refused', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'The scope is `opt_in`, but the privacy sweep failed. Send `opt_in` again to finish it. Or this installation can''t run the Team Playbook. Both `{"error", "code": "org_agents_unavailable"}`', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/schedule: parameters: [{ $ref: '#/components/parameters/OrgId' }] put: tags: [Organizations] summary: Set the Team Playbook's automatic runs description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. `daily` or `weekly` arms the schedule, by the caller. `off` disarms it. Either way, a pause is cleared. Sending the value it has while it is armed, or `off` while it is off, changes nothing and is not audited. `OrgAgentsSchedule` says when an armed schedule starts a run. Audited (`org_agent.schedule.set`, reason `saved`) when it changes. requestBody: required: true content: application/json: schema: type: object required: [auto_run] properties: auto_run: { type: string, enum: [daily, weekly, 'off'] } responses: '200': description: The schedule after the request content: application/json: schema: type: object properties: schedule: { $ref: '#/components/schemas/OrgAgentsSchedule' } '400': { description: 'The body does not decode or is over 4 KiB (`{"error", "code": "invalid_request"}`), or `auto_run` is not `daily`, `weekly` or `off` (`invalid_schedule`; case matters)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`), `off` included', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': { description: '`daily` or `weekly` while the Team Playbook was turned off in the organization as the request came in (`{"error", "code": "org_agents_off"}`). `off` is never refused here', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/auto: parameters: [{ $ref: '#/components/parameters/OrgId' }] put: tags: [Organizations] summary: Set whether new playbooks go live by themselves description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. With `auto_enable` true, a new playbook goes live with no person's review: at the end of the run that drafted it, when it has no flag and Enable would not refuse it. Members' sessions then use playbooks that no person read first. A flagged or blocked draft still waits. Each one that goes live is audited (`org_agent.auto.enable`, no actor) with this setting, who saved it and when. Sending the value it has changes nothing and is not audited. A change is audited (`org_agent.auto.set`, reason `org_admin`) with the caller as its actor and the value before and after. requestBody: required: true content: application/json: schema: type: object required: [auto_enable] properties: auto_enable: { type: boolean } responses: '200': description: The setting after the request content: application/json: schema: type: object properties: auto: { $ref: '#/components/schemas/OrgAgentsAuto' } '400': { description: 'The body does not decode, is over 4 KiB or has no `auto_enable` (`{"error", "code": "invalid_request"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, or a personal access token limited to one project or without `organization:write` (`{"error"}`); a connected app (`{"error", "code": "admin_required"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`), `false` included', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': { description: '`true` while the Team Playbook was turned off in the organization as the request came in (`{"error", "code": "org_agents_off"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/auto-versions: parameters: [{ $ref: '#/components/parameters/OrgId' }] put: tags: [Organizations] summary: Set whether changes to a live playbook go live by themselves description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. Settable only while auto mode for new playbooks is on (`PUT …/org-agents/auto`). With `auto_versions` true, a version Crios proposes for a live playbook is activated with no person's approval when it has no flag, and a rollback proposal is applied with no person's approval. A flagged version waits, a version that would widen what the playbook may reach is never activated this way, and the first version proposed after an automatic rollback waits for a person. So does a version made from one that is no longer the live one when Crios scans it: it is never activated this way, and an approval closes it as out of date. And every version a run proposed waits while a version of a live playbook that the run sent the model (to improve it) is no longer live. Each is audited (`org_agent.auto.activate`, `org_agent.auto.rollback`, no actor) with both settings, who saved them and when. Sending the value it has changes nothing and is not audited. A change is audited (`org_agent.auto.versions.set`, reason `org_admin`) with the caller as its actor. requestBody: required: true content: application/json: schema: type: object required: [auto_versions] properties: auto_versions: { type: boolean } responses: '200': description: The sub-setting after the request content: application/json: schema: type: object properties: auto_versions: { $ref: '#/components/schemas/OrgAgentsAutoVersions' } '400': { description: 'The body does not decode, is over 4 KiB or has no `auto_versions` (`{"error", "code": "invalid_request"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, or a personal access token limited to one project or without `organization:write` (`{"error"}`); a connected app (`{"error", "code": "admin_required"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': { description: 'Auto mode for new playbooks is off, either value (`{"error", "code": "auto_enable_off"}`); or `true` while the Team Playbook was turned off in the organization as the request came in (`org_agents_off`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/sweep: parameters: [{ $ref: '#/components/parameters/OrgId' }] post: tags: [Organizations] summary: Run the Team Playbook's privacy sweep description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. Takes no body. The tab's Try again, while `pending_sweep_agents` is above 0. It takes out of every enabled playbook what was learned from a session the Team Playbook may no longer read, or, where that can't be separated, disables the playbook and deletes its knowledge entries. It also deletes the cards (a run's summary of each session it read) of the sessions it may no longer read. It changes no setting: not the scope, the flag or the schedule. Once nothing is left, it answers 0 and 0. Each playbook it narrows or disables is audited (`org_agent.auto.privacy_removal`, trigger `retry`, no actor). The sweep itself writes no audit row. responses: '200': description: The sweep ran content: application/json: schema: type: object properties: disabled_agents: { type: integer, minimum: 0, description: 'The playbooks it disabled, 0 when none. A playbook it kept on, on a version without the affected items, is counted in narrowed_agents instead' } narrowed_agents: { type: integer, minimum: 0, description: 'The playbooks it kept on, on a version without what they learned from a session it may no longer read, 0 when none' } '403': { description: 'Not an owner or admin, `{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:write` (`{"error"}`); or the Team Playbook is off in the organization (`{"code": "org_agents_disabled"}`, no `error`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'The sweep failed; the playbooks it disabled so far stay disabled, so try again in a minute. Or this installation can''t run the Team Playbook. Both `{"error", "code": "org_agents_unavailable"}`', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/notice: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: Get the Team Playbook notice description: | Every member of the organization, viewers included. `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:read`. What the member notice needs: - whether the Team Playbook is on; - the notice's version, and whether the caller acknowledged it; - the scope, and whether the caller acknowledged its current setting. Answers whether the Team Playbook is on or off. Writes nothing. responses: '200': description: The notice content: application/json: schema: { $ref: '#/components/schemas/OrgAgentsNotice' } '403': { description: '`{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:read`. Viewers are let in', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/notice/ack: parameters: [{ $ref: '#/components/parameters/OrgId' }] post: tags: [Organizations] summary: Acknowledge the Team Playbook notice description: | Every member of the organization, viewers included. It stays open when the license no longer allows new work. `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:write`. Records that the caller read the notice (`version`), the scope's current `all` setting (`scope_set_at`), or both. Each value given must match what `GET /organizations/{id}/org-agents/notice` shows now. If one doesn't, the answer is 409 and nothing is recorded. Sending it again records it again. Answers whether the Team Playbook is on or off. Not audited. requestBody: required: true content: application/json: schema: type: object description: At least one of the two properties: version: { type: integer, description: 'The notice version read. It must be the current one, 4 in this release' } scope_set_at: { type: string, format: date-time, description: 'The `scope_set_at` read, while the scope is `all`. Compared as an instant' } responses: '204': { description: Recorded } '400': { description: 'The body does not decode or is over 4 KiB, or it gives neither `version` nor `scope_set_at`. Both are `{"error", "code": "invalid_request"}`', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '403': { description: '`{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:write`. Viewers are let in', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '409': description: | Nothing was recorded. - `notice_version_changed`: `version` isn't the current notice's. The body gives the current version. - `scope_changed`: the scope isn't `all`, or it was set again after `scope_set_at`. The body gives the current scope and when it was set. content: application/json: schema: type: object properties: error: { type: string } code: { type: string, enum: [notice_version_changed, scope_changed] } version: { type: integer, description: 'With notice_version_changed: the current version' } scope: { type: string, enum: [opt_in, all], description: 'With scope_changed: the current scope' } scope_set_at: { type: string, format: date-time, nullable: true, description: 'With scope_changed: when the current scope was set; null when never' } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/consent-requests: parameters: [{ $ref: '#/components/parameters/OrgId' }] post: tags: [Organizations] summary: Ask the owners of private projects to opt in to the Team Playbook description: | Organization owners and admins only. `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403). Asks the owner of every private project of the organization who hasn't opted in there: the request shows on their Team Playbook page, and each owner gets one email with how many of their projects were asked about. The caller's own projects, deleted projects and projects whose owner has left the organization aren't asked about. A project is asked about at most once every 30 days, and its owner isn't asked again within 30 days of their "not now". The answer holds counts only: the caller never learns which projects were asked about, whose they are or what their owners answer. The counts read only when each project was asked about, never an answer: a project whose owner said "not now" within 30 days counts as asked, though its owner isn't asked again yet, and the next ask counts it as it would a project whose owner stayed silent. Audited (`org_agent.consent_request.send`, with the two counts). responses: '200': description: What the ask did content: application/json: schema: type: object properties: asked: { type: integer, minimum: 0, description: 'Projects asked about now, those whose owner said "not now" within 30 days included: they count as asked, though their owner isn''t asked again yet' } skipped_recent: { type: integer, minimum: 0, description: 'Projects left out because they were asked about within 30 days' } '403': { description: 'Not an owner or admin, a sandbox token or a connected app' } '409': { description: 'The organization has the Team Playbook off (`{"code": "org_agents_off"}`), or it learns from every session, so there is no consent to ask for (`{"code": "scope_all"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'A read or write failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/consent-requests/mine: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: List the consent requests open on the caller's own projects description: | Every member of the organization, viewers included. The requests an owner or admin made that are still open on private projects the caller owns, the latest first, at most 100. Never who asked. A request no longer shows once the caller answered it, opted in to the project on their own, or the project was shared with the organization, deleted or handed to another owner. Empty while the organization has the Team Playbook off. Writes nothing. responses: '200': description: The open requests content: application/json: schema: type: object properties: requests: type: array items: { $ref: '#/components/schemas/OrgAgentsConsentRequest' } '403': { description: 'A sandbox token or a connected app' } /organizations/{id}/org-agents/consent-requests/{requestId}/accept: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: requestId, in: path, required: true, schema: { type: string, format: uuid } } post: tags: [Organizations] summary: Accept a consent request description: | The owner of the request's project only. Records the caller's own consent in the project, exactly as `PUT /projects/{id}/org-agents-consent` does, with the same audit row (`project.org_agents_consent.grant`), and closes the request. Whoever asked isn't told. A session's token and a connected app are refused (403). responses: '200': description: The caller's consent content: application/json: schema: type: object properties: org_agents_consent: { $ref: '#/components/schemas/OrgAgentsConsent' } disabled_agents: { type: integer, enum: [0] } narrowed_agents: { type: integer, enum: [0] } '403': { description: "A session's token or a connected app" } '404': { description: "No request with this id is open on a project the caller owns. Someone else's request, an answered one and one that never existed answer alike", content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '409': { description: 'The organization has the Team Playbook off (`{"code": "org_agents_off"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/consent-requests/{requestId}/not-now: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: requestId, in: path, required: true, schema: { type: string, format: uuid } } post: tags: [Organizations] summary: Answer a consent request with "not now" description: | The owner of the request's project only. Closes the request, and the project isn't asked about again for 30 days. An ask meanwhile counts the project as asked without reaching the caller, so the asker's counts are the same as if the caller hadn't answered. The caller's consent is untouched: they can still opt in on their own. Never refused for the organization's Team Playbook being off. Audited as a consent decision (`project.org_agents_consent.not_now`, beside the consent's `.grant` and `.revoke`). A session's token and a connected app are refused (403). responses: '204': { description: Recorded } '403': { description: "A session's token or a connected app" } '404': { description: 'As for accept', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/org-agents/summary: parameters: [{ $ref: '#/components/parameters/OrgId' }] get: tags: [Organizations] summary: Get the Team Playbook as members see it description: | Every member of the organization, viewers included. `{id}` must be the caller's active organization. Sandbox tokens and connected apps are refused (403), and a personal access token needs `organization:read`. The enabled playbooks and the totals across them. Each playbook has its name, when it was enabled, the titles of its knowledge, and two counts. It never shows any of these, which owners and admins see in `GET /organizations/{id}/org-agents` and its list (`GET /organizations/{id}/org-agents/agents`): - a draft, disabled or discarded playbook; - a knowledge item's body; - the sessions, projects or people a playbook learned from; - a run, tokens, cost or a setting. While the organization has the Team Playbook off, it answers `{"enabled": false}` and nothing else. Writes nothing. responses: '200': description: 'The summary, or `{"enabled": false}` alone while the Team Playbook is off' content: application/json: schema: { $ref: '#/components/schemas/OrgAgentsMemberSummary' } '403': { description: '`{id}` is not the caller''s active organization, a sandbox token, a connected app, or a personal access token limited to one project or without `organization:read`. Viewers are let in', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: 'A read failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'This installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /organizations/{id}/license-acceptances/{component}: parameters: - { $ref: '#/components/parameters/OrgId' } - { name: component, in: path, required: true, schema: { type: string, enum: [android-sdk] } } put: tags: [Organizations] summary: Accept a third-party license description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Records (or refreshes) the organization's acceptance of a component's license terms. Accepting `android-sdk` lets sandbox provisioning enable the Android SDK and resumes the organization's sessions parked on that license gate. Sandbox tokens are refused (403): accepting terms is a person's act. Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object required: [terms_version] properties: terms_version: { type: string, description: Version of the terms being accepted } responses: '200': description: Acceptance recorded content: application/json: schema: { $ref: '#/components/schemas/LicenseAcceptance' } '400': { description: "Unknown component, invalid body, or missing terms_version" } '403': { description: 'Not an owner or admin, {id} is not the active organization, or a sandbox token' } delete: tags: [Organizations] summary: Revoke a third-party license acceptance description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Removes the organization's acceptance. Sandbox tokens are refused. Recorded in the audit log. responses: '204': { description: Revoked } '400': { description: Unknown component } '403': { description: 'Not an owner or admin, {id} is not the active organization, or a sandbox token' } '404': { description: License acceptance not found } /organizations/{id}/ca-default: parameters: - { $ref: '#/components/parameters/OrgId' } get: tags: [Organizations] summary: Get the default certificate authority description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. The certificate authority the organization's new publications use by default (`letsencrypt` when none is set), and the authorities it may choose: Let's Encrypt always, ZeroSSL and Google Public CA once an instance admin saved their EAB credentials. responses: '200': description: Default CA and choices content: application/json: schema: { $ref: '#/components/schemas/OrgCADefault' } '403': { $ref: '#/components/responses/Forbidden' } put: tags: [Organizations] summary: Set the default certificate authority description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sets the default CA for the organization's new publications. `zerossl` and `google` require that CA's EAB credentials to be saved first (409 otherwise); a custom certificate is a per-app upload, not a default. Sandbox tokens are refused. Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object required: [provider] properties: provider: { type: string, enum: [letsencrypt, zerossl, google] } responses: '200': description: Saved content: application/json: schema: type: object properties: default_provider: { type: string, enum: [letsencrypt, zerossl, google] } '400': { $ref: '#/components/responses/BadRequest' } '403': { description: 'Not an owner or admin, {id} is not the active organization, or a sandbox token' } '409': { description: The CA's EAB credentials are not configured } /org-settings/license-acceptances: get: tags: [Organizations] summary: List accepted third-party licenses description: | Any org member. The third-party component licenses the caller's active organization has accepted, ordered by component. Clients check it before offering Android sandboxes: provisioning only enables the Android SDK once `android-sdk` has been accepted. responses: '200': description: Acceptances content: application/json: schema: type: array items: { $ref: '#/components/schemas/LicenseAcceptance' } /organizations/{id}/invitations: get: tags: [Organizations] summary: List pending invitations description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Pending invitations, newest first; overdue ones are marked expired first and are not returned. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Pending invitations content: application/json: schema: type: object properties: invitations: type: array items: { $ref: '#/components/schemas/OrgInvitation' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Organizations] summary: Invite someone by email description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Mints a single-use accept link valid for 7 days and emails it. An email that already has an account gets a membership invite (accepted signed-in via `POST /invitations/accept-existing`); a new email creates the account on accept. Only an owner may invite as `owner`. A pending invitation takes a seat under the member limit (instance admins are exempt). When the email was not sent, the response carries `accept_url` so the link can be shared by hand; `email_configured` tells an unconfigured mailer from a failed send. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [email] properties: email: { type: string, format: email } role: { type: string, enum: [owner, admin, member, viewer], default: member } responses: '200': description: Invitation created content: application/json: schema: { $ref: '#/components/schemas/OrgInvitationSent' } '400': { $ref: '#/components/responses/BadRequest' } '403': description: 'Not an org admin, organization mismatch, a non-owner inviting as `owner` (`{"error", "code": "owner_required"}`), or the member limit is reached (`code` = `org_member_limit`)' content: application/json: schema: { $ref: '#/components/schemas/OrgMemberLimitError' } '409': { description: "The user is already a member, or an invitation is already pending for this email" } /organizations/{id}/invitations/{invID}: delete: tags: [Organizations] summary: Revoke a pending invitation description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. The link stops working immediately. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: invID, in: path, required: true, schema: { type: string, format: uuid } } responses: '400': { $ref: '#/components/responses/BadRequest' } '204': { description: Revoked } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Invitation not found or no longer pending } /organizations/{id}/invitations/{invID}/resend: post: tags: [Organizations] summary: Resend an invitation description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Rotates the token (the previous link stops working), resets the expiry to 7 days from now and emails the new link. Expired, revoked and accepted invitations cannot be resent (create a new one). Only an owner may resend an invitation to the `owner` role (it hands out a fresh link): anyone else gets 403 `{"error", "code": "owner_required"}`. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: invID, in: path, required: true, schema: { type: string, format: uuid } } responses: '400': { $ref: '#/components/responses/BadRequest' } '200': description: Invitation re-sent content: application/json: schema: { $ref: '#/components/schemas/OrgInvitationSent' } '403': { description: 'Not an org admin, or `{"error", "code": "owner_required"}` for a non-owner resending an owner invitation' } '404': { description: Invitation not found } '409': { description: Invitation is no longer pending } /invitations/accept-existing: post: tags: [Organizations] summary: Accept an invitation while signed in description: | Any signed-in user. Spends an invitation token for the caller's existing account and adds a membership in the inviting organization. Only a user's own session token qualifies (API tokens and sandbox tokens get 403), and the invitation's email must match the caller's. The active organization does not change (switch organizations to use the new one) unless the account had no active organization left. If the caller is already a member, the existing role is kept and `already_member` is true. New accounts accept through the public `/auth` invitation flow instead. Into an organization that requires MFA, a session that has not proved TOTP is answered 403 `{"error", "code": "mfa_required" | "mfa_setup_required", "mfa_token"}` BEFORE the invitation is spent: `mfa_required` when the account has TOTP, `mfa_setup_required` when it has none. Complete POST /auth/mfa/verify (or /auth/mfa/setup then /auth/mfa/enable) with that `mfa_token`; it returns new session tokens in the caller's current organization with the factor recorded, and the same accept call then succeeds. requestBody: required: true content: application/json: schema: type: object required: [token] properties: token: { type: string, description: Token from the emailed accept link } responses: '200': description: Membership added content: application/json: schema: type: object properties: organization_id: { type: string, format: uuid } organization_name: { type: string } role: { type: string, enum: [owner, admin, member, viewer] } already_member: { type: boolean } '400': { description: "Missing token, or invalid or expired invitation token" } '403': { description: "Not a user session token, the invitation was issued to a different email address, or the organization requires MFA this session has not proved (`code` mfa_required | mfa_setup_required, with `mfa_token`; the invitation is not spent)" } /organizations/{id}/groups/{groupID}/projects: get: tags: [Organizations] summary: List projects shared with a group description: | Org admin only (owner or admin), reads included: the list would otherwise reveal private project names. `{id}` must be the caller's active organization. The same share rows as `GET /projects/{id}/shares`, addressed from the group side, ordered by project name; deleted projects are omitted. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: groupID, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: Shared projects content: application/json: schema: type: object properties: projects: type: array items: { $ref: '#/components/schemas/GroupProjectShare' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Group not found in this organization } post: tags: [Organizations] summary: Share a project with a group description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Every group member gets the share's role on the project. The project must belong to the same organization and not be deleted. Idempotent: sharing an already-shared project updates its role. Sandbox tokens cannot change shares (403). Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: groupID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [project_id, role] properties: project_id: { type: string, format: uuid } role: { type: string, enum: [viewer, editor] } responses: '201': description: Shared content: application/json: schema: type: object properties: status: { type: string, enum: [added] } role: { type: string, enum: [viewer, editor] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Group, or project, not found in this organization" } /organizations/{id}/groups/{groupID}/projects/{projectID}: delete: tags: [Organizations] summary: Stop sharing a project with a group description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Group members lose the access this share granted. Sandbox tokens cannot change shares (403). parameters: - { $ref: '#/components/parameters/OrgId' } - { name: groupID, in: path, required: true, schema: { type: string, format: uuid } } - { name: projectID, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Removed } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Group or project share not found } patch: tags: [Organizations] summary: Change a group's role on a project description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sandbox tokens cannot change shares (403). parameters: - { $ref: '#/components/parameters/OrgId' } - { name: groupID, in: path, required: true, schema: { type: string, format: uuid } } - { name: projectID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [role] properties: role: { type: string, enum: [viewer, editor] } responses: '200': description: Updated content: application/json: schema: type: object properties: status: { type: string, enum: [updated] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Group or project share not found } /organizations/{id}/usage/summary: get: tags: [Organizations] summary: Get the organization usage console summary description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. The organization's token/cost totals for the window, its all-time counters, and breakdowns by user, project and model, each sorted by cost. Reads the durable daily rollups plus the calls not rolled up yet, so numbers survive the raw call-log prune. Calls without a project appear as "No project". parameters: - { $ref: '#/components/parameters/OrgId' } - { name: window, in: query, schema: { type: string, enum: [mtd, 30d, all], default: mtd } } responses: '200': description: Usage summary content: application/json: schema: type: object properties: window: { type: string, enum: [mtd, 30d, all] } totals: { $ref: '#/components/schemas/UsageTotals' } all_time: { $ref: '#/components/schemas/UsageTotals' } by_user: type: array items: allOf: - $ref: '#/components/schemas/UsageTotals' - type: object properties: user_id: { type: string, format: uuid } name: { type: string } email: { type: string } by_project: type: array items: allOf: - $ref: '#/components/schemas/UsageTotals' - type: object properties: project_id: { type: string, description: The all-zero UUID marks calls without a project } name: { type: string } by_model: type: array items: allOf: - $ref: '#/components/schemas/UsageTotals' - type: object properties: provider: { type: string } model: { type: string } '400': { description: window must be one of mtd|30d|all } '403': { $ref: '#/components/responses/Forbidden' } /organizations/{id}/usage/series: get: tags: [Organizations] summary: Get the organization daily usage series description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Daily tokens, cost and calls over the last `days` days. Without `group_by` every day is present (zero-filled); with it, one row per day and group that has usage, where `key` is the ID (`provider/model` for models) and `label` the display value (user email, project name, or the model key). parameters: - { $ref: '#/components/parameters/OrgId' } - { name: days, in: query, schema: { type: integer, minimum: 1, default: 30 }, description: Values above 365 are clamped } - { name: group_by, in: query, schema: { type: string, enum: [model, user, project] } } responses: '200': description: Series content: application/json: schema: { $ref: '#/components/schemas/UsageSeries' } '400': { description: "days is not a positive integer, or an invalid group_by" } '403': { $ref: '#/components/responses/Forbidden' } /organizations/{id}/usage/export: get: tags: [Organizations] summary: Export the organization's usage as CSV description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Streams the windowed daily usage of this organization as a CSV attachment (`usage--.csv`) with columns day, organization, user_email, project, provider, model, session_type, input_tokens, output_tokens, cached_input_tokens, cache_creation_input_tokens, cost_usd, call_count. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: window, in: query, schema: { type: string, enum: [mtd, 30d, all], default: mtd } } responses: '200': description: CSV download content: text/csv: schema: { type: string } '400': { description: window must be one of mtd|30d|all } '403': { $ref: '#/components/responses/Forbidden' } /organizations/{id}/providers: get: tags: [LLM Providers] summary: List the organization's LLM providers description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Each organization has its own provider rows, catalog and routing (since 2026-09-21). Keys are never returned: `api_key_set` and `key_source` report whether and where one resolves. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Providers, ordered by name content: application/json: schema: type: object properties: providers: type: array items: { $ref: '#/components/schemas/ProviderConfig' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [LLM Providers] summary: Register a custom LLM provider description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Creates a custom (non-builtin) provider for this organization: the API key goes to the organization's own secret path, the client is loaded live, and a catalog sync for the organization starts in the background. The name must be a lowercase slug (2-32 chars of `[a-z0-9_-]`, starting alphanumeric). Local or private `api_base` addresses (Ollama, vLLM, llama.cpp, LM Studio) need an enterprise license (403, `code` = `local_llm_requires_enterprise`). parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [name, protocol, api_base] properties: name: { type: string, description: Lowercase provider slug } display_name: { type: string, description: Defaults to the slug } protocol: { type: string, enum: [openai, anthropic] } api_base: { type: string, description: Trailing slashes are trimmed } api_key: { type: string } extra_headers: type: object additionalProperties: { type: string } responses: '201': description: Created content: application/json: schema: type: object properties: provider: { type: string } name: { type: string } display_name: { type: string } enabled: { type: boolean } protocol: { type: string, enum: [openai, anthropic] } api_base: { type: string } extra_headers: type: object additionalProperties: { type: string } is_builtin: { type: boolean, enum: [false] } api_key_set: { type: boolean } health_status: { type: string, enum: [unknown] } '400': { $ref: '#/components/responses/BadRequest' } '403': description: Not an org admin, organization mismatch, or a local endpoint without the enterprise license content: application/json: schema: { $ref: '#/components/schemas/ProviderLocalLLMError' } '409': { description: Provider already exists } /organizations/{id}/providers/health: get: tags: [LLM Providers] summary: Check the health of all providers description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Probes every provider loaded for the organization (15 s timeout each) and stores the result as its `health_status`. Pass `name` to probe a single provider. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: query, description: Probe only this provider, schema: { type: string } } responses: '200': description: Probe results content: application/json: schema: { $ref: '#/components/schemas/ProviderHealthResults' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Model router unavailable } /organizations/{id}/providers/test: post: tags: [LLM Providers] summary: Probe an unsaved provider configuration description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Verifies base URL, key and headers before saving (15 s timeout). The `openai` protocol lists `{api_base}/models` and reports the count; `anthropic` sends a minimal messages call. A failed probe is still a 200 with `status` = `failed`. Local or private addresses need the enterprise license (403). parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [protocol, api_base] properties: protocol: { type: string, enum: [openai, anthropic] } api_base: { type: string } api_key: { type: string } extra_headers: type: object additionalProperties: { type: string } responses: '200': description: Probe result content: application/json: schema: type: object properties: status: { type: string, enum: [success, failed] } model_count: { type: integer, description: openai protocol only; 0 otherwise } latency_ms: { type: integer, format: int64 } message: { type: string, description: Error detail when status=failed } '400': { $ref: '#/components/responses/BadRequest' } '403': description: Not an org admin, organization mismatch, or a local endpoint without the enterprise license content: application/json: schema: { $ref: '#/components/schemas/ProviderLocalLLMError' } /organizations/{id}/providers/{name}/health: get: tags: [LLM Providers] summary: Check a provider's health description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Probes one provider (15 s timeout) and stores the result as its `health_status`. GET and POST behave identically. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { type: string } } responses: '200': description: Probe result (one entry) content: application/json: schema: { $ref: '#/components/schemas/ProviderHealthResults' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Model router unavailable } post: tags: [LLM Providers] summary: Trigger a provider health check description: Org admin only (owner or admin). Same as the GET variant. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { type: string } } responses: '200': description: Probe result (one entry) content: application/json: schema: { $ref: '#/components/schemas/ProviderHealthResults' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Model router unavailable } /organizations/{id}/providers/{name}/models/import: post: tags: [LLM Providers] summary: Import models from an openai-protocol provider description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Lists the provider's `/models` endpoint (30 s timeout) and upserts every model into the organization's catalog (enabled, source `import`, context window 8192 until corrected). Re-runs only refresh availability, so edits to display name, context, vision and enablement survive. Requires an `openai`-protocol provider with an `api_base`. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { type: string } } responses: '200': description: Import result content: application/json: schema: type: object properties: imported: { type: integer } '400': { description: "Not an openai-protocol provider, or no api_base configured" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown provider in this organization } '502': description: Provider /models listing failed content: application/json: schema: type: object properties: error: { type: string } detail: { type: string } /organizations/{id}/providers/{name}/models: post: tags: [LLM Providers] summary: Add or override a model under a provider description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Registers (or overrides) a model in the organization's catalog as enabled, source `manual`, optionally with manual pricing that later syncs never overwrite. Pricing is a pair: both `input_usd_per_m` and `output_usd_per_m`, or neither. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object required: [model_id] properties: model_id: { type: string } display_name: { type: string, description: Defaults to model_id } max_context_tokens: { type: integer, description: Defaults to 8192 when omitted or not positive } supports_vision: { type: boolean } supports_tools: { type: boolean, default: true, description: false routes the model through the emulated tool protocol } input_usd_per_m: { type: number, nullable: true } output_usd_per_m: { type: number, nullable: true } cache_read_usd_per_m: { type: number, nullable: true } cache_write_usd_per_m: { type: number, nullable: true } responses: '201': description: Added content: application/json: schema: type: object properties: provider: { type: string } model_id: { type: string } display_name: { type: string } max_context_tokens: { type: integer } supports_vision: { type: boolean } supports_tools: { type: boolean } enabled: { type: boolean } source: { type: string, enum: [manual] } price_set: { type: boolean } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown provider in this organization } /organizations/{id}/providers/{name}: delete: tags: [LLM Providers] summary: Delete a custom provider description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Removes a custom provider with its catalog rows, prices and stored key, and clears fallback routes that pointed at it. Builtins cannot be deleted (disable them instead), and a provider still used as a primary route must be unrouted first (both 409). parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { type: string } } responses: '204': { description: Deleted } '400': { description: Invalid provider name } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: "Builtin provider, or still a primary model-routing target" } patch: tags: [LLM Providers] summary: Update a provider description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Partial update; at least one field is required. A new `api_key` is stored on the organization's own secret path (on a deployment without Vault, on the provider row instead: `key_source` `db`) and resets `health_status` to `unknown`; a Vault write failure answers 500 and stores nothing. `protocol` can only change on custom providers (builtins keep their native client). `extra_headers` replaces the stored headers; an empty object clears them. The builtin `local` provider and local or private `api_base` addresses need the enterprise license (403). The provider is reloaded live. A new `api_base` on a provider for which a key resolves (the organization's own, the instance's legacy key, or the row's) must come with `api_key`; otherwise 400 and nothing changes. A base that differs only in surrounding spaces, the case of its scheme or host, or a trailing slash is the same base. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object properties: enabled: { type: boolean } display_name: { type: string } api_base: { type: string } api_key: { type: string, description: Write-only } protocol: { type: string, enum: [openai, anthropic] } extra_headers: type: object additionalProperties: { type: string } responses: '404': { description: The organization has no provider by that name } '200': description: Updated content: application/json: schema: type: object properties: status: { type: string, enum: [updated] } '400': { description: "No fields to update, invalid protocol, protocol change on a builtin, an api_key/protocol for a provider the organization does not have, or a new api_base without api_key while a key resolves for the provider" } '403': description: Not an org admin, organization mismatch, or a local endpoint without the enterprise license content: application/json: schema: { $ref: '#/components/schemas/ProviderLocalLLMError' } '503': { description: "The provider's stored base or key could not be read; nothing changed" } /organizations/{id}/models: get: tags: [LLM Providers] summary: List the model catalog description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Paginated, filterable view of the organization's model catalog, ordered by provider and model ID, each row priced through the same resolver billing uses. Out-of-range `limit`/`offset` values fall back to the defaults; unparseable boolean filters are ignored. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 200, default: 50 } } - { name: offset, in: query, schema: { type: integer, minimum: 0, default: 0 } } - { name: provider, in: query, schema: { type: string } } - { name: q, in: query, description: Case-insensitive substring match on model_id or display_name, schema: { type: string } } - { name: enabled, in: query, schema: { type: boolean } } - { name: vision, in: query, schema: { type: boolean } } - { name: tools, in: query, description: Filter on native tool support, schema: { type: boolean } } - { name: available, in: query, schema: { type: boolean } } - { name: source, in: query, description: "Catalog row origin, e.g. manual, import or a sync source", schema: { type: string } } responses: '200': description: Catalog page content: application/json: schema: type: object properties: models: type: array items: { $ref: '#/components/schemas/ModelCatalogEntry' } total: { type: integer, description: Total rows matching the filters } limit: { type: integer } offset: { type: integer } '403': { $ref: '#/components/responses/Forbidden' } patch: tags: [LLM Providers] summary: Batch-toggle models description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Sets `enabled` (and optionally `supports_tools`) per model. Updates ride in the body because model IDs can contain slashes. At most 500 updates per request; entries without provider or model_id, and rows that do not exist, are skipped. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [updates] properties: updates: type: array minItems: 1 maxItems: 500 items: type: object required: [provider, model_id, enabled] properties: provider: { type: string } model_id: { type: string } enabled: { type: boolean } supports_tools: { type: boolean, description: Optional; false routes the model through the emulated tool protocol } responses: '200': description: Update count content: application/json: schema: type: object properties: updated: { type: integer, format: int64 } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } /organizations/{id}/model-sync/status: get: tags: [LLM Providers] summary: Get model catalog sync status description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. The sync sources (openrouter, modelsdev) run instance-wide; this reports their state for this organization. Triggering a run is instance-admin only (`POST /admin/model-sync/trigger`). parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Sync sources content: application/json: schema: type: object properties: sources: type: array items: { $ref: '#/components/schemas/ModelSyncSourceStatus' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Catalog sync is not configured } /organizations/{id}/provider-registry: get: tags: [LLM Providers] summary: List the models.dev provider registry description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. The instance-wide models.dev provider mirror (refreshed by the catalog sync), with `configured`/`builtin` computed against this organization's providers; it powers typesearch in the add-provider flow. Empty until the first modelsdev sync, and always empty on air-gapped deployments. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Registry providers, ordered by display name content: application/json: schema: type: object properties: providers: type: array items: { $ref: '#/components/schemas/ProviderRegistryEntry' } '403': { $ref: '#/components/responses/Forbidden' } /organizations/{id}/routing: get: tags: [LLM Providers] summary: Get the model routing table description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. The effective routing for every known session type, with inheritance resolved: `configured` marks rows the organization saved, and `inherited_from` names the coarse session type an unsaved fine-grained row mirrors. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Routing table, ordered by session type content: application/json: schema: type: object properties: routings: type: array items: { $ref: '#/components/schemas/ModelRouting' } '403': { $ref: '#/components/responses/Forbidden' } patch: tags: [LLM Providers] summary: Set the routing for a session type description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Upserts one session type's primary and optional fallback model and applies it live. Both models must be enabled in the organization's catalog; the `vision` session type needs vision-capable models; the fallback must differ from the primary and its provider and model are set together (send null or empty strings to clear them). Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [session_type, primary_provider, primary_model_id] properties: session_type: { type: string } primary_provider: { type: string } primary_model_id: { type: string } fallback_provider: { type: string, nullable: true } fallback_model_id: { type: string, nullable: true } responses: '200': description: Saved and applied content: application/json: schema: type: object properties: status: { type: string, enum: [routing_updated] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: "Saved but not applied in memory (retry), or the save failed" } /organizations/{id}/routing/reload: post: tags: [LLM Providers] summary: Reload routing and catalog from the database description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Forces an immediate reload of the in-memory model catalog and routing (normally refreshed in the background). The reload is instance-wide; `routes` counts the caller's organization's effective routing entries. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Reloaded content: application/json: schema: type: object properties: reloaded: { type: boolean, enum: [true] } routes: { type: integer } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Model router is not configured } /organizations/{id}/connectors/github/start: post: tags: [Connectors] summary: Start GitHub device-flow connect description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Requests a GitHub device code (scopes `repo,read:user`) for the OAuth App configured with `GITHUB_OAUTH_CLIENT_ID`. Show `user_code` and `verification_uri` to the user, then poll `/connectors/github/poll` every `interval` seconds. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Device code content: application/json: schema: type: object properties: device_code: { type: string } user_code: { type: string } verification_uri: { type: string } expires_in: { type: integer } interval: { type: integer, description: Seconds between polls (defaults to 5) } '403': { $ref: '#/components/responses/Forbidden' } '502': { description: GitHub request failed or returned an unusable response } '503': { description: GITHUB_OAUTH_CLIENT_ID is not configured } /organizations/{id}/connectors/github/poll: post: tags: [Connectors] summary: Poll GitHub device-flow connect description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Exchanges the device code for an access token. While the user has not finished authorizing, answers 202 with `pending: true`; on success stores the token for this organization, replacing only its own previous token, and answers 200 with the GitHub login. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [device_code] properties: device_code: { type: string } responses: '200': description: Connected content: application/json: schema: type: object properties: connected: { type: boolean, enum: [true] } pending: { type: boolean, enum: [false] } account_login: { type: string } scopes: { type: string } '202': description: Still waiting for the user content: application/json: schema: type: object properties: connected: { type: boolean, enum: [false] } pending: { type: boolean, enum: [true] } reason: { type: string, enum: [authorization_pending, slow_down] } '400': description: Missing device_code, or GitHub refused the grant (expired_token, access_denied, ...) content: application/json: schema: type: object properties: connected: { type: boolean } pending: { type: boolean } error: { type: string } error_description: { type: string } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: Storing the token failed } '502': { description: GitHub request failed or returned an unusable response } '503': { description: GITHUB_OAUTH_CLIENT_ID is not configured } /organizations/{id}/connectors/github/status: get: tags: [Connectors] summary: Get GitHub device-flow connection status description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Reports this organization's stored GitHub OAuth token (never the token itself; another organization's connection never shows here) and whether the device flow is available. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Status (only `connected` when no token row exists) content: application/json: schema: type: object properties: connected: { type: boolean } account_login: { type: string } scopes: { type: string } connected_at: { type: string, format: date-time } oauth_configured: { type: boolean, description: GITHUB_OAUTH_CLIENT_ID is set } '403': { $ref: '#/components/responses/Forbidden' } /organizations/{id}/connectors/github/disconnect: post: tags: [Connectors] summary: Disconnect the GitHub OAuth token description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Deletes this organization's stored device-flow token; other organizations' tokens are untouched. Does not touch a connected GitHub App (see `/connectors/github/app/disconnect`). parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Disconnected content: application/json: schema: type: object properties: connected: { type: boolean, enum: [false] } '403': { $ref: '#/components/responses/Forbidden' } /organizations/{id}/connectors/github/app/manifest: post: tags: [Connectors] summary: Start one-click GitHub App connect description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Builds a GitHub App manifest plus a signed state (valid 15 minutes, bound to this organization) and returns the github.com URL the browser must POST the manifest to. GitHub then redirects to the public `/api/v1/connectors/github/app/created` and `/installed` receivers, which store the App credentials in this organization's GitHub connector. The App's webhook points at `/api/v1/webhooks/github/{organization id}`. Requires `CRIOS_PUBLIC_BASE_URL` and a server signing key. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: false content: application/json: schema: type: object properties: org: { type: string, description: GitHub organization to create the App under (default is the user's account) } responses: '200': description: Manifest and target URL content: application/json: schema: type: object properties: post_url: { type: string, description: github.com URL to POST the manifest to (state included) } manifest: type: object additionalProperties: true description: GitHub App manifest (name, url, redirect_url, setup_url, hook_attributes, default_permissions, default_events) state: { type: string, description: Signed connect-flow state } '403': { $ref: '#/components/responses/Forbidden' } '500': description: Failed to sign connect state content: application/json: schema: { $ref: '#/components/schemas/Error' } '503': { description: CRIOS_PUBLIC_BASE_URL or the server signing key is not configured } /organizations/{id}/connectors/github/app/install: post: tags: [Connectors] summary: Finish the install of the organization's GitHub App description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Resumes the install stage of the App one-click connect created but nobody installed (the install page was closed, or an owner of the GitHub account has not approved a request yet): returns the App's installation page on github.com with a new signed state naming the App, and sets the connect cookie that state is bound to, for a full-page navigation. GitHub then redirects to the public `/api/v1/connectors/github/app/installed` receiver as in a connect. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: The App's installation page content: application/json: schema: type: object properties: install_url: { type: string, description: 'https://github.com/apps//installations/new?state=…' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: "No App of this organization is waiting for its install: none saved, already installed, or not created by one-click connect (no bot login ending in [bot])" } '500': description: Failed to sign connect state content: application/json: schema: { $ref: '#/components/schemas/Error' } '503': { description: "Connector settings are not available, or CRIOS_PUBLIC_BASE_URL or the server signing key is not configured" } /organizations/{id}/connectors/github/app/disconnect: post: tags: [Connectors] summary: Disconnect the GitHub App description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Best-effort uninstall of the organization's App on github.com, then always clears the stored App credentials (app ID, installation ID, private key, webhook secret, bot login), even when the GitHub call fails, so stale credentials cannot keep minting tokens. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Disconnected content: application/json: schema: type: object properties: disconnected: { type: boolean, enum: [true] } github_uninstalled: { type: boolean, description: Whether the GitHub-side uninstall succeeded } github_error: { type: string, description: Present when the GitHub-side uninstall failed or was skipped } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: No GitHub App is connected } '500': { description: Clearing the stored credentials failed } '503': { description: Connector settings are not available } /organizations/{id}/authenticators: get: tags: [Authenticator] summary: List authenticator keys description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Metadata of the organization's TOTP keys: name, issuer, logo, algorithm, digits and period. The setup key and its Vault path are never included. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Authenticator keys content: application/json: schema: type: object required: [authenticators] properties: authenticators: type: array items: { $ref: '#/components/schemas/OrgAuthenticator' } '400': { description: The caller's organization is missing } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The list could not be read } post: tags: [Authenticator] summary: Import an authenticator key description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Imports a TOTP setup key (base32, or an `otpauth://totp/` link) with a name and an optional https logo. A blank name or issuer is filled from the link's label. The seed is written to Vault and is not returned. At most 200 keys per organization. HOTP links are refused, and a code window outside 1–3600 seconds is refused before anything is stored. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [key] properties: name: { type: string, description: Display name. Filled from an otpauth label when blank. } issuer: { type: string, description: Service name. Filled from an otpauth issuer when blank. } logo_url: { type: string, description: Optional https URL of a logo. Stored as metadata and never fetched. } key: { type: string, description: Base32 setup key or an otpauth://totp/ URI. Write-only. } responses: '201': description: The saved key, without the seed content: application/json: schema: { $ref: '#/components/schemas/OrgAuthenticator' } '400': { description: The key, name, issuer or logo is not acceptable, or the organization already has 200 keys } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: The key could not be saved } '503': { description: The vault is unavailable } /organizations/{id}/authenticators/{authenticatorID}: patch: tags: [Authenticator] summary: Rename an authenticator key description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Changes the name, issuer and logo. The setup key stays as it was; replacing it means deleting the entry and importing it again. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: authenticatorID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [name, issuer, logo_url] properties: name: { type: string } issuer: { type: string } logo_url: { type: string } responses: '200': description: The updated key, without the seed content: application/json: schema: { $ref: '#/components/schemas/OrgAuthenticator' } '400': { description: The name, issuer or logo is not acceptable } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No such authenticator key } '500': { description: The key could not be updated } delete: tags: [Authenticator] summary: Delete an authenticator key description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Removes the Vault document first, then the row. If the vault cannot be reached the row is kept so a later delete can still remove the seed. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: authenticatorID, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Deleted } '400': { description: The caller's organization is missing } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No such authenticator key } '500': { description: The row could not be deleted } '503': { description: The vault is unavailable; the key was kept } /organizations/{id}/authenticators/{authenticatorID}/code: get: tags: [Authenticator] summary: Current authenticator code description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Computes the current TOTP code from the server's Unix clock and the Vault seed, and returns how long that code stays valid. The seed is not included. This read is not written to the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: authenticatorID, in: path, required: true, schema: { type: string, format: uuid } } responses: '200': description: The current code and when it expires content: application/json: schema: { $ref: '#/components/schemas/OrgAuthenticatorCode' } '400': { description: The caller's organization is missing } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No such authenticator key } '500': { description: The code could not be produced } '503': { description: The vault is unavailable or no longer holds the seed } /organizations/{id}/connectors: get: tags: [Connectors] summary: List connector statuses description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Status of every org-configurable connector: jira, github, slack, gitlab, the OAuth apps behind the user-integrations hub (google, x, instagram, tiktok, facebook, discord) and the telegram bot. Each organization has its own settings; only the oldest (legacy) organization also falls back to the pre-multi-org instance secrets and environment variables. Secret fields return a masked preview, never the stored value. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Connector statuses content: application/json: schema: type: object properties: connectors: type: array items: { $ref: '#/components/schemas/ConnectorStatus' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Connector configuration is unavailable } /organizations/{id}/connectors/{name}: put: tags: [Connectors] summary: Update connector settings description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Partial save as a flat JSON object of field values: present keys overwrite, an empty string clears, omitted keys keep their value. A saved secret stays with the fields it is bound to (`bound_secrets`): a save that changes Jira's host or email, or GitLab's base URL, without supplying the token again clears the saved token. Values are stored in the organization's secret store (a write that lost a race with another replica's is retried on the newer document) and take effect on every replica without a restart. The audit log records the changed field names only. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { $ref: '#/components/schemas/OrgConnectorName' } } requestBody: required: true content: application/json: schema: type: object minProperties: 1 additionalProperties: { type: string } description: Flat map of connector field key to value (keys as listed in the connector's `fields`) responses: '200': description: Updated connector status content: application/json: schema: { $ref: '#/components/schemas/ConnectorStatus' } '400': { description: "Invalid body, no fields, or a field the connector does not have" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown connector } '503': { description: The secret store is not available } delete: tags: [Connectors] summary: Reset connector settings description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Deletes the organization's settings document for the connector. The legacy organization falls back to the instance secrets and environment variables (`env_fallback`); every other organization is left unconfigured, or on the deployment's shared OAuth app where it offers one. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { $ref: '#/components/schemas/OrgConnectorName' } } responses: '200': description: Post-reset connector status content: application/json: schema: { $ref: '#/components/schemas/ConnectorStatus' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown connector } '503': { description: The secret store is not available } /organizations/{id}/connectors/{name}/test: post: tags: [Connectors] summary: Test a connector's live connection description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Runs a live check of the saved settings with a 10 s timeout (jira, slack, gitlab, github, telegram; telegram also fails while the bot has a webhook, naming only its host). For google and discord it asks the provider's token endpoint to exchange a made-up authorization code, which tells a client it knows from one it does not (`invalid_client`); for x, instagram, facebook and tiktok it only checks that client ID and secret are both present, since those can only be proven by a member's consent (`check` says which). A test whose unsaved values move a bound secret's host or account without the secret is refused rather than sending the saved secret there. An optional body of unsaved values, shaped like the update body, is laid over the saved settings for this one check, so credentials can be tried before they are saved: present keys override, an empty string clears, omitted keys keep their saved value. Those values are never stored, and the audit log records their field names only. Always 200 once the check ran: a failed check is a result, not an HTTP error. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: name, in: path, required: true, schema: { $ref: '#/components/schemas/OrgConnectorName' } } requestBody: required: false content: application/json: schema: type: object additionalProperties: { type: string } description: Flat map of connector field key to an unsaved value (keys as listed in the connector's `fields`) responses: '200': description: Test result content: application/json: schema: { $ref: '#/components/schemas/ConnectorTestResult' } '400': { description: "Invalid body, or a field the connector does not have" } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown connector } /organizations/{id}/integrations/jira/mappings: get: tags: [Connectors] summary: List Jira board mappings description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Jira board-to-project mappings for the organization's projects, each with its `jira_project_key`. Optional fields are omitted when unset. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Mappings content: application/json: schema: type: object properties: mappings: type: array items: { $ref: '#/components/schemas/JiraMapping' } '403': { $ref: '#/components/responses/Forbidden' } post: tags: [Connectors] summary: Create a Jira board mapping description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Maps a Jira project/board to a Crios project of this organization. `jira_project_key` is stored trimmed and upper-case, as Jira writes it in issue keys, so `eng` maps `ENG-12`. Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [project_id, jira_project_key] properties: project_id: { type: string, format: uuid } jira_project_key: { type: string } board_id: { type: integer } sprint_id: { type: integer } acceptedIssueTypes: { type: array, items: { type: string } } labelFilter: { type: string } priorityMapping: { type: object, additionalProperties: { type: string } } transitionMapping: { type: object, additionalProperties: { type: string } } responses: '201': description: Created content: application/json: schema: type: object properties: id: { type: string, format: uuid } '400': { description: 'Invalid body, invalid project_id, or missing jira_project_key' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Project not found in this organization } '409': { description: The project already maps this Jira project key } /organizations/{id}/integrations/jira/mappings/{mappingID}: delete: tags: [Connectors] summary: Delete a Jira board mapping description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Deletes the mapping if it belongs to one of the organization's projects. Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: mappingID, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Deleted } '400': { description: The mapping id is not a UUID } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: No mapping with that id belongs to this organization } /organizations/{id}/integrations/hub/overview: get: tags: [Connectors] summary: Get the integrations hub overview description: | Org admin only (owner or admin). `{id}` must be the caller's active organization. Organization-wide read of the user-integrations hub: per-integration account counts and every hub Jira project mapping. Counts and display fields only; account rows, tokens and scopes stay on the member endpoints. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Overview content: application/json: schema: type: object properties: providers: type: array items: { $ref: '#/components/schemas/IntegrationsHubProviderStats' } jira_mappings: type: array items: { $ref: '#/components/schemas/IntegrationsHubJiraMapping' } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Database is unavailable } /admin/org-settings/license-acceptances/{component}: put: tags: [Admin] summary: Accept a third-party license (deprecated) deprecated: true description: | Deprecated alias of PUT /organizations/{id}/license-acceptances/{component}, kept for one release. Instance admin only, and only for the caller's own active organization. Records (or refreshes) that organization's acceptance of a component's license terms. Recorded in the audit log. parameters: - { name: component, in: path, required: true, schema: { type: string, enum: [android-sdk] } } requestBody: required: true content: application/json: schema: type: object required: [terms_version] properties: terms_version: { type: string, description: Version of the terms being accepted } responses: '200': description: Acceptance recorded content: application/json: schema: { $ref: '#/components/schemas/LicenseAcceptance' } '400': { description: "Unknown component, invalid body, or missing terms_version" } '403': { $ref: '#/components/responses/Forbidden' } delete: tags: [Admin] summary: Revoke a third-party license acceptance (deprecated) deprecated: true description: Deprecated alias of DELETE /organizations/{id}/license-acceptances/{component}, kept for one release. Instance admin only; removes the caller's active organization's acceptance. Recorded in the audit log. parameters: - { name: component, in: path, required: true, schema: { type: string, enum: [android-sdk] } } responses: '204': { description: Revoked } '400': { description: Unknown component } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: License acceptance not found } /admin/mcp-clients/{service}: get: tags: [MCP] summary: Get a pre-registered MCP OAuth client description: | Instance admin only, like the rest of `/admin`: the stored client is deployment-wide, and every organization's MCP connections sign in through it. API and sandbox tokens never reach it. Pre-registered OAuth clients are the connect path for catalog MCP services whose authorization server has no dynamic client registration (for example `gmail_mcp`, `github_mcp`). The secret is never returned. The same Vault documents are managed through `/workflows/connectors/oauth-clients/{service}`. parameters: - { name: service, in: path, required: true, description: MCP connector catalog service ID (case-insensitive), schema: { type: string } } responses: '200': description: Client content: application/json: schema: { $ref: '#/components/schemas/MCPClient' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown or disabled MCP connector } '503': { description: Secret storage or the MCP connector catalog is unavailable } put: tags: [MCP] summary: Save a pre-registered MCP OAuth client description: | Instance admin only; the stored client is deployment-wide. An empty or omitted `client_secret` keeps the stored secret (public clients never set one). parameters: - { name: service, in: path, required: true, description: MCP connector catalog service ID (case-insensitive), schema: { type: string } } requestBody: required: true content: application/json: schema: type: object required: [client_id] properties: client_id: { type: string } client_secret: { type: string, description: Write-only } responses: '200': description: Saved content: application/json: schema: { $ref: '#/components/schemas/MCPClient' } '400': { description: client_id is required } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown or disabled MCP connector } '503': { description: Secret storage or the MCP connector catalog is unavailable } delete: tags: [MCP] summary: Delete a pre-registered MCP OAuth client description: Instance admin only; the stored client is deployment-wide. parameters: - { name: service, in: path, required: true, description: MCP connector catalog service ID (case-insensitive), schema: { type: string } } responses: '204': { description: Deleted } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Unknown or disabled MCP connector } '503': { description: Secret storage or the MCP connector catalog is unavailable } /admin/secrets/cas/default: get: tags: [Admin] summary: Get the default certificate authority (deprecated) deprecated: true description: | Deprecated alias of GET /organizations/{id}/ca-default, kept for one release. Instance admin only, for the caller's own active organization. responses: '200': description: Default CA content: application/json: schema: { $ref: '#/components/schemas/OrgCADefault' } '403': { $ref: '#/components/responses/Forbidden' } put: tags: [Admin] summary: Set the default certificate authority (deprecated) deprecated: true description: | Deprecated alias of PUT /organizations/{id}/ca-default, kept for one release. Instance admin only, for the caller's own active organization. Recorded in the audit log. requestBody: required: true content: application/json: schema: type: object required: [provider] properties: provider: { type: string, enum: [letsencrypt, zerossl, google] } responses: '200': description: Saved content: application/json: schema: type: object properties: default_provider: { type: string, enum: [letsencrypt, zerossl, google] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '409': { description: That CA's EAB credentials are not configured } '503': { description: Vault is not configured } /admin/secrets/cas/{name}: get: tags: [Admin] summary: Get a certificate authority's EAB status description: | Instance admin only. Whether External Account Binding credentials are stored for the CA (deployment-wide). Returns the email and key ID, never the HMAC key; an unconfigured CA returns only `name` and `configured: false`. parameters: - { name: name, in: path, required: true, schema: { type: string, enum: [zerossl, google-public-ca] } } responses: '200': description: CA status content: application/json: schema: { $ref: '#/components/schemas/CertificateAuthorityStatus' } '400': { description: Unknown certificate authority } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: Vault is not configured } put: tags: [Admin] summary: Save a certificate authority's EAB credentials description: | Instance admin only. Stores the CA's External Account Binding credentials (deployment-wide) and mirrors them into the cluster (EAB Secret and ClusterIssuer) so publications can request certificates from it. If the caller's active organization still defaults to Let's Encrypt (or has no default), this CA becomes its default. Recorded in the audit log. parameters: - { name: name, in: path, required: true, schema: { type: string, enum: [zerossl, google-public-ca] } } requestBody: required: true content: application/json: schema: type: object required: [email, key_id, hmac_key] properties: email: { type: string } key_id: { type: string, description: EAB key ID } hmac_key: { type: string, description: EAB HMAC key (write-only) } responses: '200': description: Saved content: application/json: schema: type: object properties: status: { type: string, enum: [ok] } cluster_synced: { type: boolean, description: False when no cluster mirror is wired (outside Kubernetes) } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '502': { description: Saved to Vault but the cluster sync failed } '503': { description: Vault is not configured } delete: tags: [Admin] summary: Delete a certificate authority's EAB credentials description: Instance admin only. Deletes the stored credentials and tears down the cluster mirror. Recorded in the audit log. parameters: - { name: name, in: path, required: true, schema: { type: string, enum: [zerossl, google-public-ca] } } responses: '204': { description: Deleted } '400': { description: Unknown certificate authority } '403': { $ref: '#/components/responses/Forbidden' } '502': { description: Deleted from Vault but the cluster teardown failed } '503': { description: Vault is not configured } /admin/users/{id}/instance-admin: put: tags: [Admin] summary: Grant or revoke instance admin description: | Instance admin only. Sets the user's deployment-wide instance-admin flag. You cannot revoke your own flag, and the last instance admin cannot be revoked. Setting the current value is a no-op. Recorded in the audit log. parameters: - { name: id, in: path, required: true, description: User ID, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [is_instance_admin] properties: is_instance_admin: { type: boolean } responses: '200': description: Updated, or no change content: application/json: schema: type: object properties: status: { type: string, enum: [updated, no changes] } is_instance_admin: { type: boolean } '400': { description: is_instance_admin (boolean) is required } '403': { description: "Not an instance admin, or revoking your own flag" } '404': { $ref: '#/components/responses/NotFound' } '409': { description: Cannot revoke the only instance admin } /admin/users/{id}/memberships: get: tags: [Admin] summary: List a user's organization memberships description: Instance admin only. Every organization the user belongs to, ordered by organization name. parameters: - { name: id, in: path, required: true, description: User ID, schema: { type: string, format: uuid } } responses: '200': description: Memberships content: application/json: schema: type: object properties: memberships: type: array items: { $ref: '#/components/schemas/AdminUserMembership' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /admin/organizations/{id}: patch: tags: [Admin] summary: Update an organization description: | Instance admin only. Renames the organization or changes its slug and limits. An omitted field is left unchanged; an explicit null clears a limit (the seat and sandbox caps to none, a budget to its default). Recorded in the audit log. `org_agents_scope` only sets the Team Playbook scope back to `opt_in`: `all` is the organization's own owners' and admins' to set (403 `scope_all_org_admins_only`, and nothing changes), and any other value is 400 `invalid_scope`. Turning the Team Playbook off (`features.org_agents: false`) sets it back to `opt_in` too, in the same transaction. When the scope changed, the change is audited (`org_agent.scope.set`). Either patch, sent again too, runs the privacy sweep, which disables every playbook that learned from a private session it may no longer read; `GET /admin/organizations` shows how many it has yet to disable (`pending_sweep_agents`). If the sweep fails, the answer is 503 `org_agents_unavailable`: the update stands, and sending the same patch again finishes the sweep. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: allOf: - $ref: '#/components/schemas/AdminOrgLimits' - type: object properties: name: { type: string, minLength: 1, maxLength: 255 } slug: { type: string, maxLength: 100, description: "Lowercase letters, digits and dashes" } org_agents_scope: { type: string, enum: [opt_in], description: 'Sets the Team Playbook scope back to opt_in (see the description)' } responses: '200': description: Updated content: application/json: schema: type: object properties: status: { type: string, enum: [updated] } org_agents_scope: type: object description: Present when the Team Playbook scope changed properties: scope: { type: string, enum: [opt_in] } set_at: { type: string, format: date-time } disabled_agents: { type: integer, description: 'Present whenever the privacy sweep ran, which a patch that sets org_agents_scope to opt_in or turns the Team Playbook off does (the same patch again included): the playbooks it disabled, 0 included' } narrowed_agents: { type: integer, description: 'Present whenever disabled_agents is: the playbooks the sweep kept on, on a version without what they learned from a session it may no longer read, 0 included' } '400': { description: 'Invalid body, or an org_agents_scope other than opt_in or all (`{"code": "invalid_scope"}`)' } '403': { description: 'Not an instance admin, or org_agents_scope all (`{"code": "scope_all_org_admins_only"}`)' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: An organization with this slug already exists } '503': { description: 'The update stands, but the privacy sweep after the scope went back to opt_in failed (`{"code": "org_agents_unavailable"}`); send the same patch again' } /admin/organizations/{id}/org-agents/sweep: post: tags: [Admin] summary: Run an organization's Team Playbook privacy sweep description: | Instance admin only. The Try again of the organization's card while `GET /admin/organizations` shows its `pending_sweep_agents`: runs the organization's privacy sweep, which takes out of every enabled playbook what was learned from a session the organization's Team Playbook may no longer read, or, where that can't be separated, disables the playbook and deletes its knowledge entries, with the Team Playbook on or off. It also deletes the cards of the sessions it may no longer read. It changes no setting, neither the flag nor the scope, so it never sets back a scope the organization's admins changed after the list was read. Each run is recorded in the audit log (`org_agent.sweep.retry`, with `instance_admin` and both counts), and each playbook it narrows or disables on its own row (`org_agent.auto.privacy_removal`, trigger `retry`). parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: The sweep ran content: application/json: schema: type: object properties: disabled_agents: { type: integer, minimum: 0, description: 'The playbooks it disabled, 0 when none. A playbook it kept on, on a version without the affected items, is counted in narrowed_agents instead' } narrowed_agents: { type: integer, minimum: 0, description: 'The playbooks it kept on, on a version without what they learned from a session it may no longer read, 0 when none' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: 'No such organization, or `{id}` is not a UUID (`{"error", "code": "organization_not_found"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '500': { description: 'Looking the organization up failed (`{"error": "internal server error", "code": "internal"}`)', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } '503': { description: 'The sweep failed, or this installation can''t run the Team Playbook (`{"error", "code": "org_agents_unavailable"}`); the playbooks it disabled so far stay disabled, and the list still counts the rest', content: { application/json: { schema: { $ref: '#/components/schemas/OrgAgentsError' } } } } /admin/org-agents: get: tags: [Admin] summary: List every organization's Team Playbook description: | Instance admin only. Every organization, suspended ones included, in the order of `GET /admin/organizations` (by name, then slug), with its Team Playbook state, and the default that the organizations an instance admin creates start with. The counts are counts, never who. They share one 2-second budget for the whole list: a count that fails, or that the budget doesn't reach, is null, never 0. responses: '200': description: Every organization's Team Playbook content: application/json: schema: type: object properties: new_orgs_default: { type: boolean, description: 'Whether an organization an instance admin creates starts with the Team Playbook on (PUT /admin/org-agents/default)' } orgs: type: array items: type: object properties: id: { type: string, format: uuid } name: { type: string } slug: { type: string } suspended_at: { type: string, format: date-time, nullable: true } 'on': { type: boolean, description: 'Whether its Team Playbook is on. Only a stored true is: no setting, or any other value, is off' } org_agents_scope: type: object description: What its Team Playbook learns from, and when that was set last. Never who set it. properties: scope: { type: string, enum: [opt_in, all] } set_at: { type: string, format: date-time, nullable: true, description: Null when never set } last_run_at: { type: string, format: date-time, nullable: true, description: 'When its latest run started, a running one included. Null when none ever ran' } opted_in_projects: { type: integer, minimum: 0, nullable: true, description: 'Its private projects, deleted ones aside, with at least one consent in effect. Null when the count fails or the budget runs out' } org_visible_projects: { type: integer, minimum: 0, nullable: true, description: 'Its projects shared with the organization, deleted ones aside. Null when the count fails or the budget runs out' } pending_sweep_agents: { type: integer, minimum: 0, nullable: true, description: 'How many enabled playbooks the privacy sweep would disable now; POST /admin/organizations/{id}/org-agents/sweep finishes it. Null when the count fails or the budget runs out' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: 'The list could not be read (`{"code": "org_agents_unavailable"}`)' } /admin/org-agents/default: put: tags: [Admin] summary: Set the Team Playbook default for new organizations description: | Instance admin only. Whether the organizations an instance admin creates from now on start with the Team Playbook on. It changes no organization that exists, and ships off. An organization made by a self-serve sign-up starts with the Team Playbook off whatever it says, and an imported one keeps the setting it had. Recorded in the audit log as `org_settings.org_agents_instance_update`, with the setting before and after, under the deployment's default organization. requestBody: required: true content: application/json: schema: type: object required: ['on'] properties: 'on': { type: boolean } responses: '200': description: Saved content: application/json: schema: type: object properties: new_orgs_default: { type: boolean } '400': { description: 'Anything but `{"on": true}` or `{"on": false}` (`{"code": "invalid_request"}`)' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: 'The setting could not be saved (`{"code": "org_agents_unavailable"}`)' } /admin/org-agents/bulk: post: tags: [Admin] summary: Turn the Team Playbook on or off in every organization description: | Instance admin only. Changes every organization that isn't that way yet, suspended ones included, in one transaction. An organization with no setting, or any value but true, counts as off. Each changes as its own `PATCH /admin/organizations/{id}` would: turning one off also sets what it learns from back to opt_in, stops its automatic runs and, once the change is saved, runs its privacy sweep. Turning them on changes the setting alone. Each organization it changes is recorded in the audit log as its PATCH would be: `org.update`, plus `org_agent.scope.set` and `org_agent.schedule.set` where turning it off changed them. requestBody: required: true content: application/json: schema: type: object required: ['on'] properties: 'on': { type: boolean } responses: '200': description: Changed content: application/json: schema: type: object properties: changed: { type: integer, minimum: 0, description: 'The organizations it changed, suspended ones included' } disabled_agents: { type: integer, minimum: 0, description: 'The playbooks that the privacy sweeps of the organizations it turned off disabled; 0 for on' } narrowed_agents: { type: integer, minimum: 0, description: 'The playbooks those sweeps kept on, on a version without what they learned from a session they may no longer read; 0 for on' } sweeps_unfinished: { type: array, items: { type: string, format: uuid }, description: 'The organizations it turned off whose sweep failed. Their change stands, and GET /admin/org-agents counts what is left as their pending_sweep_agents' } '400': { description: 'Anything but `{"on": true}` or `{"on": false}` (`{"code": "invalid_request"}`)' } '403': { $ref: '#/components/responses/Forbidden' } '500': { description: 'Something failed before the change was saved, so it changed no organization; try again (`{"code": "org_agents_unavailable"}`)' } /admin/organizations/{id}/suspend: post: tags: [Admin] summary: Suspend an organization description: | Instance admin only. Members can no longer refresh tokens in or switch into the organization, and its API tokens stop working; no data is deleted. The default organization and the caller's own active organization cannot be suspended. Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Suspended content: application/json: schema: type: object properties: status: { type: string, enum: [organization suspended] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } '409': { description: "The default organization, or the caller's active organization" } /admin/organizations/{id}/unsuspend: post: tags: [Admin] summary: Unsuspend an organization description: Instance admin only. Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Unsuspended content: application/json: schema: type: object properties: status: { type: string, enum: [organization unsuspended] } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /admin/organizations/{id}/members: get: tags: [Admin] summary: List an organization's members description: Instance admin only. Works for any organization, oldest membership first. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Members content: application/json: schema: type: object properties: members: type: array items: { $ref: '#/components/schemas/AdminOrgMember' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } post: tags: [Admin] summary: Add an existing user to an organization description: | Instance admin only. Adds a membership for an existing account (no seat limit applies). A user with no active organization adopts this one. Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [user_id] properties: user_id: { type: string, format: uuid } role: { type: string, enum: [owner, admin, member, viewer], default: member } responses: '201': description: Added content: application/json: schema: type: object properties: organization_id: { type: string, format: uuid } user_id: { type: string, format: uuid } role: { type: string, enum: [owner, admin, member, viewer] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Organization or user not found } '409': { description: The user is already a member of this organization } /admin/organizations/{id}/members/{userID}: delete: tags: [Admin] summary: Remove a user from an organization description: | Instance admin only. Removes the membership only; the account survives (if this was the user's active organization it is re-pointed to another membership). The spectator links the user minted for this organization's sessions are revoked, and their tokens for this organization stop working (401 `org_membership_revoked`). The last owner cannot be removed. Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: userID, in: path, required: true, schema: { type: string, format: uuid } } responses: '204': { description: Removed } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Membership not found } '409': { description: Cannot remove the only owner of an organization } patch: tags: [Admin] summary: Change a member's role in an organization description: Instance admin only. The organization's last owner cannot be demoted. Recorded in the audit log. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: userID, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object required: [role] properties: role: { type: string, enum: [owner, admin, member, viewer] } responses: '200': description: Updated content: application/json: schema: type: object properties: status: { type: string, enum: [updated] } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Membership not found } '409': { description: Cannot demote the only owner of an organization } /admin/organizations/{id}/invitations: get: tags: [Admin] summary: List an organization's pending invitations description: | Instance admin only. Works for any organization (Admin → Users, the organization picker above the pending invitations): the list `GET /organizations/{id}/invitations` gives that organization's own admins. parameters: - { $ref: '#/components/parameters/OrgId' } responses: '200': description: Pending invitations content: application/json: schema: type: object properties: invitations: type: array items: { $ref: '#/components/schemas/OrgInvitation' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Organization not found } post: tags: [Admin] summary: Invite someone to any organization description: | Instance admin only. `POST /organizations/{id}/invitations` for any organization, member or not, with an owner's authority there: the `owner` role may be given. The invitation, the seat it takes and its audit row belong to that organization; the member limit applies as on the organization's own route. parameters: - { $ref: '#/components/parameters/OrgId' } requestBody: required: true content: application/json: schema: type: object required: [email] properties: email: { type: string, format: email } role: { type: string, enum: [owner, admin, member, viewer], default: member } responses: '200': description: Invitation created content: application/json: schema: { $ref: '#/components/schemas/OrgInvitationSent' } '400': { $ref: '#/components/responses/BadRequest' } '403': description: 'Not an instance admin, or the member limit is reached (`code` = `org_member_limit`)' content: application/json: schema: { $ref: '#/components/schemas/OrgMemberLimitError' } '404': { description: Organization not found } '409': { description: "The user is already a member, or an invitation is already pending for this email" } /admin/organizations/{id}/invitations/{invID}: delete: tags: [Admin] summary: Revoke a pending invitation in any organization description: Instance admin only. As `DELETE /organizations/{id}/invitations/{invID}`, for any organization. parameters: - { $ref: '#/components/parameters/OrgId' } - { name: invID, in: path, required: true, schema: { type: string, format: uuid } } responses: '400': { $ref: '#/components/responses/BadRequest' } '204': { description: Revoked } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: "Organization or invitation not found, or the invitation is no longer pending" } /admin/organizations/{id}/invitations/{invID}/resend: post: tags: [Admin] summary: Resend an invitation in any organization description: | Instance admin only. As `POST /organizations/{id}/invitations/{invID}/resend`, for any organization and with an owner's authority there (an invitation to the `owner` role may be resent). parameters: - { $ref: '#/components/parameters/OrgId' } - { name: invID, in: path, required: true, schema: { type: string, format: uuid } } responses: '400': { $ref: '#/components/responses/BadRequest' } '200': description: Invitation re-sent content: application/json: schema: { $ref: '#/components/schemas/OrgInvitationSent' } '403': { $ref: '#/components/responses/Forbidden' } '404': { description: Organization or invitation not found } '409': { description: Invitation is no longer pending } /admin/org-settings/smtp: get: tags: [Admin] summary: Get the instance SMTP settings description: | Instance admin only. The effective outbound mail configuration, used for invitations, verification and notifications. Settings are stored once for the whole instance (on the default organization, else the oldest); when none are saved the environment configuration applies (`source` = `env`). The password is never returned. responses: '200': description: Effective settings content: application/json: schema: { $ref: '#/components/schemas/SMTPSettings' } '403': { $ref: '#/components/responses/Forbidden' } patch: tags: [Admin] summary: Update the instance SMTP settings description: | Instance admin only. Partial update; at least one field is required. An empty string clears a field, and clearing every field falls back to the environment configuration. `host` is required while any other field is set. An empty `password` keeps the stored one; `clear_password` removes it. Recorded in the audit log (without the password). requestBody: required: true content: application/json: schema: type: object properties: host: { type: string } port: { type: string, description: "1-65535; the response reports 587 when a host is set without a port" } username: { type: string } password: { type: string, description: Write-only; empty keeps the stored password } from: { type: string, description: Sender address } from_name: { type: string } clear_password: { type: boolean } responses: '200': description: Effective settings after the update content: application/json: schema: { $ref: '#/components/schemas/SMTPSettings' } '400': { $ref: '#/components/responses/BadRequest' } '403': { $ref: '#/components/responses/Forbidden' } '404': { $ref: '#/components/responses/NotFound' } /admin/org-settings/smtp/test: post: tags: [Admin] summary: Send a test email description: | Instance admin only. Sends a test message with the effective SMTP settings. The attempt is logged (see `/smtp/attempts`) and recorded in the audit log. requestBody: required: true content: application/json: schema: type: object required: [to] properties: to: { type: string, format: email } responses: '200': description: Sent content: application/json: schema: type: object properties: status: { type: string, enum: [sent] } to: { type: string } '400': { description: "Invalid recipient, or SMTP is not configured" } '403': { $ref: '#/components/responses/Forbidden' } '502': description: The SMTP send failed content: application/json: schema: type: object properties: error: { type: string } details: { type: string } /admin/org-settings/smtp/diagnostics: get: tags: [Admin] summary: Diagnose outbound mail description: | Instance admin only. Live report for "mail is sent but does not arrive": the effective settings, a TCP connect to the relay (5 s), MX/SPF/DMARC checks for the sender domain (5 s per lookup), whether the domain's SPF record covers the relay, and the last 10 send attempts. responses: '200': description: Diagnostics report content: application/json: schema: { $ref: '#/components/schemas/SMTPDiagnostics' } '403': { $ref: '#/components/responses/Forbidden' } /admin/org-settings/smtp/attempts: get: tags: [Admin] summary: List recent email send attempts description: Instance admin only. The instance-wide email send log, newest first. parameters: - { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 200, default: 50 }, description: Values above 200 are clamped } responses: '200': description: Attempts content: application/json: schema: type: object properties: attempts: type: array items: { $ref: '#/components/schemas/SMTPSendAttempt' } '400': { description: limit must be a positive integer } '403': { $ref: '#/components/responses/Forbidden' } /admin/sandboxes: get: tags: [Admin] summary: List active sandboxes across organizations description: | Instance admin only. Every running, pending, starting or creating sandbox (excluding those of finished sessions) in every organization, newest first, each tagged with its organization. responses: '200': description: Active sandboxes content: application/json: schema: type: object properties: sandboxes: type: array items: { $ref: '#/components/schemas/ActiveSandbox' } '403': { $ref: '#/components/responses/Forbidden' } /admin/memory/migrate: post: tags: [Admin] summary: Copy legacy project memory into project databases description: | Instance admin only. Copies the pre-workflow project memory rows (long_term_memory, control plane) into `crios.memory` in each project's own database, provisioning that database for projects that have rows to copy. Send `{}` for every project with rows left, or `{"project_id": …}` for one. Each request handles up to 20,000 rows per project (40 batches of 500); `remaining` says how many are left, so call again until it is 0. Idempotent: rows already copied are never duplicated (they count as `skipped`). One project's failure does not stop the others. Recorded in the audit log. requestBody: required: false content: application/json: schema: type: object properties: project_id: { type: string, format: uuid, description: Omit to migrate every project with rows left } responses: '200': description: Migration pass result content: application/json: schema: type: object properties: projects: { type: integer, description: Projects processed in this pass } copied: { type: integer } skipped: { type: integer, description: Rows already present in the destination } remaining: { type: integer, format: int64 } results: type: array items: type: object properties: project_id: { type: string, format: uuid } copied: { type: integer } skipped: { type: integer } remaining: { type: integer, format: int64 } error: { type: string, description: Present when this project failed } '400': { description: "Invalid body, or project_id is not a valid UUID" } '403': { $ref: '#/components/responses/Forbidden' } '503': { description: This deployment runs no project databases } # ==================== PLATFORM: HEALTH, AUTH, INTEGRATIONS HUB, CONNECTORS, MCP CONNECTIONS, WEBHOOKS, GIT PROXIES ==================== /healthz: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Health] summary: Liveness probe description: | Public liveness probe on the root router; the orchestrator's Kubernetes livenessProbe targets it. Answers 200 whenever the process serves HTTP. A twin is registered at `/api/v1/healthz` with the same handler and body, but it sits behind the API auth middleware: it answers 401 without a valid bearer token. Any valid token passes, whatever its personal-API-token scopes. security: [] responses: '200': description: Alive content: application/json: schema: type: object properties: status: { type: string, enum: [ok] } /readyz: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Health] summary: Readiness probe description: | Public readiness probe on the root router; the Kubernetes readinessProbe targets it. Pings the control-plane database and answers 503 when the ping fails. A twin is registered at `/api/v1/readyz` behind the API auth middleware (401 without a valid bearer token). security: [] responses: '200': description: Ready content: application/json: schema: type: object properties: status: { type: string, enum: [ready] } '503': description: 'Database unreachable. The body is `{"status":"not ready","error":"database"}`, sent as text/plain.' /auth/invitations/{token}: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Auth] summary: Look up an organization invitation description: | Public pre-accept lookup behind the emailed accept link (rate-limited by the `/auth` subrouter). An unusable token is still a 200, with `valid: false` and a `reason` of `not_found`, `accepted`, `revoked` or `expired`. `account_exists` tells the page whether to offer sign-in (then POST /invitations/accept-existing) or account creation (POST /auth/invitations/accept). security: [] parameters: - { name: token, in: path, required: true, schema: { type: string }, description: Raw invitation token from the emailed link } responses: '200': description: Invitation state content: application/json: schema: type: object properties: valid: { type: boolean } reason: { type: string, enum: [not_found, accepted, revoked, expired], description: Only when valid is false } org_name: { type: string } email: { type: string, format: email } role: { type: string, enum: [owner, admin, member, viewer] } account_exists: { type: boolean } '429': { description: Per-IP rate limit exceeded } '500': { description: Failed to load invitation } /auth/invitations/accept: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Accept an invitation with a new account description: | Spends a pending invitation: creates the account in the inviting organization with the invited email and role, marks the email verified (the link proves the inbox), and signs the user in. The claim is atomic, so a token is spent at most once. An email that already has an account gets 409 `account_exists` and the invitation stays pending; that user signs in and calls POST /invitations/accept-existing instead. While SSO is required the request answers 403 `sso_required` before the invitation is claimed: the invitee signs in through the identity provider, then accepts with POST /invitations/accept-existing. security: [] requestBody: required: true content: application/json: schema: type: object required: [token, name, password] properties: token: { type: string } name: { type: string } password: { type: string, format: password, description: Must pass the password-strength rules } responses: '200': description: Account created and signed in content: application/json: schema: { $ref: '#/components/schemas/LoginResponse' } '400': { description: 'Missing field, weak password, or invalid or expired invitation token' } '403': { description: 'SSO is required (code sso_required); the invitation stays pending', content: { application/json: { schema: { $ref: '#/components/schemas/AuthCodedError' } } } } '409': { description: 'account_exists: the invited email already has an account' } '429': { description: Per-IP rate limit exceeded } /auth/switch-org: post: tags: [Auth] summary: Switch the active organization description: | Moves the caller's active organization to another organization they are a member of and returns a fresh token pair whose claims carry that organization and the membership's role. Only a user's own browser session may switch: personal API tokens and sandbox tokens get 403 because they stay pinned to the organization they were created in. Rate-limited by the strict auth limiter (10 per minute per client IP). A full-access API token that isn't bound to a project counts against its user's bucket before the 403; a narrower or project-bound one is refused before the limit. Into an organization that requires MFA, a session that has not proved TOTP (its token's `amr` carries no `otp`/`mfa`, and it is not an SSO session) is answered 403 `{"error", "code": "mfa_required" | "mfa_setup_required", "mfa_token"}`: `mfa_required` when the account has TOTP, `mfa_setup_required` when it has none. POST /auth/mfa/verify (or /auth/mfa/setup then /auth/mfa/enable) with that `mfa_token` completes the switch: it moves the active organization and returns tokens for the target organization (`method: switch_org_mfa`) whose `amr` proves the factor, so a repeated switch-org call also succeeds. requestBody: required: true content: application/json: schema: type: object required: [organization_id] properties: organization_id: { type: string, format: uuid } responses: '200': description: New tokens for the target organization content: application/json: schema: { $ref: '#/components/schemas/LoginResponse' } '400': { description: organization_id is required } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Token kind cannot switch, not a member, account or organization suspended, or the target requires MFA this session has not proved (`code` mfa_required | mfa_setup_required, with `mfa_token`)' } '429': { description: Rate limit exceeded } /integrations: get: tags: [Integrations Hub] summary: List the integration catalog with your accounts description: | Every registered integration with its scopes, capabilities, actions and the caller's connected accounts. `enabled` says whether the caller's active organization has configured the provider's OAuth app. With `project_id` (a project in the caller's organization) each account also reports `linked` and `enabled_in_project`. parameters: - { name: project_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Catalog content: application/json: schema: type: object properties: integrations: type: array items: { $ref: '#/components/schemas/IntegrationHubEntry' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Project not found in the caller''s organization' } '500': { description: 'Project check failed (a malformed project_id also lands here)' } '503': { description: Integrations are not available on this deployment } /integrations/connected: get: tags: [Integrations Hub] summary: Summarize your connected integrations description: | Compact list the sandbox agent fetches at boot: one entry per integration where the caller has a healthy account, with the actions its integration tool may call. Actions that require approval are left out; the account's access level does not filter the list (an invoke outside it answers `permission_denied`). For a sandbox token the list is scoped to the token's project, with the checks an invoke runs there: the integration must be allowed by the project's `enabled_integrations` and the account an invoke without `account_id` would use (the most recently connected one) must be linked to the project and enabled. responses: '200': description: Connected summary content: application/json: schema: type: object properties: connected: type: array items: type: object properties: integration_id: { type: string } name: { type: string } account_label: { type: string } actions: { type: array, items: { type: string } } '401': { $ref: '#/components/responses/Unauthorized' } '503': { description: Integrations are not available on this deployment } /integrations/invoke: post: tags: [Integrations Hub] summary: Invoke an integration action description: | The unified execution path behind the Connectors test console and the sandbox agent's integration tool. Without `account_id` the caller's default account for the integration is used. With `project_id` (ignored for sandbox tokens, which use their bound project) the project's integration allowlist and the account's project link are enforced. The account's access level is checked before its granted scopes, then any narrowing the project set for the account (PUT /projects/{id}/connectors/bindings/hub_account/…): an action outside either is `permission_denied` (403), even when the scopes are granted. Actions marked `requires_approval` run only when the account has auto-approve on; otherwise 409 `approval_required`. Every call is written to the activity log. `X-Request-Id` is echoed as `request_id`, or generated. Failures carry the IntegrationHubError envelope (`error`, `code`, `recovery`, `connect_url`); the codes map to the statuses below. parameters: - { name: X-Request-Id, in: header, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object required: [integration, action] properties: integration: { type: string, description: 'Integration id, for example gmail or google_calendar' } account_id: { type: string, format: uuid } action: { type: string } params: { type: object, additionalProperties: true } project_id: { type: string, format: uuid } responses: '200': description: Action result content: application/json: schema: type: object properties: ok: { type: boolean } request_id: { type: string } result: type: object properties: kind: { type: string, description: 'Result kind, for example emails, event, files' } summary: { type: string } data: { description: Provider-specific payload } '400': { description: 'Invalid JSON, invalid project_id, or validation_error (unknown integration or action, bad params)' } '401': { description: 'authentication_error: the account needs to be re-authorized' } '403': { description: 'not_connected, permission_denied (missing scopes, see connect_url; or the account''s access level or the project''s narrowing does not allow the action), integration_disabled for the project, or viewer role' } '404': { description: Project or account not found } '409': { description: 'approval_required or conflict' } '429': { description: 'rate_limited by the provider' } '502': { description: 'provider_unavailable or network_error' } '504': { description: timeout } '503': { description: Integrations are not available on this deployment } /integrations/families/{family}/connect: post: tags: [Integrations Hub] summary: Connect several products of a family in one sign-in description: | One consent for several products of a connector family, each at its own access level, for example Google Workspace with Gmail at `read` and Drive at `full`. `products` maps each product's integration id to `off`, `read`, `full` or `custom` (lowercase); `off` products are skipped, and at least one product must be selected. For a `custom` product, `allowed[]` lists its actions (normalized like `allowed_actions` on the single connect). The sign-in runs on the first selected product in the family's order (`primary`) and asks for the union of the scopes each product's level needs. On the provider's callback the one token answer is stored as one account per selected product, each at its level (a reconnect of an existing account takes the new level), and a `connect` activity entry is written per account; the redirect names the primary account. Open `authorize_url` as a full-page redirect; `return_to` works as on the single connect. Families and their products: `google` (gmail, google_calendar, google_drive), `slack`, `jira`, `x`, `instagram`, `tiktok`, `facebook`, `discord` (one product each, named like the family). Sandbox tokens and viewers get 403. parameters: - { name: family, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' }, description: 'Connector family, for example google' } requestBody: required: true content: application/json: schema: type: object required: [products] properties: products: type: object additionalProperties: { type: string, enum: ['off', read, full, custom] } description: 'Integration id to access level; every key must be a product of the family' allowed: type: object additionalProperties: { type: array, items: { type: string } } description: 'Integration id to its action list, for the custom products' return_to: { type: string, description: 'Same-origin path to land on after the callback (default /integrations)' } responses: '200': description: Authorize URL for the one sign-in content: application/json: schema: type: object properties: authorize_url: { type: string } primary: { type: string, description: The product the sign-in runs on } scopes: { type: array, items: { type: string }, description: 'The scopes requested, sorted' } '400': description: 'products missing or empty, a level other than off, read, full or custom, a key that is not a product of the family, no product selected, or (as an IntegrationHubError) the provider not configured for the organization or no CRIOS_PUBLIC_BASE_URL' content: application/json: schema: { $ref: '#/components/schemas/IntegrationHubError' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer role, or a sandbox token' } '404': { description: Unknown connector family } '503': { description: Integrations are not available on this deployment } /integrations/{integration}/connect: post: tags: [Integrations Hub] summary: Start an OAuth connect description: | Returns the provider's authorize URL; open it as a full-page redirect (consent screens refuse iframes). A single-use state (15 minutes, PKCE where the provider supports it) is bound to the caller. `scopes` defaults to the integration's default scopes; `return_to` must be a same-origin path and defaults to `/integrations`. The provider then redirects to GET /api/v1/integrations/oauth/callback. Sandbox tokens cannot start a connect (403): a person connects accounts. Viewers may connect their own accounts. The answer also sets a short-lived HttpOnly cookie that binds the connect to this browser: the callback completes only in the browser that started it, so open the authorize URL there. `access_level` (`read`, `full` or `custom`, lowercase) shapes the consent and lands on the account: without `scopes`, the sign-in asks only for the scopes that level needs (the identity scopes plus the required scopes of every action it allows; `full` is the default set plus every action's scopes), and the connected account is stored at that level, with `allowed_actions` as its list for `custom` (names are lowercased, deduplicated and unknown ones dropped). Without `access_level` a new account is `full` and a reconnect keeps its level. parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' }, description: 'Integration id: google_calendar, google_drive, gmail, x, instagram, jira, slack, facebook, tiktok or discord' } requestBody: content: application/json: schema: type: object properties: scopes: { type: array, items: { type: string }, description: 'Explicit scopes; when set they are requested as given, whatever access_level says' } return_to: { type: string, description: Same-origin path to land on after the callback } access_level: { type: string, enum: [read, full, custom], description: '"off" is refused' } allowed_actions: { type: array, items: { type: string }, description: 'custom only: the actions to allow' } responses: '200': description: Authorize URL content: application/json: schema: type: object properties: authorize_url: { type: string } '400': description: 'An access_level other than read, full or custom (body {"error"}), or, as an IntegrationHubError, an unknown integration or a provider not configured for the organization (no OAuth app credentials, or no CRIOS_PUBLIC_BASE_URL)' content: application/json: schema: { $ref: '#/components/schemas/IntegrationHubError' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: A sandbox token } /integrations/oauth/callback: get: tags: [Integrations Hub] summary: OAuth callback for hub integrations description: | Public: the provider redirects the browser here without a bearer token. The single-use server-side state row (bound to the user who started the connect, with the PKCE verifier) is the credential, together with the binding cookie the connect answer set: a browser without it (one the authorize URL was passed to) is sent back with `integration_error` and nothing is exchanged or stored. Always redirects to `CRIOS_PUBLIC_BASE_URL` plus the stored `return_to` (default `/integrations`): on success with `?connected=&account_id=`, on failure with `?integration_error=`. A family connect stores one account per selected product at its access level, and the redirect names the primary product's account. Rate-limited per client IP. security: [] parameters: - { name: code, in: query, schema: { type: string } } - { name: state, in: query, schema: { type: string } } - { name: error, in: query, schema: { type: string }, description: Set by the provider when the user declined } responses: '302': { description: Redirect back to the app with connected or integration_error } '429': { description: Rate limit exceeded } '503': { description: Integrations are not available on this deployment } /integrations/gmail/callback: get: tags: [Integrations Hub] summary: Google consent callback for Gmail description: | Public: Google redirects the browser here after the consent started by POST /users/me/integrations/gmail/connect. The HMAC-signed `state` (10 minutes, bound to the initiating user and organization) is the credential, together with the binding cookie the connect answer set in the starting browser. The code is exchanged with that organization's Google OAuth app; the account is stored and mirrored into the integrations hub. Always redirects to `/integrations?connected=gmail`, or to `/integrations?connect_error=gmail&reason=` with reason `state`, `denied`, `browser` (not the browser that started the connect), `exchange`, `profile` or `store`. Rate-limited per client IP. security: [] parameters: - { name: code, in: query, schema: { type: string } } - { name: state, in: query, schema: { type: string } } - { name: error, in: query, schema: { type: string }, description: Set by Google when the user declined } responses: '302': { description: Redirect to /integrations with connected=gmail or connect_error=gmail } '429': { description: Rate limit exceeded } /integrations/{integration}/disconnect: post: tags: [Integrations Hub] summary: Disconnect an integration account description: | Revokes the grant at the provider (best effort) and deletes the stored account. While another of the user's accounts still holds the same grant (another product of one family sign-in, or the same provider account under the same OAuth app) the provider-side revoke is skipped, so the other products keep working; the last one's disconnect revokes it. Without `account_id` the integration's only account is used; with several accounts `account_id` is required. Sandbox tokens are refused (403). parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' } } requestBody: content: application/json: schema: type: object properties: account_id: { type: string, format: uuid } responses: '200': description: Disconnected content: application/json: schema: type: object properties: disconnected: { type: boolean } upstream_revoked: { type: boolean, description: False when the provider-side revoke failed or was skipped because another account still holds the grant } '400': { description: 'validation_error: several accounts are connected; pass account_id' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'not_connected, or a sandbox token' } '404': { description: Account not found } /integrations/{integration}/refresh: post: tags: [Integrations Hub] summary: Force a token refresh description: Refreshes the account's access token now; the recovery action after a stale-credential error. Account selection works as for disconnect. Sandbox tokens are refused (403). parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' } } requestBody: content: application/json: schema: type: object properties: account_id: { type: string, format: uuid } responses: '200': description: Refreshed content: application/json: schema: type: object properties: refreshed: { type: boolean } account: { $ref: '#/components/schemas/IntegrationHubAccount' } '400': { description: 'validation_error: several accounts are connected; pass account_id' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'not_connected, or a sandbox token' } '404': { description: Account not found } '409': { description: 'authentication_error: the provider rejected the refresh token, so the account is marked needs_reauth; reconnect (body {"error", "code", "recovery", "connect_url"}). Or conflict: the provider has nothing to refresh with (Slack bot tokens do not expire, or the grant carried no refresh token); the account is left as it is. Never 401, which means the caller''s own session ended' } /integrations/{integration}/status: get: tags: [Integrations Hub] summary: Get one integration's status parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' } } responses: '200': description: Integration status content: application/json: schema: type: object properties: integration: { type: object, additionalProperties: true, description: 'Registry descriptor (id, provider, name, description, icon, auth_type, version, scopes, webhook_support, polling_support)' } enabled: { type: boolean, description: 'The organization''s OAuth app is configured' } connected: { type: boolean, description: At least one account is connected } accounts: type: array items: { $ref: '#/components/schemas/IntegrationHubAccount' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: Unknown integration } /integrations/{integration}/accounts: get: tags: [Integrations Hub] summary: List your accounts for an integration parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' } } responses: '200': description: Accounts content: application/json: schema: type: object properties: accounts: type: array items: { $ref: '#/components/schemas/IntegrationHubAccount' } '401': { $ref: '#/components/responses/Unauthorized' } /integrations/{integration}/accounts/{accountId}: patch: tags: [Integrations Hub] summary: Set an account's auto-approve flag or access level description: | Owner-side settings of one of the caller's accounts; send either half or both. - `auto_approve` turns the owner-approval gate on blast-radius actions (for example sending mail) off (`true`) or back on (`false`). New accounts start with auto-approve off. - `access_level` (`off`, `read`, `full` or `custom`; trimmed and lowercased) sets what the account may do, with `allowed_actions` as the list for `custom` (lowercased, deduplicated, unknown names dropped). It takes effect on the next invoke, whatever scopes the account was granted; raising it may still need a new consent for the scopes. Only the owner in person may change these: sandbox tokens are refused (403), so generated code cannot lift the gate before invoking a gated action. Viewers may change their own accounts. parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' } } - { name: accountId, in: path, required: true, schema: { type: string, format: uuid } } requestBody: required: true content: application/json: schema: type: object properties: auto_approve: { type: boolean } access_level: { type: string, enum: ['off', read, full, custom] } allowed_actions: { type: array, items: { type: string }, description: 'custom only: the actions to allow' } responses: '200': description: 'Updated; carries only the halves that were sent' content: application/json: schema: type: object properties: auto_approve: { type: boolean } access_level: { type: string, enum: ['off', read, full, custom] } allowed_actions: { type: array, nullable: true, items: { type: string }, description: 'The stored custom list; null for the other levels' } effective_actions: { type: array, items: { type: string }, description: 'The action names the level now allows, sorted' } '400': { description: 'Neither auto_approve (boolean) nor access_level was sent, or access_level is not off, read, full or custom' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: A sandbox token } '404': { description: Account not found for this integration } /integrations/{integration}/logs: get: tags: [Integrations Hub] summary: List your activity for an integration description: The caller's own activity entries (connects, disconnects, invocations), newest first. parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' } } - { name: action, in: query, schema: { type: string } } - { name: status, in: query, schema: { type: string, enum: [ok, error] } } - { name: limit, in: query, schema: { type: integer, default: 50, minimum: 1, maximum: 200 }, description: Values outside 1-200 fall back to 50 } responses: '200': description: Activity entries content: application/json: schema: type: object properties: entries: type: array items: { $ref: '#/components/schemas/IntegrationHubActivity' } '401': { $ref: '#/components/responses/Unauthorized' } /integrations/{integration}/permissions: get: tags: [Integrations Hub] summary: Compare required, granted and allowed permissions description: | The integration's scope model in the vendor's words, and for each action which of your accounts were granted its scopes and which allow it at their access level. Granted and allowed are separate facts: an earlier broad consent may grant what the level no longer allows, and an allowed action may still need consent. Also lists each account's level and the Read tier's actions. parameters: - { name: integration, in: path, required: true, schema: { type: string, pattern: '^[a-z0-9_]+$' } } responses: '200': description: Permissions content: application/json: schema: type: object properties: scopes: type: array items: type: object properties: scope: { type: string } description: { type: string, description: 'The vendor''s documented meaning when known, else the provider''s own' } default: { type: boolean, description: Requested on first connect } label: { type: string, description: 'The vendor''s short name for the scope; omitted when unknown' } read: { type: boolean, description: 'The scope only grants reads; omitted when false' } sensitivity: { type: string, description: 'The vendor''s tier where it has one (Google: basic, sensitive, restricted); omitted otherwise' } actions: type: array items: type: object properties: action: { type: string } capability: { type: string } description: { type: string } read: { type: boolean, description: 'In the Read tier (search, list, read or download)' } requires_approval: { type: boolean } required_scopes: { type: array, items: { type: string } } granted_on: { type: array, items: { type: string }, description: Account ids whose granted scopes cover the action } allowed_on: { type: array, items: { type: string }, description: Account ids whose access level allows the action } accounts: type: array items: type: object properties: id: { type: string, format: uuid } access_level: { type: string, enum: ['off', read, full, custom] } allowed_actions: { type: array, items: { type: string }, description: 'The custom list; empty for the other levels' } effective_actions: { type: array, items: { type: string }, description: 'The actions the level allows, sorted' } read_actions: { type: array, items: { type: string }, description: The actions of the Read tier } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: Unknown integration } /connectors/catalog: get: tags: [Connectors] summary: Get the unified connector catalog description: | The connector directory: first the organization's connector families (Jira, GitHub, Slack, GitLab, Google, X, Instagram, TikTok, Facebook, Discord, Telegram), then one card per long-tail product, sorted by slug. A product card groups the workflow credential types and the MCP catalog rows of one provider; the generic HTTP auth templates (http_basic, http_bearer, http_header, http_query) are the methods of a single `http` card, the custom API. A credential type or MCP row whose provider a family covers (for example gmail_mcp, github_mcp or twitter) is a method of that family's card instead of a card of its own. Each card lists its ways of connecting (`methods`), the directory tabs that show it, its featured rank and copy, a family's products with their documented permissions, a usage signal and whether a Read tier exists. Status booleans, counts and metadata only, never field values or secrets. The body is the same for every member of the organization except the counts of the caller's own connected accounts (`user_accounts`, `products[].user_accounts` and their share of `usage.connections`); `usage.connections` counts the organization's own connections, never another organization's. With `project_id` (a project in the caller's organization the caller may read: viewer access or better, and for a sandbox or project-bound API token its own project) each entry also reports `project_satisfied`. Sent with `Cache-Control: no-store`. parameters: - { name: project_id, in: query, schema: { type: string, format: uuid } } responses: '200': description: Catalog content: application/json: schema: type: object properties: connectors: type: array items: { $ref: '#/components/schemas/UnifiedConnectorCatalogEntry' } '400': { description: project_id must be a UUID } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Project not found in the caller''s organization, or not one the caller may read' } '503': { description: Database is unavailable } /connectors/project-keys: get: tags: [Connectors] summary: List the services your projects hold keys of description: | For each project the caller can open (the projects GET /projects lists), the workflow credential types it holds a connected, unexpired credential of: what marks a connector card for a project's key. Hub account grants and the connections Crios minted for a project's own managed databases are left out, and so are projects with no key. Type names only, never a credential's name, id or value. Sent with `Cache-Control: no-store`. responses: '200': description: Projects and their key types content: application/json: schema: type: object properties: projects: type: array items: type: object properties: project_id: { type: string, format: uuid } project_name: { type: string } services: { type: array, items: { type: string }, description: 'Credential types, sorted' } '401': { $ref: '#/components/responses/Unauthorized' } '503': { description: Database is unavailable } /mcp/connections: get: tags: [MCP] summary: List your MCP connections description: The caller's own MCP connections in the active organization, to connector-catalog services and to their own custom servers, ordered by name. Secrets and tokens are never returned. responses: '200': description: Connections content: application/json: schema: type: object properties: connections: type: array items: { $ref: '#/components/schemas/MCPUserConnection' } '401': { $ref: '#/components/responses/Unauthorized' } post: tags: [MCP] summary: Connect an MCP service to your account description: | Creates, or reconnects in place, the caller's connection to a catalog MCP service (one per organization, user and service). The catalog decides the auth method: - `mcp_open`: connected at once (201, `status: connected`). - `mcp_token`: `header_value` is required and stored in Vault (`header_name` defaults to `Authorization`). The key is tried with a handshake before the connection counts as connected: on success 201 `status: connected`; when the server rejects it (HTTP 401 or 403) 422 and nothing is kept (a reconnect keeps its row, marked `error`); when the server cannot be reached or fails otherwise 201 `status: error` with a `message`, and the row stays so it can be reconnected. Services whose vendor also accepts an API key allow `auth_method: mcp_token` as an override of `mcp_oauth`. - `mcp_oauth`: discovery plus a pre-registered or dynamically registered client; returns `status: pending` and an `authorize_url` to open. The provider then redirects to GET /api/v1/mcp/oauth/callback. A new connection starts with the tools the catalog documents for the vendor, when it has a verified list, until the first probe replaces them; a reconnect keeps a probed list. Connected services have their tools discovered right away. A new connection's access level is `full`; a reconnect keeps the level. Viewers and sandbox tokens cannot call this route. requestBody: required: true content: application/json: schema: type: object required: [service] properties: service: { type: string, description: Connector-catalog service slug } auth_method: { type: string, enum: [mcp_token], description: API-key override for services that accept one } header_value: { type: string, description: Write-only secret for mcp_token services } header_name: { type: string, default: Authorization } return_to: { type: string, description: 'Same-origin path the OAuth callback lands on (default /workflows/oauth2/connected)' } responses: '201': description: 'Connected, pending OAuth consent, or saved but not reachable (status error)' content: application/json: schema: type: object properties: id: { type: string, format: uuid } status: { type: string, enum: [connected, pending, error] } authorize_url: { type: string, description: Only for mcp_oauth } message: { type: string, description: 'Only with status error: why the handshake failed' } '400': { description: 'Invalid body, unsupported auth method, or header_value missing' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Sandbox token, or viewer role' } '404': { description: Unknown or disabled MCP connector } '409': description: The authorization server does not register clients automatically and no OAuth client is configured content: application/json: schema: type: object properties: error: { type: string } code: { type: string, enum: [mcp_no_registration] } token_fallback: { type: boolean, description: The service also accepts an API key } '422': { description: 'mcp_token: the server rejected the key (body {"error": "The server rejected this key"})' } '500': { description: 'The connection or its secret could not be saved' } '502': { description: OAuth discovery or client registration failed } '503': { description: 'MCP catalog or secret storage unavailable, or OAuth not configured' } /mcp/connections/custom: post: tags: [MCP] summary: Add your own custom MCP server description: | Registers a remote MCP server of the caller's own as an individual connection (only its owner sees and uses it; grant it to projects like any other connection). The server must speak streamable HTTP at an absolute `https` endpoint on a public host: `localhost`, `*.localhost`, `*.local` and `*.internal` names, loopback, private, link-local and unspecified IP literals, and SSE endpoints (a path ending in `/sse`) are refused. `headers` is how the server authenticates (see MCPHeader): a `secret` header takes its value from `header_secrets` (write-only, stored in Vault; one without a value is refused), a `connection` header reads the caller's connected account or a project connection at call time, a `plain` header is stored as given. `instructions` (at most 4000 bytes after trimming) is appended to the server's tool advertisement so agents know when to use it; `icon` is a PNG, JPEG or WebP data URL of at most 64 KiB. `access_level` is `off`, `read` or `full` (default `full`); a `custom` tool list is set afterwards with PATCH. The name must be unique among the caller's own connections. The connection is saved with `auth_method` `mcp_custom` and status `pending`, then probed once before the answer, and the probe decides: a clean handshake and `tools/list` makes it `connected` (201); a server that refuses the credentials (HTTP 401 or 403) rolls the connection and its secrets back and answers 422 `mcp_auth_rejected` with the probe's error in `details`, so nothing is saved; any other failure (unreachable, broken) keeps it with status `error` and answers 201 with the probe's error in `message`. Either way the outcome also lands in `last_probe_status`. The body is capped at 256 KiB. Viewers and sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object required: [name, endpoint] properties: name: { type: string, description: Trimmed; required } endpoint: { type: string, description: 'https URL of the streamable HTTP endpoint' } access_level: { type: string, enum: ['off', read, full], default: full } headers: { type: array, items: { $ref: '#/components/schemas/MCPHeader' } } header_secrets: { type: object, additionalProperties: { type: string }, description: 'Write-only values of the secret headers, by header name; blank values are ignored' } instructions: { type: string, description: At most 4000 bytes after trimming } icon: { type: string, description: 'A data:image/png, data:image/jpeg or data:image/webp base64 URL of at most 64 KiB' } responses: '201': description: 'The saved connection, `connected` or `error` (then with the probe error in `message`); only `id` and `status` when it could not be read back' content: application/json: schema: { $ref: '#/components/schemas/MCPUserConnection' } '400': { description: 'Invalid body, missing name, an endpoint that breaks the rules above, an invalid header list or access level, a header_secrets entry that names no secret header, a secret header without a value, secret storage unavailable, or an instruction or icon over its limit', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer role, or a sandbox token' } '409': { description: You already have a connection with that name } '422': { description: 'The server refused the credentials (`code` `mcp_auth_rejected`, the probe error in `details`), or a `connection` header reads a project connection that may not be sent to this endpoint (`code` `mcp_header_*`, the header in `header`; see MCPHeaderRef); nothing was saved', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: The connection could not be saved } /mcp/header-connections: get: tags: [MCP] summary: List the project connections a custom server's header may send description: | The connections of one project as the custom MCP server form offers them under "From connection": for each, the `host:port` pairs it may be sent to, the secret fields a header may read (the first is the default), and, when it cannot be a header source for the caller at all, the reason. A `connection` header is accepted only when the server's `https` endpoint is on one of `destinations` (see MCPHeaderRef); the save and every call check that again. No secret is returned. The caller must be able to edit the project. parameters: - { name: project_id, in: query, required: true, schema: { type: string, format: uuid } } - { name: scope, in: query, schema: { type: string, enum: [individual, workspace] }, description: '`workspace` lists for an organization server: a connection that acts as one person is then never eligible' } responses: '200': description: The project's connections content: application/json: schema: type: object properties: connections: type: array items: type: object properties: id: { type: string, format: uuid } name: { type: string } cred_type: { type: string } destinations: { type: array, items: { type: string }, description: '`host:port` pairs (https only); empty when the connection names no host' } fields: { type: array, items: { type: string }, description: 'Secret field names a header may read; never values' } personal: { type: boolean, description: The connection acts as one person } reason: { type: string, enum: [mcp_header_no_host, mcp_header_field_not_allowed, mcp_header_not_permitted, mcp_header_personal], description: 'Set when the connection cannot be a header source for the caller' } '400': { description: project_id is missing or not a UUID } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'The project does not exist in the active organization, or the caller cannot edit it' } /mcp/connections/{id}: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] patch: tags: [MCP] summary: Change your MCP connection's access or shape description: | Owner-only: the connection must be one of the caller's own in the active organization (404 otherwise, admins included). `access_level` sets what the connection may do, and the proxy's `allowed_tools` is derived from it over the discovered tools: `off` no tool, `read` the tools the server marks read-only (re-derived on every probe), `full` every tool (`*`), `custom` the `allowed_tools` sent (names missing from `discovered_tools` are dropped; while the connection lists no tools yet, the list is kept as sent). `read` on a connection that lists tools but marks none read-only is refused with 409 `no_read_tier`. On a custom server (`custom` true) the request may also change `name`, `endpoint` (same rules as on create), `headers`, `header_secrets`, `instructions` and `icon`; secrets not re-sent are kept. On a connection to a catalog service those fields are refused (400): the catalog owns its shape. Omitted fields keep their value, and at least `access_level` or one of those fields is required. The body is capped at 256 KiB. Viewers and sandbox tokens get 403. requestBody: required: true content: application/json: schema: type: object properties: access_level: { type: string, enum: ['off', read, full, custom] } allowed_tools: { type: array, items: { type: string }, description: 'custom only: the tools to allow' } name: { type: string, description: Custom servers only; must not be blank } endpoint: { type: string, description: Custom servers only } headers: { type: array, items: { $ref: '#/components/schemas/MCPHeader' }, description: 'Custom servers only; replaces the list' } header_secrets: { type: object, additionalProperties: { type: string }, description: 'Custom servers only; write-only values by header name' } instructions: { type: string, description: 'Custom servers only; at most 4000 bytes' } icon: { type: string, description: 'Custom servers only; PNG, JPEG or WebP data URL up to 64 KiB, or "" to clear' } responses: '200': description: 'With access_level, the stored level and allowlist; without it, the updated connection' content: application/json: schema: oneOf: - type: object description: access_level was sent properties: id: { type: string, format: uuid } access_level: { type: string, enum: ['off', read, full, custom] } allowed_tools: { type: array, items: { type: string } } - { $ref: '#/components/schemas/MCPUserConnection' } '400': { description: 'Invalid body, access_level missing or not one of off, read, full or custom, a shape field on a catalog connection, a blank name, an invalid endpoint, header list, instructions or icon, a header_secrets entry that names no secret header, a secret header without a value, or secret storage unavailable', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer role, or a sandbox token' } '404': { description: Connection not found } '409': description: 'The server marks no tool read-only; pick tools with a custom level (code no_read_tier)' content: application/json: schema: type: object properties: error: { type: string } code: { type: string, enum: [no_read_tier] } '422': { description: 'A `connection` header reads a project connection that may not be sent to the endpoint of this server (`code` `mcp_header_*`, the header in `header`; see MCPHeaderRef); nothing was changed', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '500': { description: The connection could not be updated } delete: tags: [MCP] summary: Disconnect an MCP connection description: Deletes one of the caller's own connections, its stored secret and any pending OAuth state. Sandbox tokens cannot call this route. responses: '204': { description: Deleted } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Sandbox token, or viewer role' } '404': { description: Connection not found } /mcp/connections/{id}/probe: parameters: [{ name: id, in: path, required: true, schema: { type: string, format: uuid } }] post: tags: [MCP] summary: Test your MCP connection description: | Owner-only (404 for anyone else's connection, admins included): runs the MCP handshake and `tools/list` from the orchestrator, like POST /mcp-servers/{id}/probe does for organization servers. Records `last_probe_at` and `last_probe_status`; on success it stores the tools as `discovered_tools` (for a catalog service, with the vendor's documented read-only verdicts and groups filled in where the server sends none) and re-derives the allowlist of a `read` connection. A custom server's `status` follows the probe (`connected` on success, `error` on failure) — it has no other connect flow, so this is how Reconnect revives it; a catalog connection's `status` is not changed. Shares the per-organization rate limit of probes and proxied calls (1 per second, bursts of 20). Viewers and sandbox tokens get 403. responses: '200': description: Probe succeeded content: application/json: schema: { $ref: '#/components/schemas/MCPProbeResult' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer role, or a sandbox token' } '404': { description: Connection not found } '422': { description: 'A `connection` header reads a project connection that may not be sent to the endpoint of this server (`code` `mcp_header_*`, the header in `header`; see MCPHeaderRef); the server was not contacted', content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } } '429': description: Organization rate limit exceeded (Retry-After is 1 second) content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '500': description: 'The connection''s credentials could not be resolved (an OAuth connection not yet connected, a secret header without a value, a connection header that cannot be read), or the connection could not be loaded' content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } '502': description: The server was unreachable or the handshake or tool listing failed content: application/json: schema: { $ref: '#/components/schemas/MCPServerError' } /mcp/oauth/callback: get: tags: [MCP] summary: OAuth callback for MCP connections description: | Public: the provider redirects the browser here. The single-use `mcp_oauth_states` row (15 minutes, PKCE verifier held server-side, bound to the connecting user) is the credential, together with the binding cookie POST /mcp/connections set in the starting browser: a browser without it is redirected to `/?oauth_error=mcp_other_browser` and the state is left untouched. On success the token is stored sealed, tools are discovered, and the browser is redirected to the connection's `return_to` path (default `/workflows/oauth2/connected`) with `?connected=`. An unknown, expired or mismatched state redirects to `/?oauth_error=mcp_state_invalid`; a failed exchange to `/?oauth_error=mcp_exchange_failed`. When the provider redirects with `error` instead of a code (for example a declined consent), the state row is deleted and the browser goes to the connection's `return_to` (to `/` when the state is unknown) with `oauth_error=mcp_access_denied` for `error=access_denied` or `oauth_error=mcp_provider_error` otherwise; the provider's own text is never forwarded. Rate-limited per client IP. security: [] parameters: - { name: code, in: query, required: false, schema: { type: string }, description: Present on success } - { name: state, in: query, required: false, schema: { type: string } } - { name: error, in: query, required: false, schema: { type: string }, description: 'The provider refused the request (for example access_denied)' } responses: '302': { description: Redirect back to the app } '400': { description: Missing code or state and no provider error (JSON error body) } '429': { description: Rate limit exceeded } /webhooks/github/{orgID}: post: tags: [Webhooks] summary: Inbound GitHub webhook receiver for one organization description: | Per-organization variant of POST /api/v1/webhooks/github. The signature must verify against that organization's GitHub webhook secret; 503 when the organization has none. Otherwise identical. security: [] parameters: - { name: orgID, in: path, required: true, schema: { type: string, format: uuid } } - { name: X-GitHub-Event, in: header, required: true, schema: { type: string } } - { name: X-Hub-Signature-256, in: header, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } responses: '200': description: Received content: application/json: schema: type: object properties: status: { type: string, enum: [received] } '400': { description: Unreadable body or missing X-GitHub-Event } '401': { description: Invalid signature } '503': { description: No webhook secret configured for the organization } /webhooks/jira/{orgID}: post: tags: [Webhooks] summary: Inbound Jira webhook receiver for one organization description: | The URL the organization's Connectors tab shows for Jira. Same contract as POST /api/v1/webhooks/jira, verified against that organization's Jira webhook secret (503 when it has none). security: [] parameters: - { name: orgID, in: path, required: true, schema: { type: string, format: uuid } } - { name: X-Hub-Signature, in: header, schema: { type: string } } - { name: X-Atlassian-Signature, in: header, schema: { type: string } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } responses: '200': description: Received or ignored content: application/json: schema: type: object properties: status: { type: string, enum: [received, ignored] } '400': { description: Unreadable or unparseable body } '401': { description: Invalid signature } '413': { description: "Body over 25 MiB, Jira's own payload limit" } '503': { description: No webhook secret configured for the organization } /webhooks/slack/{orgID}: post: tags: [Webhooks] summary: Inbound Slack events receiver for one organization description: | The events and slash-command URL the organization's Connectors tab shows for Slack. Same contract as POST /api/v1/webhooks/slack, verified against that organization's signing secret (503 when it has none). security: [] parameters: - { name: orgID, in: path, required: true, schema: { type: string, format: uuid } } - { name: X-Slack-Signature, in: header, required: true, schema: { type: string } } - { name: X-Slack-Request-Timestamp, in: header, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true } application/x-www-form-urlencoded: schema: type: object required: [command] properties: command: { type: string } text: { type: string } team_id: { type: string } channel_id: { type: string } user_id: { type: string } trigger_id: { type: string } responses: '200': description: 'Events: accepted (empty body), or the url_verification challenge as text/plain. Slash commands: the ephemeral answer.' content: text/plain: schema: { type: string } application/json: schema: type: object properties: response_type: { type: string, enum: [ephemeral] } text: { type: string } '400': { description: 'Unreadable or unparseable body, or a form without a command' } '401': { description: Invalid or stale signature } '503': { description: No signing secret configured for the organization } /webhooks/slack/{orgID}/interactions: post: tags: [Webhooks] summary: Inbound Slack interactivity receiver for one organization description: Per-organization variant of POST /api/v1/webhooks/slack/interactions, verified against that organization's signing secret (503 when it has none). security: [] parameters: - { name: orgID, in: path, required: true, schema: { type: string, format: uuid } } - { name: X-Slack-Signature, in: header, required: true, schema: { type: string } } - { name: X-Slack-Request-Timestamp, in: header, required: true, schema: { type: string } } requestBody: required: true content: application/x-www-form-urlencoded: schema: type: object required: [payload] properties: payload: { type: string, description: JSON interaction payload } responses: '200': { description: Acknowledged (empty body); the payload is not acted on } '400': { description: Unreadable body } '401': { description: Invalid or stale signature } '503': { description: No signing secret configured for the organization } /repos/{owner}/{repo}/branches: get: tags: [Git] summary: List GitHub branches (proxy) description: | The GitHub proxies use the organization's GitHub credential (App installation token, OAuth device-flow token, or PAT), sit behind the full API auth chain, and answer errors as plain text. Personal API tokens need full access. Every GitHub proxy call must name the repository of a GitHub project of the caller's organization (the project's repository URL is `https://github.com//`). The caller needs viewer access to that project for reads and editor access for writes. Otherwise the call answers 404 (no such project, or no access to it) or 403 (read-only access to a write) before GitHub is called. Sandbox tokens and project-bound personal API tokens reach only their own project's repository. parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } responses: '200': description: Branches content: application/json: schema: type: object properties: owner: { type: string } repo: { type: string } branches: type: array items: type: object properties: name: { type: string } sha: { type: string } count: { type: integer } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } post: tags: [Git] summary: Create a GitHub branch (proxy) description: Creates `branch_name` from `base_branch` (default main). parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/GitProxyBranchRequest' } responses: '201': description: Created content: application/json: schema: type: object properties: status: { type: string, enum: [created] } owner: { type: string } repo: { type: string } branch_name: { type: string } base_branch: { type: string } '400': { description: Invalid body or branch_name missing } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer access to the project, or viewer role' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } /repos/{owner}/{repo}/commits: get: tags: [Git] summary: List GitHub commits (proxy) description: The 30 most recent commits of `sha` if given, else `branch`, else the default branch. parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: branch, in: query, schema: { type: string } } - { name: sha, in: query, schema: { type: string } } responses: '200': description: Commits content: application/json: schema: type: object properties: owner: { type: string } repo: { type: string } branch: { type: string } sha: { type: string } commits: type: array items: type: object properties: sha: { type: string } message: { type: string } author: { type: string } date: { type: string } url: { type: string } count: { type: integer } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } /repos/{owner}/{repo}/pulls: get: tags: [Git] summary: List GitHub pull requests (proxy) parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: state, in: query, schema: { type: string, default: open } } responses: '200': description: Pull requests content: application/json: schema: { $ref: '#/components/schemas/GitProxyPullList' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } post: tags: [Git] summary: Create a GitHub pull request (proxy) description: '`head` and `title` are required. Pull requests into main or master are refused with 403, and `base` defaults to main, so pass another base branch.' parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object required: [head, title] properties: head: { type: string } base: { type: string, default: main } title: { type: string } body: { type: string } draft: { type: boolean } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/GitProxyPullCreated' } '400': { description: 'Invalid body, head or title missing' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Base is main or master, viewer access to the project, or viewer role' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } /repos/{owner}/{repo}/pulls/{number}: patch: tags: [Git] summary: Update a GitHub pull request (proxy) description: Sends the non-empty `title`, `body` and `state` fields to GitHub. parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: number, in: path, required: true, schema: { type: integer, minimum: 1 } } requestBody: required: true content: application/json: schema: type: object properties: title: { type: string } body: { type: string } state: { type: string, description: 'GitHub state, for example open or closed' } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/GitProxyPullUpdated' } '400': { description: Invalid body or pull request number } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer access to the project, or viewer role' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } /repos/{owner}/{repo}/pulls/{number}/comments: post: tags: [Git] summary: Comment on a GitHub pull request (proxy) parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: number, in: path, required: true, schema: { type: integer, minimum: 1 } } requestBody: required: true content: application/json: schema: type: object required: [body] properties: body: { type: string } responses: '201': description: Comment posted content: application/json: schema: type: object properties: status: { type: string, enum: [created] } owner: { type: string } repo: { type: string } pr_number: { type: integer } body: { type: string } '400': { description: 'Invalid body, comment body missing, or bad pull request number' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer access to the project, or viewer role' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } /repos/{owner}/{repo}/tree: get: tags: [Git] summary: Read a GitHub repo tree (proxy) description: The recursive file tree at `ref` (default main). parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: ref, in: query, schema: { type: string, default: main } } responses: '200': description: Tree content: application/json: schema: type: object properties: owner: { type: string } repo: { type: string } ref: { type: string } tree: type: array items: type: object properties: path: { type: string } type: { type: string } sha: { type: string } size: { type: integer } count: { type: integer } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the repository of a GitHub project you can access' } '500': { description: GitHub request failed } /gitlab/{path}: get: tags: [Git] summary: Read from a GitLab project (proxy) description: | One catch-all route for the GitLab proxy, because project paths contain slashes. `path` is the project path followed by an action, with literal slashes, for example `/api/v1/gitlab/group/subgroup/project/branches`. The proxy uses the organization's GitLab connector token and base URL, answers errors as plain text, and returns 404 `not found` for any other method and action combination. Personal API tokens need full access. Every GitLab proxy call must name the GitLab project behind a GitLab project of the caller's organization: the project's repository URL is the connector's base URL (host, port and path) followed by exactly the project path, in any case. The project path needs a namespace (`group/project`), since GitLab reads a lone number as a project id. The caller needs viewer access to that project for reads and editor access for writes. Otherwise the call answers 404 (no such project, or no access to it) or 403 (read-only access to a write) before GitLab is called. Sandbox tokens and project-bound personal API tokens reach only their own project's GitLab project. GET actions: - `/branches`: `{project, branches: [{name}], count}`. - `/commits?ref=` (ref default main): the 30 most recent commits, `{project, ref, commits: [{sha, message, author, date}], count}`. - `/merge-requests?state=` (default `opened`): `{project, state, mrs: [{iid, title, state, url, source_branch, target_branch}], count}`. - `/tree?ref=` (default main): recursive tree, `{project, ref, tree: [{path, type, sha}], count}`. - `/merge-requests/{iid}`: reads one merge request, `{project, mr_iid, title, description, state, url, source_branch, target_branch}`. A GET never updates or merges it, whatever the body says. parameters: - { name: path, in: path, required: true, schema: { type: string }, description: 'Project path plus action, slashes unencoded (for example group/project/branches)' } - { name: ref, in: query, schema: { type: string, default: main }, description: For commits and tree } - { name: state, in: query, schema: { type: string, default: opened }, description: For merge-requests } responses: '200': description: Action result (shape per action, see description) content: application/json: schema: { type: object, additionalProperties: true } '400': { description: 'Project path missing, unsafe or without a namespace, or a merge-request iid that is not a positive integer' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Unknown action for this method, or not the GitLab project of a project you can access' } '500': { description: GitLab request failed } post: tags: [Git] summary: Write to a GitLab project (proxy) description: | POST actions on the catch-all GitLab route (`path` as for GET): - `/branches`: body `{branch_name, base_branch}`. `branch_name` must start with `crios/`; neither it nor `base_branch` (default main) may be main, master, develop or release (403). Returns 201 `{status: created, project, branch_name, base_branch}`. - `/merge-requests`: body `{source_branch, target_branch, title, description}`; `source_branch` and `title` required. Merge requests into main or master are refused (403), and `target_branch` defaults to main, so pass another target. Returns 201 `{status: created, project, mr_iid, mr_url, title}`. - `/merge-requests/{iid}`: same as PATCH. parameters: - { name: path, in: path, required: true, schema: { type: string }, description: 'Project path plus action, slashes unencoded' } requestBody: required: true content: application/json: schema: { type: object, additionalProperties: true, description: Action-specific body (see description) } responses: '200': description: Merge request merged or updated (merge-requests/{iid}) content: application/json: schema: { type: object, additionalProperties: true } '201': description: Branch or merge request created content: application/json: schema: { type: object, additionalProperties: true } '400': { description: 'Invalid body, missing required field, unsafe path, or a project path without a namespace' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Protected branch rule refused the request, viewer access to the project, or viewer role' } '404': { description: 'Unknown action for this method, or not the GitLab project of a project you can access' } '500': { description: GitLab request failed } patch: tags: [Git] summary: Update a GitLab merge request (proxy) description: | `path` is `/merge-requests/{iid}`. `state: merged` merges the merge request and returns `{status: merged, project, mr_iid}`. Otherwise the non-empty `title` and `description` are applied and `state: closed` closes it; the response is `{status: updated, project, mr_iid, title, description, state}`. Any other `state` is a 400. Other paths answer 404. parameters: - { name: path, in: path, required: true, schema: { type: string }, description: '/merge-requests/, slashes unencoded' } requestBody: required: true content: application/json: schema: type: object properties: title: { type: string } description: { type: string } state: { type: string, enum: [merged, closed] } responses: '200': description: Merged or updated content: application/json: schema: { type: object, additionalProperties: true } '400': { description: 'Invalid body, missing, unsafe or namespace-less project path, missing iid, or unsupported state' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer access to the project, viewer role, or an agent merging' } '404': { description: 'Not a merge-request path, or not the GitLab project of a project you can access' } '500': { description: GitLab request failed } /gitea/{owner}/{repo}/branches: get: tags: [Git] summary: List Gitea branches (proxy) description: | Branch names and each branch's head commit `sha`. The Gitea proxies authenticate to Gitea with the deployment's Gitea admin credentials, sit behind the full API auth chain, and answer errors as plain text. Personal API tokens need full access. Every Gitea proxy call must name the built-in repository Crios created for a project of the caller's organization (its name ends in the project's short id; a project's repository URL alone does not count, and imported repositories are refused). The caller needs viewer access to that project for reads and editor access for writes. Otherwise the call answers 404 (no such project, or no access to it) or 403 (read-only access to a write) before Gitea is called. Sandbox tokens and project-bound personal API tokens reach only their own project's repository. parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } responses: '200': description: Branches content: application/json: schema: type: object properties: owner: { type: string } repo: { type: string } branches: type: array items: type: object properties: name: { type: string } sha: { type: string } count: { type: integer } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the built-in repository of a project you can access' } '500': { description: Gitea request failed } post: tags: [Git] summary: Create a Gitea branch (proxy) description: Creates `branch_name` from `base_branch` (default main); 400 when the base branch does not exist. parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: { $ref: '#/components/schemas/GitProxyBranchRequest' } responses: '201': description: Created content: application/json: schema: type: object properties: status: { type: string, enum: [created] } owner: { type: string } repo: { type: string } branch_name: { type: string } base_branch: { type: string } '400': { description: 'Invalid body, branch_name missing, or base branch not found' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer access to the project, or viewer role' } '404': { description: 'Not the built-in repository of a project you can access' } '500': { description: Gitea request failed } /gitea/{owner}/{repo}/commits: get: tags: [Git] summary: List Gitea commits (proxy) parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: branch, in: query, schema: { type: string, default: main } } responses: '200': description: Commits content: application/json: schema: type: object properties: owner: { type: string } repo: { type: string } branch: { type: string } commits: type: array items: type: object properties: sha: { type: string } message: { type: string } author: { type: string, description: Author login; empty when unknown } date: { type: string } count: { type: integer } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the built-in repository of a project you can access' } '500': { description: Gitea request failed } /gitea/{owner}/{repo}/pulls: get: tags: [Git] summary: List Gitea pull requests (proxy) parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: state, in: query, schema: { type: string, default: open } } responses: '200': description: Pull requests content: application/json: schema: { $ref: '#/components/schemas/GitProxyPullList' } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the built-in repository of a project you can access' } '500': { description: Gitea request failed } post: tags: [Git] summary: Create a Gitea pull request (proxy) description: '`head` and `title` are required. Pull requests into main or master are refused with 403, and `base` defaults to main, so pass another base branch.' parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } requestBody: required: true content: application/json: schema: type: object required: [head, title] properties: head: { type: string } base: { type: string, default: main } title: { type: string } body: { type: string } responses: '201': description: Created content: application/json: schema: { $ref: '#/components/schemas/GitProxyPullCreated' } '400': { description: 'Invalid body, head or title missing' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Base is main or master, viewer access to the project, or viewer role' } '404': { description: 'Not the built-in repository of a project you can access' } '500': { description: Gitea request failed } /gitea/{owner}/{repo}/pulls/{number}: patch: tags: [Git] summary: Update a Gitea pull request (proxy) parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: number, in: path, required: true, schema: { type: integer, minimum: 1 } } requestBody: required: true content: application/json: schema: type: object properties: title: { type: string } body: { type: string } state: { type: string, enum: [open, closed] } responses: '200': description: Updated content: application/json: schema: { $ref: '#/components/schemas/GitProxyPullUpdated' } '400': { description: 'Invalid body or number, or unsupported state' } '401': { $ref: '#/components/responses/Unauthorized' } '403': { description: 'Viewer access to the project, or viewer role' } '404': { description: 'Not the built-in repository of a project you can access' } '500': { description: Gitea request failed } /gitea/{owner}/{repo}/tree: get: tags: [Git] summary: Read a Gitea repo tree (proxy) parameters: - { name: owner, in: path, required: true, schema: { type: string } } - { name: repo, in: path, required: true, schema: { type: string } } - { name: ref, in: query, schema: { type: string, default: main } } responses: '200': description: Tree content: application/json: schema: type: object properties: owner: { type: string } repo: { type: string } ref: { type: string } tree: type: array items: type: object properties: path: { type: string } type: { type: string } sha: { type: string } count: { type: integer } '401': { $ref: '#/components/responses/Unauthorized' } '404': { description: 'Not the built-in repository of a project you can access' } '500': { description: Gitea request failed } # ==================== AUTHENTICATED / BACK-COMPAT TWINS OF ROOT ROUTES ==================== /api/v1/healthz: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Health] summary: Liveness probe (authenticated twin) description: Same handler and body as the public GET /healthz, but behind the API auth middleware, so it answers 401 without a valid bearer token. Any valid token passes, whatever its personal-API-token scopes. responses: '200': description: Alive content: application/json: schema: type: object properties: status: { type: string, enum: [ok] } '401': { $ref: '#/components/responses/Unauthorized' } /api/v1/readyz: servers: - url: https://api.crios.ai - url: http://localhost:8080 get: tags: [Health] summary: Readiness probe (authenticated twin) description: Same handler as the public GET /readyz (pings the control-plane database), behind the API auth middleware; 401 without a valid bearer token. responses: '200': description: Ready content: application/json: schema: type: object properties: status: { type: string, enum: [ready] } '401': { $ref: '#/components/responses/Unauthorized' } '503': { description: Database unreachable } /api/v1/auth/refresh: servers: - url: https://api.crios.ai - url: http://localhost:8080 post: tags: [Auth] summary: Exchange a refresh token (back-compat path) description: Same handler and per-IP limiter as POST /auth/refresh. Registered on the root router, so it is public (no bearer token). security: [] requestBody: required: true content: application/json: schema: type: object required: [refresh_token] properties: refresh_token: { type: string } responses: '200': description: New tokens content: application/json: schema: { $ref: '#/components/schemas/TokenPair' } '400': { $ref: '#/components/responses/BadRequest' } '401': { description: 'Invalid, expired or revoked refresh token' } '403': { description: Account or organization suspended } '429': { description: Per-IP rate limit exceeded }