openapi: "3.0.3" info: title: Agent Platform API description: | Agent Platform Product Experience API - A multi-agent platform for task orchestration and execution with LLM providers, background task processing, workflows, triggers, and connectors. ## Response Envelope All endpoints use a standard API response envelope: - Success: `{ ok: true, data: ..., requestId: "..." }` - Error: `{ ok: false, error: { code: "...", message: "..." }, requestId: "..." }` ## Authentication Schemes The API supports three authentication methods: | Scheme | Description | Use Case | |--------|-------------|----------| | **Cookie Session** | Session cookie (`agent-platform-session`) set after login | Web UI users | | **API Key** | Header `X-API-Key: ak_` with `ak_` prefix | Service-to-service, CLI tools | | **Bearer Token** | Header `Authorization: Bearer ` | OIDC integration | ## Pagination List endpoints support cursor-based pagination: - `limit`: Maximum items per page (default: 50, max: 100) - `offset`: Number of items to skip - Response includes `hasMore` boolean for pagination continuation ## Rate Limiting Rate limit headers are returned on all requests: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets SSE endpoints (e.g., `/runs/stream`, `/timeline/stream`) are exempt from rate limiting. ## Error Codes Standard error codes include: - `BAD_REQUEST` (400) - Invalid request body or parameters - `UNAUTHORIZED` (401) - Authentication required - `FORBIDDEN` (403) - Access denied - `NOT_FOUND` (404) - Resource not found - `CONFLICT` (409) - Resource conflict - `INTERNAL_ERROR` (500) - Unexpected server error - `SERVICE_UNAVAILABLE` (503) - Feature not configured ## Deprecation Policy API versioning follows semantic versioning. Breaking changes result in a new API version prefix. See: https://example.com/deprecation-policy version: "0.8.0-ga-candidate" contact: name: Agent Platform Team servers: - url: http://localhost:3003 description: Development - url: http://localhost:3103 description: E2E Testing tags: - name: Auth & Setup description: Authentication and initial setup endpoints - name: Organizations description: Multi-tenancy organization and membership management - name: RBAC description: Role-based access control, API keys, and permissions management - name: Sessions description: Session management and messaging - name: Agents & Providers description: Agent configuration and LLM provider management - name: Workflows description: Workflow definition and execution - name: Triggers description: Schedule and webhook triggers - name: Approvals description: Approval request management - name: Memory description: Long-term memory management - name: Observability description: Run execution visibility, console views, and replay previews - name: Connectors description: Connector definition, instance management, and OAuth integration - name: Files description: Session file uploads and attachments - name: System description: Health, status, usage, logs, and system configuration paths: # ========================================================================== # Auth & Setup # ========================================================================== /api/v1/setup/status: get: tags: [Auth & Setup] summary: Get setup status description: Returns whether initial setup is required operationId: getSetupStatus responses: "200": description: Setup status content: application/json: schema: $ref: "#/components/schemas/SetupStatusResponse" /api/v1/setup/user: post: tags: [Auth & Setup] summary: Create initial user description: Creates the first user and logs them in (only allowed when no users exist) operationId: createInitialUser requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateUserRequest" responses: "201": description: User created and logged in content: application/json: schema: $ref: "#/components/schemas/AuthSuccessResponse" "409": $ref: "#/components/responses/Conflict" /api/v1/auth/login: post: tags: [Auth & Setup] summary: Login description: Authenticate with username and password operationId: login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginRequest" responses: "200": description: Login successful content: application/json: schema: $ref: "#/components/schemas/AuthSuccessResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/auth/logout: post: tags: [Auth & Setup] summary: Logout description: End the current session operationId: logout security: - sessionAuth: [] responses: "200": description: Logout successful content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /api/v1/auth/me: get: tags: [Auth & Setup] summary: Get current user description: Returns the currently authenticated user operationId: getCurrentUser security: - sessionAuth: [] responses: "200": description: Current user info content: application/json: schema: $ref: "#/components/schemas/AuthSuccessResponse" "401": $ref: "#/components/responses/Unauthorized" # ========================================================================== # Organizations (Multi-tenancy) # ========================================================================== /api/v1/organizations: get: tags: [Organizations] summary: List organizations description: Returns organizations the current user belongs to (or all for admins) operationId: listOrganizations security: - sessionAuth: [] responses: "200": description: List of organizations content: application/json: schema: $ref: "#/components/schemas/OrganizationListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Organizations] summary: Create organization description: Creates a new organization operationId: createOrganization security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOrganizationRequest" responses: "201": description: Organization created content: application/json: schema: $ref: "#/components/schemas/OrganizationResponse" "401": $ref: "#/components/responses/Unauthorized" "409": $ref: "#/components/responses/Conflict" /api/v1/organizations/{orgId}: get: tags: [Organizations] summary: Get organization description: Returns organization details operationId: getOrganization security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/orgId" responses: "200": description: Organization details content: application/json: schema: $ref: "#/components/schemas/OrganizationResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" patch: tags: [Organizations] summary: Update organization description: Updates organization name or slug operationId: updateOrganization security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/orgId" requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateOrganizationRequest" responses: "200": description: Organization updated content: application/json: schema: $ref: "#/components/schemas/OrganizationResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "409": $ref: "#/components/responses/Conflict" delete: tags: [Organizations] summary: Delete organization description: Deletes an organization (cannot delete default org) operationId: deleteOrganization security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/orgId" responses: "200": description: Organization deleted content: application/json: schema: $ref: "#/components/schemas/DeleteOrganizationResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/organizations/{orgId}/members: get: tags: [Organizations] summary: List organization members description: Returns all members of an organization operationId: listOrganizationMembers security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/orgId" responses: "200": description: List of members content: application/json: schema: $ref: "#/components/schemas/OrganizationMemberListResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" post: tags: [Organizations] summary: Add member to organization description: Adds a user to the organization with specified role operationId: addOrganizationMember security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/orgId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/AddOrganizationMemberRequest" responses: "201": description: Member added content: application/json: schema: $ref: "#/components/schemas/OrganizationMembershipResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/organizations/{orgId}/members/{userId}: delete: tags: [Organizations] summary: Remove member from organization description: Removes a user from the organization operationId: removeOrganizationMember security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/orgId" - name: userId in: path required: true schema: type: string responses: "200": description: Member removed content: application/json: schema: $ref: "#/components/schemas/RemoveMemberResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/organizations/{orgId}/members/{userId}/role: patch: tags: [Organizations] summary: Update member role description: Updates a member's role in the organization operationId: updateOrganizationMemberRole security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/orgId" - name: userId in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateMemberRoleRequest" responses: "200": description: Role updated content: application/json: schema: $ref: "#/components/schemas/UpdateMemberRoleResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # RBAC - API Keys # ========================================================================== /api/v1/api-keys: get: tags: [RBAC] summary: List API keys description: Returns all API keys for the current user operationId: listApiKeys security: - sessionAuth: [] responses: "200": description: List of API keys content: application/json: schema: $ref: "#/components/schemas/ApiKeyListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [RBAC] summary: Create API key description: Creates a new API key for programmatic access operationId: createApiKey security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateApiKeyRequest" responses: "201": description: API key created content: application/json: schema: $ref: "#/components/schemas/CreateApiKeyResponse" "401": $ref: "#/components/responses/Unauthorized" "400": $ref: "#/components/responses/BadRequest" /api/v1/api-keys/{id}: delete: tags: [RBAC] summary: Revoke API key description: Revokes (deletes) an API key operationId: revokeApiKey security: - sessionAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: API key revoked content: application/json: schema: $ref: "#/components/schemas/RevokeApiKeyResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Sessions # ========================================================================== /api/v1/sessions: get: tags: [Sessions] summary: List sessions description: Returns paginated list of sessions for the current user operationId: listSessions security: - sessionAuth: [] parameters: - name: status in: query schema: type: string enum: [active, archived, closed] - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: List of sessions content: application/json: schema: $ref: "#/components/schemas/SessionListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Sessions] summary: Create session description: Creates a new session operationId: createSession security: - sessionAuth: [] responses: "201": description: Session created content: application/json: schema: $ref: "#/components/schemas/SessionResponse" /api/v1/sessions/{sessionId}: get: tags: [Sessions] summary: Get session description: Returns session details operationId: getSession security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" responses: "200": description: Session details content: application/json: schema: $ref: "#/components/schemas/SessionResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" patch: tags: [Sessions] summary: Update session description: Updates session title or status operationId: updateSession security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" requestBody: content: application/json: schema: $ref: "#/components/schemas/PatchSessionRequest" responses: "200": description: Session updated content: application/json: schema: $ref: "#/components/schemas/SessionResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/messages: post: tags: [Sessions] summary: Send message description: Sends a message to the session (processed asynchronously) operationId: sendMessage security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendMessageRequest" responses: "202": description: Message accepted for processing content: application/json: schema: $ref: "#/components/schemas/SendMessageResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/transcripts: get: tags: [Sessions] summary: Get transcripts description: Returns all transcripts for a session operationId: getTranscripts security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" responses: "200": description: Session transcripts content: application/json: schema: $ref: "#/components/schemas/TranscriptsResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/resume: post: tags: [Sessions] summary: Resume session description: Resumes a session and returns recent timeline operationId: resumeSession security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" responses: "200": description: Session resumed content: application/json: schema: $ref: "#/components/schemas/SessionResumeResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/children: get: tags: [Sessions] summary: List child sessions description: Lists internal subagent child sessions of an accessible parent session (uniform 404 when the parent is missing or foreign) operationId: listChildSessions security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 - name: status in: query schema: type: string description: Optional status filter (active/archived/closed) responses: "200": description: Child sessions content: application/json: schema: $ref: "#/components/schemas/SessionListResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/children/{childSessionId}/resume: post: tags: [Sessions] summary: Resume child task description: Touches the child session activity and returns its recent timeline (uniform 404 for missing/foreign parent or child) operationId: resumeChildSession security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" - name: childSessionId in: path required: true schema: type: string responses: "200": description: Child session resumed content: application/json: schema: $ref: "#/components/schemas/SessionResumeResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/children/{childSessionId}/cancel: post: tags: [Sessions] summary: Cancel child task description: Cancels the live child kernel run of a child session (uniform 404 for missing/foreign parent or child) operationId: cancelChildSession security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" - name: childSessionId in: path required: true schema: type: string responses: "200": description: Child task cancelled content: application/json: schema: $ref: "#/components/schemas/ApiEnvelope" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/timeline: get: tags: [Sessions] summary: Get timeline description: Returns paginated timeline events for a session operationId: getTimeline security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 - name: eventTypes in: query schema: type: string description: Comma-separated list of event types to filter responses: "200": description: Timeline events content: application/json: schema: $ref: "#/components/schemas/TimelineResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/timeline/stream: get: tags: [Sessions] summary: Stream timeline (SSE) description: Server-Sent Events endpoint for real-time timeline updates operationId: streamTimeline security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" - name: after in: query schema: type: string description: Event ID to resume from responses: "200": description: SSE stream content: text/event-stream: schema: type: string /api/v1/sessions/{sessionId}/model: patch: tags: [Sessions] summary: Set session model description: Sets the model and provider for a session operationId: setSessionModel security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SetModelRequest" responses: "200": description: Model set successfully content: application/json: schema: $ref: "#/components/schemas/SessionResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/sessions/{sessionId}/usage: get: tags: [Sessions] summary: Get session usage description: Returns usage statistics for a session operationId: getSessionUsage security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" responses: "200": description: Usage summary content: application/json: schema: $ref: "#/components/schemas/UsageSummaryResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Files (Session Attachments) # ========================================================================== /api/v1/sessions/{sessionId}/files: post: tags: [Files] summary: Upload file description: | Uploads a file attachment to a session using multipart/form-data. The file is validated against allowed MIME types and extensions, then stored on the local filesystem with metadata persisted in the database. **Constraints:** - Maximum file size: configurable via `UPLOAD_MAX_FILE_SIZE_BYTES` (default 10 MiB) - Allowed MIME types: configurable via `UPLOAD_ALLOWED_MIME_TYPES` - Allowed extensions: configurable via `UPLOAD_ALLOWED_EXTENSIONS` - Maximum attachments per message: configurable via `UPLOAD_MAX_ATTACHMENTS_PER_MESSAGE` (default 5) operationId: uploadFile security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" requestBody: required: true content: multipart/form-data: schema: type: object required: [file] properties: file: type: string format: binary description: The file to upload responses: "201": description: File uploaded successfully content: application/json: schema: $ref: "#/components/schemas/FileUploadResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" "413": description: File too large content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" "415": description: Unsupported media type (MIME or extension not allowed) content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" get: tags: [Files] summary: List session files description: Returns all file attachments for a session (excludes soft-deleted files) operationId: listSessionFiles security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" responses: "200": description: List of files content: application/json: schema: $ref: "#/components/schemas/FileListResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/files/{fileId}: get: tags: [Files] summary: Get file metadata description: Returns metadata for a specific file attachment operationId: getFileMetadata security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/fileId" responses: "200": description: File metadata content: application/json: schema: $ref: "#/components/schemas/FileUploadResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" delete: tags: [Files] summary: Delete file description: Soft-deletes a file attachment (sets status to 'deleted') operationId: deleteFile security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/fileId" responses: "200": description: File deleted content: application/json: schema: $ref: "#/components/schemas/FileDeleteResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/files/{fileId}/download: get: tags: [Files] summary: Download file description: Downloads the raw bytes of a file attachment operationId: downloadFile security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/fileId" responses: "200": description: File content content: application/octet-stream: schema: type: string format: binary "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Agents & Providers # ========================================================================== /api/v1/agents/{agentId}/config: get: tags: [Agents & Providers] summary: Get agent config description: Returns global, user override, and effective config for an agent operationId: getAgentConfig security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/agentId" responses: "200": description: Agent configuration content: application/json: schema: $ref: "#/components/schemas/AgentConfigResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/agents/{agentId}/config/global: patch: tags: [Agents & Providers] summary: Update global agent config description: Updates the global default configuration (admin only) operationId: updateGlobalAgentConfig security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/agentId" requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateAgentConfigRequest" responses: "200": description: Config updated content: application/json: schema: $ref: "#/components/schemas/AgentConfig" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" /api/v1/agents/{agentId}/config/override: patch: tags: [Agents & Providers] summary: Update user override config description: Updates the user-specific override configuration operationId: updateUserOverrideConfig security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/agentId" requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateOverrideConfigRequest" responses: "200": description: Override updated content: application/json: schema: $ref: "#/components/schemas/AgentConfig" "401": $ref: "#/components/responses/Unauthorized" delete: tags: [Agents & Providers] summary: Delete user override config description: Resets user override to global defaults operationId: deleteUserOverrideConfig security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/agentId" responses: "204": description: Override deleted "401": $ref: "#/components/responses/Unauthorized" /api/v1/providers: get: tags: [Agents & Providers] summary: List providers description: Returns all configured providers for the current user operationId: listProviders security: - sessionAuth: [] responses: "200": description: List of providers content: application/json: schema: $ref: "#/components/schemas/ProviderListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Agents & Providers] summary: Create provider description: Creates a new provider configuration operationId: createProvider security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateProviderRequest" responses: "201": description: Provider created content: application/json: schema: $ref: "#/components/schemas/ProviderSummary" "401": $ref: "#/components/responses/Unauthorized" "400": $ref: "#/components/responses/BadRequest" /api/v1/providers/{providerId}: patch: tags: [Agents & Providers] summary: Update provider description: Updates a provider configuration operationId: updateProvider security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/providerId" requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateProviderRequest" responses: "200": description: Provider updated content: application/json: schema: $ref: "#/components/schemas/ProviderSummary" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" delete: tags: [Agents & Providers] summary: Delete provider description: Deletes a provider configuration operationId: deleteProvider security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/providerId" responses: "204": description: Provider deleted "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" /api/v1/providers/{providerId}/test: post: tags: [Agents & Providers] summary: Test provider connection description: Tests the provider connection operationId: testProvider security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/providerId" responses: "200": description: Test result content: application/json: schema: $ref: "#/components/schemas/TestProviderResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/models: get: tags: [Agents & Providers] summary: List models and providers description: Returns available providers and optionally session's selected model operationId: listModels security: - sessionAuth: [] parameters: - name: sessionId in: query schema: type: string responses: "200": description: Models and providers content: application/json: schema: $ref: "#/components/schemas/ModelsResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/tools: get: tags: [Agents & Providers] summary: List tools description: Returns available tool catalog operationId: listTools responses: "200": description: Tool catalog content: application/json: schema: $ref: "#/components/schemas/ToolsResponse" /api/v1/tool-results/{resultId}: get: tags: [Agents & Providers] summary: Get tool result description: Returns a stored tool result by ID operationId: getToolResult security: - sessionAuth: [] parameters: - name: resultId in: path required: true schema: type: string responses: "200": description: Tool result content: application/json: schema: $ref: "#/components/schemas/ToolResultResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Skills (Read-only catalog) # ========================================================================== /api/v1/skills: get: tags: [Agents & Providers] summary: List skills description: | Returns the read-only skill catalog from the registry. Skills are documentation-only records — metadata plus lazily-loaded markdown. No POST/PATCH/DELETE mutation or run endpoints exist. operationId: listSkills security: - sessionAuth: [] responses: "200": description: Skill catalog content: application/json: schema: $ref: "#/components/schemas/SkillsResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/skills/{skillId}: get: tags: [Agents & Providers] summary: Get skill detail description: | Returns read-only detail for a single skill from the registry. Includes allowedAgentTypes, defaultAgentProfiles, summary, and tags. operationId: getSkill security: - sessionAuth: [] parameters: - name: skillId in: path required: true schema: type: string responses: "200": description: Skill detail content: application/json: schema: $ref: "#/components/schemas/SkillDetailResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Workflows # ========================================================================== /api/v1/workflows/drafts: get: tags: [Workflows] summary: List workflow drafts description: Returns all workflow drafts for the current user operationId: listWorkflowDrafts security: - sessionAuth: [] responses: "200": description: List of drafts content: application/json: schema: $ref: "#/components/schemas/DraftListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Workflows] summary: Create workflow draft description: Creates a new workflow draft operationId: createWorkflowDraft security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateDraftRequest" responses: "201": description: Draft created content: application/json: schema: $ref: "#/components/schemas/DraftResponse" "401": $ref: "#/components/responses/Unauthorized" "400": $ref: "#/components/responses/BadRequest" /api/v1/workflows/drafts/{draftId}: get: tags: [Workflows] summary: Get workflow draft description: Returns a specific workflow draft operationId: getWorkflowDraft security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/draftId" responses: "200": description: Draft details content: application/json: schema: $ref: "#/components/schemas/DraftResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" patch: tags: [Workflows] summary: Update workflow draft description: Updates a workflow draft operationId: updateWorkflowDraft security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/draftId" requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateDraftRequest" responses: "200": description: Draft updated content: application/json: schema: $ref: "#/components/schemas/DraftResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" delete: tags: [Workflows] summary: Delete workflow draft description: Deletes a workflow draft operationId: deleteWorkflowDraft security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/draftId" responses: "204": description: Draft deleted "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/workflows/drafts/{draftId}/validate: post: tags: [Workflows] summary: Validate workflow draft description: Validates a workflow draft and returns issues operationId: validateWorkflowDraft security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/draftId" responses: "200": description: Validation result content: application/json: schema: $ref: "#/components/schemas/ValidationResult" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/workflows/drafts/{draftId}/publish: post: tags: [Workflows] summary: Publish workflow draft description: Publishes a draft as a workflow definition operationId: publishWorkflowDraft security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/draftId" responses: "201": description: Workflow published content: application/json: schema: $ref: "#/components/schemas/DefinitionResponse" "401": $ref: "#/components/responses/Unauthorized" "400": $ref: "#/components/responses/BadRequest" "404": $ref: "#/components/responses/NotFound" /api/v1/workflows/definitions: get: tags: [Workflows] summary: List workflow definitions description: Returns all published workflow definitions operationId: listWorkflowDefinitions security: - sessionAuth: [] responses: "200": description: List of definitions content: application/json: schema: $ref: "#/components/schemas/DefinitionListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/workflows/definitions/{workflowId}: get: tags: [Workflows] summary: Get workflow definition description: Returns a specific workflow definition operationId: getWorkflowDefinition security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/workflowId" responses: "200": description: Definition details content: application/json: schema: $ref: "#/components/schemas/DefinitionResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/workflows/runs: get: tags: [Workflows] summary: List workflow runs description: Returns all workflow runs for the current user operationId: listWorkflowRuns security: - sessionAuth: [] responses: "200": description: List of runs content: application/json: schema: $ref: "#/components/schemas/WorkflowRunListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Workflows] summary: Start workflow run description: Starts a new workflow run from a definition operationId: startWorkflowRun security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/StartRunRequest" responses: "201": description: Run started content: application/json: schema: $ref: "#/components/schemas/RunResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/workflows/runs/{workflowRunId}: get: tags: [Workflows] summary: Get workflow run description: Returns details of a specific workflow run operationId: getWorkflowRun security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/workflowRunId" responses: "200": description: Run details content: application/json: schema: $ref: "#/components/schemas/RunResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Triggers # ========================================================================== /api/v1/triggers/schedules: get: tags: [Triggers] summary: List schedule triggers description: Returns all schedule triggers for the current user operationId: listScheduleTriggers security: - sessionAuth: [] responses: "200": description: List of schedules content: application/json: schema: $ref: "#/components/schemas/ScheduleListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Triggers] summary: Create schedule trigger description: Creates a new schedule trigger operationId: createScheduleTrigger security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateScheduleRequest" responses: "201": description: Schedule created content: application/json: schema: $ref: "#/components/schemas/ScheduleTriggerResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/triggers/schedules/{scheduleId}: get: tags: [Triggers] summary: Get schedule trigger description: Returns a specific schedule trigger operationId: getScheduleTrigger security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/scheduleId" responses: "200": description: Schedule details content: application/json: schema: $ref: "#/components/schemas/ScheduleTriggerResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" patch: tags: [Triggers] summary: Update schedule trigger description: Updates a schedule trigger status operationId: updateScheduleTrigger security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/scheduleId" requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateTriggerStatusRequest" responses: "200": description: Schedule updated content: application/json: schema: $ref: "#/components/schemas/ScheduleTriggerResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" delete: tags: [Triggers] summary: Delete schedule trigger description: Deletes a schedule trigger operationId: deleteScheduleTrigger security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/scheduleId" responses: "204": description: Schedule deleted "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/triggers/webhooks: get: tags: [Triggers] summary: List webhook triggers description: Returns all webhook triggers for the current user operationId: listWebhookTriggers security: - sessionAuth: [] responses: "200": description: List of webhooks content: application/json: schema: $ref: "#/components/schemas/WebhookListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [Triggers] summary: Create webhook trigger description: Creates a new webhook trigger operationId: createWebhookTrigger security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateWebhookRequest" responses: "201": description: Webhook created content: application/json: schema: $ref: "#/components/schemas/WebhookTriggerCreatedResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/triggers/webhooks/{webhookId}: get: tags: [Triggers] summary: Get webhook trigger description: Returns a specific webhook trigger operationId: getWebhookTrigger security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/webhookId" responses: "200": description: Webhook details content: application/json: schema: $ref: "#/components/schemas/WebhookTriggerResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" patch: tags: [Triggers] summary: Update webhook trigger description: Updates a webhook trigger status operationId: updateWebhookTrigger security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/webhookId" requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateTriggerStatusRequest" responses: "200": description: Webhook updated content: application/json: schema: $ref: "#/components/schemas/WebhookTriggerResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" delete: tags: [Triggers] summary: Delete webhook trigger description: Deletes a webhook trigger operationId: deleteWebhookTrigger security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/webhookId" responses: "204": description: Webhook deleted "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/webhooks/{webhookId}/deliver: post: tags: [Triggers] summary: Deliver webhook payload description: Receives webhook delivery (authenticated via HMAC signature) operationId: deliverWebhook parameters: - $ref: "#/components/parameters/webhookId" - name: X-Hub-Signature-256 in: header required: true schema: type: string - name: X-Delivery-Id in: header schema: type: string requestBody: content: application/json: schema: type: object responses: "200": description: Webhook accepted content: application/json: schema: $ref: "#/components/schemas/WebhookDeliveryResponse" "401": $ref: "#/components/responses/Unauthorized" "403": $ref: "#/components/responses/Forbidden" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Approvals # ========================================================================== /api/v1/approvals: get: tags: [Approvals] summary: List approvals description: Returns all approvals for the current user operationId: listApprovals security: - sessionAuth: [] responses: "200": description: List of approvals content: application/json: schema: $ref: "#/components/schemas/ApprovalsListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/approvals/{approvalId}: get: tags: [Approvals] summary: Get approval description: Returns a specific approval operationId: getApproval security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/approvalId" responses: "200": description: Approval details content: application/json: schema: $ref: "#/components/schemas/ApprovalDetailResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" patch: tags: [Approvals] summary: Decide on approval description: | Respond to an approval request with one of three choices: - `reject`: Deny the request (no grant created) - `approve_once`: Approve with 60-minute short-TTL grant - `approve_always`: Approve with 24-hour grant Legacy `approved`/`rejected` values are supported for backward compatibility. operationId: decideApproval security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/approvalId" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ApprovalDecisionRequest" responses: "200": description: Decision recorded content: application/json: schema: $ref: "#/components/schemas/ApprovalDecisionResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "409": $ref: "#/components/responses/Conflict" # ========================================================================== # Memory # ========================================================================== /api/v1/memory: get: tags: [Memory] summary: List memories description: Returns memories for the current user with optional search operationId: listMemories security: - sessionAuth: [] parameters: - name: query in: query schema: type: string - name: type in: query schema: type: string enum: [user_profile, user_preference, user_safety_rule, project_state] - name: limit in: query schema: type: integer default: 50 responses: "200": description: List of memories content: application/json: schema: $ref: "#/components/schemas/MemoryListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/memory/{memoryId}: get: tags: [Memory] summary: Get memory description: Returns a specific memory operationId: getMemory security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/memoryId" responses: "200": description: Memory details content: application/json: schema: $ref: "#/components/schemas/MemoryResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" delete: tags: [Memory] summary: Delete memory description: Deletes a specific memory operationId: deleteMemory security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/memoryId" responses: "200": description: Memory deleted content: application/json: schema: $ref: "#/components/schemas/MemoryDeleteResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/memory/debug/extraction-runs: get: tags: [Memory] summary: List extraction runs (debug) description: Returns memory extraction run history operationId: listExtractionRuns security: - sessionAuth: [] parameters: - name: sessionId in: query schema: type: string - name: limit in: query schema: type: integer default: 50 responses: "200": description: List of extraction runs content: application/json: schema: $ref: "#/components/schemas/ExtractionRunListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/memory/debug/extract: post: tags: [Memory] summary: Trigger extraction (debug) description: Manually triggers memory extraction for a turn operationId: triggerExtraction security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DebugExtractRequest" responses: "200": description: Extraction result content: application/json: schema: $ref: "#/components/schemas/ExtractionResult" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # Observability # ========================================================================== /api/v1/observability/runs: get: tags: [Observability] summary: List observable runs description: Lists planner and workflow runs available for inspection operationId: listObservableRuns parameters: - name: status in: query schema: type: string description: Filter by status responses: "200": description: List of runs content: application/json: schema: $ref: "#/components/schemas/RunListResponse" "500": $ref: "#/components/responses/InternalError" /api/v1/observability/runs/{runId}/console: get: tags: [Observability] summary: Get console view description: Returns console view with timeline, audit, and status operationId: getRunConsole parameters: - $ref: "#/components/parameters/runId" responses: "200": description: Console view content: application/json: schema: $ref: "#/components/schemas/ConsoleViewResponse" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalError" /api/v1/observability/runs/{runId}/replay-preview: get: tags: [Observability] summary: Preview replay description: Returns read-only replay preview with safety policy operationId: previewReplay parameters: - $ref: "#/components/parameters/runId" responses: "200": description: Replay preview content: application/json: schema: $ref: "#/components/schemas/ReplayPreviewResponse" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalError" # ========================================================================== # Connectors # ========================================================================== /api/v1/connectors: get: tags: [Connectors] summary: List connectors description: Returns all registered connector definitions operationId: listConnectors security: - sessionAuth: [] responses: "200": description: List of connectors content: application/json: schema: $ref: "#/components/schemas/ConnectorListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/connectors/{id}: get: tags: [Connectors] summary: Get connector description: Returns a specific connector definition operationId: getConnector security: - sessionAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: Connector details content: application/json: schema: $ref: "#/components/schemas/ConnectorDefinition" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/connectors/{id}/instances: get: tags: [Connectors] summary: List connector instances description: Returns instances for a connector definition operationId: listConnectorInstances security: - sessionAuth: [] parameters: - name: id in: path required: true schema: type: string responses: "200": description: List of instances content: application/json: schema: $ref: "#/components/schemas/InstanceListResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/connectors/{id}/instances/{iid}/config: patch: tags: [Connectors] summary: Update instance config description: Updates configuration of a connector instance operationId: updateInstanceConfig security: - sessionAuth: [] parameters: - name: id in: path required: true schema: type: string - name: iid in: path required: true schema: type: string requestBody: content: application/json: schema: $ref: "#/components/schemas/UpdateInstanceConfigRequest" responses: "200": description: Instance updated content: application/json: schema: $ref: "#/components/schemas/ConnectorInstance" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" "500": $ref: "#/components/responses/InternalError" /api/v1/connectors/{type}/oauth/authorize: get: tags: [Connectors] summary: Get OAuth authorization URL description: Generates OAuth authorization URL for connector setup (Google Calendar, Contacts, Docs) operationId: getOAuthAuthorizeUrl security: - sessionAuth: [] parameters: - name: type in: path required: true schema: type: string enum: [calendar, contacts, docs] description: Connector type for OAuth responses: "200": description: Authorization URL generated content: application/json: schema: $ref: "#/components/schemas/OAuthAuthorizeResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "503": description: OAuth not configured content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /api/v1/connectors/{type}/oauth/callback: post: tags: [Connectors] summary: Handle OAuth callback description: Exchanges OAuth authorization code for tokens and creates connector instance operationId: handleOAuthCallback security: - sessionAuth: [] parameters: - name: type in: path required: true schema: type: string enum: [calendar, contacts, docs] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/OAuthCallbackRequest" responses: "200": description: OAuth completed, instance created content: application/json: schema: $ref: "#/components/schemas/OAuthCallbackResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" /api/v1/connectors/{instanceId}/oauth/revoke: post: tags: [Connectors] summary: Revoke OAuth tokens description: Revokes OAuth tokens for a connector instance operationId: revokeOAuthTokens security: - sessionAuth: [] parameters: - name: instanceId in: path required: true schema: type: string responses: "200": description: Tokens revoked content: application/json: schema: $ref: "#/components/schemas/OAuthRevokeResponse" "400": $ref: "#/components/responses/BadRequest" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ========================================================================== # System # ========================================================================== /api/v1/health: get: tags: [System] summary: Health check description: Returns system health status operationId: getHealth responses: "200": description: System health content: application/json: schema: $ref: "#/components/schemas/HealthResponse" /api/v1/health/ready: get: tags: [System] summary: Readiness check description: Returns whether the system is ready to serve requests operationId: getReady responses: "200": description: System ready content: application/json: schema: $ref: "#/components/schemas/ReadyResponse" "503": description: System not ready content: application/json: schema: $ref: "#/components/schemas/ReadyResponse" /api/v1/metrics: get: tags: [System] summary: Prometheus metrics description: Returns metrics in Prometheus exposition format for scraping operationId: getMetrics responses: "200": description: Prometheus metrics content: text/plain: schema: type: string description: Prometheus exposition format text /api/v1/alerts/rules: get: tags: [System] summary: List alert rules description: Returns all configured alert rules operationId: listAlertRules security: - sessionAuth: [] responses: "200": description: List of alert rules content: application/json: schema: $ref: "#/components/schemas/AlertRuleListResponse" "401": $ref: "#/components/responses/Unauthorized" post: tags: [System] summary: Create alert rule description: Creates a new alert rule operationId: createAlertRule security: - sessionAuth: [] requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateAlertRuleRequest" responses: "201": description: Alert rule created content: application/json: schema: $ref: "#/components/schemas/AlertRuleResponse" "401": $ref: "#/components/responses/Unauthorized" "400": $ref: "#/components/responses/BadRequest" /api/v1/alerts/rules/{ruleId}: get: tags: [System] summary: Get alert rule description: Returns a specific alert rule operationId: getAlertRule security: - sessionAuth: [] parameters: - name: ruleId in: path required: true schema: type: string responses: "200": description: Alert rule details content: application/json: schema: $ref: "#/components/schemas/AlertRuleResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" delete: tags: [System] summary: Delete alert rule description: Deletes an alert rule operationId: deleteAlertRule security: - sessionAuth: [] parameters: - name: ruleId in: path required: true schema: type: string responses: "200": description: Alert rule deleted content: application/json: schema: $ref: "#/components/schemas/DeleteAlertRuleResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/alerts/state: get: tags: [System] summary: Get alert states description: Returns current alert states for all rules operationId: getAlertStates security: - sessionAuth: [] responses: "200": description: Alert states content: application/json: schema: $ref: "#/components/schemas/AlertStateListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/alerts/evaluate: post: tags: [System] summary: Evaluate alert rules description: Manually triggers evaluation of all alert rules operationId: evaluateAlerts security: - sessionAuth: [] responses: "200": description: Evaluation completed content: application/json: schema: $ref: "#/components/schemas/AlertEvaluationResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/runs: get: tags: [System] summary: List runs description: Returns list of all runs (planner, background, kernel) operationId: listRuns security: - sessionAuth: [] responses: "200": description: List of runs content: application/json: schema: $ref: "#/components/schemas/RunsResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/runs/stream: get: tags: [System] summary: Stream runs (SSE) description: Server-Sent Events endpoint for run updates operationId: streamRuns security: - sessionAuth: [] responses: "200": description: SSE stream content: text/event-stream: schema: type: string /api/v1/usage: get: tags: [System] summary: List usage description: Returns paginated usage summaries operationId: listUsage security: - sessionAuth: [] parameters: - name: sessionId in: query schema: type: string - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Usage summaries content: application/json: schema: $ref: "#/components/schemas/UsageListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/logs: get: tags: [System] summary: List logs description: Returns paginated log entries operationId: listLogs security: - sessionAuth: [] parameters: - name: sessionId in: query schema: type: string - name: sourceModule in: query schema: type: string - name: eventType in: query schema: type: string - name: runRef in: query schema: type: string - name: limit in: query schema: type: integer default: 50 - name: offset in: query schema: type: integer default: 0 responses: "200": description: Log entries content: application/json: schema: $ref: "#/components/schemas/LogListResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/logs/stream: get: tags: [System] summary: Stream logs (SSE) description: Server-Sent Events endpoint for log updates operationId: streamLogs security: - sessionAuth: [] parameters: - name: sessionId in: query schema: type: string - name: after in: query schema: type: string responses: "200": description: SSE stream content: text/event-stream: schema: type: string /api/v1/settings: get: tags: [System] summary: Get settings description: Returns system settings operationId: getSettings security: - sessionAuth: [] responses: "200": description: Settings content: application/json: schema: $ref: "#/components/schemas/SettingsResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/instances: get: tags: [System] summary: List instances description: Returns instance status operationId: listInstances security: - sessionAuth: [] responses: "200": description: Instance status content: application/json: schema: $ref: "#/components/schemas/InstancesResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/channels: get: tags: [System] summary: List channels description: Returns registered channels operationId: listChannels security: - sessionAuth: [] responses: "200": description: Channels content: application/json: schema: $ref: "#/components/schemas/ChannelsResponse" "401": $ref: "#/components/responses/Unauthorized" /api/v1/planner-runs/{plannerRunId}/events: get: tags: [System] summary: Get planner run events description: Returns events for a planner run operationId: getPlannerRunEvents security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/plannerRunId" responses: "200": description: Events content: application/json: schema: $ref: "#/components/schemas/PlannerRunEventsResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/planner-runs/{plannerRunId}/summary: get: tags: [System] summary: Get planner run summary description: Returns summary for a planner run operationId: getPlannerRunSummary security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/plannerRunId" responses: "200": description: Summary content: application/json: schema: $ref: "#/components/schemas/PlannerRunSummaryResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" /api/v1/debug/replay/{sessionId}: get: tags: [System] summary: Debug replay description: Returns debug replay information for a session operationId: debugReplay security: - sessionAuth: [] parameters: - $ref: "#/components/parameters/sessionId" responses: "200": description: Replay debug info content: application/json: schema: $ref: "#/components/schemas/DebugReplayResponse" "401": $ref: "#/components/responses/Unauthorized" "404": $ref: "#/components/responses/NotFound" # ============================================================================ # Component Schemas # ============================================================================ components: securitySchemes: sessionAuth: type: apiKey in: cookie name: agent-platform-session description: Session cookie set after login bearerAuth: type: http scheme: bearer description: API token for programmatic access (set API_AUTH_TOKEN env var to enable) apiKeyAuth: type: apiKey in: header name: X-API-Key description: API key with ak_ prefix for service-to-service authentication parameters: sessionId: name: sessionId in: path required: true schema: type: string description: Session ID agentId: name: agentId in: path required: true schema: type: string description: Agent ID providerId: name: providerId in: path required: true schema: type: string description: Provider ID approvalId: name: approvalId in: path required: true schema: type: string description: Approval ID memoryId: name: memoryId in: path required: true schema: type: string description: Memory ID draftId: name: draftId in: path required: true schema: type: string description: Workflow draft ID workflowId: name: workflowId in: path required: true schema: type: string description: Workflow definition ID workflowRunId: name: workflowRunId in: path required: true schema: type: string description: Workflow run ID scheduleId: name: scheduleId in: path required: true schema: type: string description: Schedule trigger ID webhookId: name: webhookId in: path required: true schema: type: string description: Webhook trigger ID orgId: name: orgId in: path required: true schema: type: string description: Organization ID runId: name: runId in: path required: true schema: type: string description: Run ID plannerRunId: name: plannerRunId in: path required: true schema: type: string description: Planner run ID fileId: name: fileId in: path required: true schema: type: string description: File upload ID schemas: # ---- Envelope ---- ApiEnvelope: type: object required: [ok, requestId] properties: ok: type: boolean description: true for success, false for error requestId: type: string description: Traceable request identifier ApiErrorDetail: type: object required: [code, message] properties: code: type: string description: Machine-readable error code message: type: string description: Human-readable error message details: description: Additional error details SuccessResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object ErrorResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [error] properties: error: $ref: "#/components/schemas/ApiErrorDetail" # ---- Auth & Setup ---- SetupStatusResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [needsSetup] properties: needsSetup: type: boolean CreateUserRequest: type: object required: [username, password] properties: username: type: string password: type: string LoginRequest: type: object required: [username, password] properties: username: type: string password: type: string UserMetadata: type: object required: [userId, username, createdAt] properties: userId: type: string username: type: string createdAt: type: string format: date-time AuthSuccessResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [user] properties: user: $ref: "#/components/schemas/UserMetadata" # ---- Organizations ---- Organization: type: object required: [orgId, name, slug, createdAt, updatedAt] properties: orgId: type: string name: type: string slug: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time OrganizationResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: $ref: "#/components/schemas/Organization" OrganizationListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: array items: $ref: "#/components/schemas/Organization" CreateOrganizationRequest: type: object required: [name, slug] properties: name: type: string minLength: 1 slug: type: string minLength: 1 UpdateOrganizationRequest: type: object properties: name: type: string minLength: 1 slug: type: string minLength: 1 DeleteOrganizationResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [orgId, deleted] properties: orgId: type: string deleted: type: boolean OrganizationMember: type: object required: [userId, orgId, role, joinedAt] properties: userId: type: string orgId: type: string role: type: string enum: [owner, admin, member] joinedAt: type: string format: date-time OrganizationMemberListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: array items: $ref: "#/components/schemas/OrganizationMember" AddOrganizationMemberRequest: type: object required: [userId] properties: userId: type: string minLength: 1 role: type: string enum: [owner, admin, member] default: member OrganizationMembershipResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: $ref: "#/components/schemas/OrganizationMember" RemoveMemberResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [userId, orgId, removed] properties: userId: type: string orgId: type: string removed: type: boolean UpdateMemberRoleRequest: type: object required: [role] properties: role: type: string enum: [owner, admin, member] UpdateMemberRoleResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [userId, orgId, role] properties: userId: type: string orgId: type: string role: type: string # ---- RBAC - API Keys ---- ApiKeyListEntry: type: object required: [id, name, prefix, role, userId, createdAt, isActive] properties: id: type: string name: type: string prefix: type: string description: First 8 characters of the key for identification role: type: string enum: [admin, user, service] userId: type: string nullable: true createdAt: type: string format: date-time expiresAt: type: string format: date-time nullable: true lastUsedAt: type: string format: date-time nullable: true isActive: type: boolean ApiKeyListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: array items: $ref: "#/components/schemas/ApiKeyListEntry" CreateApiKeyRequest: type: object required: [name, role] properties: name: type: string minLength: 1 role: type: string enum: [admin, user, service] expiresAt: type: string format: date-time CreateApiKeyResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [id, name, key, prefix, role, createdAt] properties: id: type: string name: type: string key: type: string description: The full API key (only shown once on creation) prefix: type: string role: type: string createdAt: type: string format: date-time RevokeApiKeyResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [id, isActive] properties: id: type: string isActive: type: boolean # ---- Alerting ---- AlertRule: type: object required: [id, name, metricName, conditionType, threshold, windowSeconds, severity, enabled, createdAt, updatedAt] properties: id: type: string name: type: string description: type: string nullable: true metricName: type: string metricModule: type: string nullable: true conditionType: type: string enum: [threshold, rate, absence] operator: type: string enum: ['>', '<', '>=', '<=', '=='] nullable: true threshold: type: number windowSeconds: type: integer severity: type: string enum: [critical, warning, info] webhookUrl: type: string nullable: true labels: type: object additionalProperties: type: string enabled: type: boolean createdAt: type: string format: date-time updatedAt: type: string format: date-time AlertState: type: object required: [ruleId, state, lastEvaluatedAt] properties: ruleId: type: string state: type: string enum: [idle, firing, resolved] lastEvaluatedAt: type: string format: date-time lastFiredAt: type: string format: date-time nullable: true lastResolvedAt: type: string format: date-time nullable: true currentValue: type: number nullable: true AlertRuleListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [rules] properties: rules: type: array items: $ref: "#/components/schemas/AlertRule" AlertRuleResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [rule] properties: rule: $ref: "#/components/schemas/AlertRule" CreateAlertRuleRequest: type: object required: [id, name, metricName, conditionType, threshold, windowSeconds, severity] properties: id: type: string name: type: string description: type: string metricName: type: string metricModule: type: string conditionType: type: string enum: [threshold, rate, absence] operator: type: string enum: ['>', '<', '>=', '<=', '=='] threshold: type: number windowSeconds: type: integer severity: type: string enum: [critical, warning, info] webhookUrl: type: string labels: type: object additionalProperties: type: string enabled: type: boolean DeleteAlertRuleResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [deleted] properties: deleted: type: boolean AlertStateListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [states] properties: states: type: array items: $ref: "#/components/schemas/AlertState" AlertEvaluationResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [evaluatedAt, rulesEvaluated] properties: evaluatedAt: type: string format: date-time rulesEvaluated: type: integer alertsTriggered: type: integer alertsResolved: type: integer # ---- Sessions ---- SessionInfo: type: object required: [sessionId, userId, messageCount, lastActivityAt] properties: sessionId: type: string userId: type: string messageCount: type: integer lastActivityAt: type: string format: date-time activePlannerRunIds: type: array items: type: string activeBackgroundRunIds: type: array items: type: string selectedModel: type: string selectedProviderId: type: string sessionKind: type: string enum: [foreground, subagent] description: Internal subagent child sessions are excluded from the default session list parentSessionId: type: string description: Parent session of a subagent child session taskId: type: string description: Resumable task id (identity rule: taskId equals the child session id) agentProfile: type: string description: Subagent profile that owns the child session launchMode: type: string enum: [foreground, background] subagentDepth: type: integer description: Nested child depth (0 for foreground sessions) SessionResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [session] properties: session: $ref: "#/components/schemas/SessionInfo" ConsoleSessionInfo: type: object properties: sessionId: type: string userId: type: string title: type: string status: type: string enum: [active, archived, closed] messageCount: type: integer lastActivityAt: type: string format: date-time createdAt: type: string format: date-time updatedAt: type: string format: date-time selectedModel: type: string selectedProviderId: type: string sessionKind: type: string enum: [foreground, subagent] parentSessionId: type: string taskId: type: string agentProfile: type: string launchMode: type: string enum: [foreground, background] subagentDepth: type: integer SessionListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: $ref: "#/components/schemas/PaginatedResponse" PatchSessionRequest: type: object properties: title: type: string status: type: string enum: [active, archived, closed] SendMessageRequest: type: object required: [text] properties: text: type: string attachmentIds: type: array items: type: string description: Optional list of file IDs to attach to this message SendMessageResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: accepted: type: boolean status: type: string correlationId: type: string envelopeId: type: string TranscriptTurn: type: object properties: turnId: type: string sessionId: type: string userId: type: string input: type: object output: type: object runtimeSummary: type: object createdAt: type: string format: date-time TranscriptsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: transcripts: type: array items: $ref: "#/components/schemas/TranscriptTurn" total: type: integer ConsoleTimelineEvent: type: object properties: eventId: type: string eventType: type: string sessionId: type: string timestamp: type: string format: date-time content: type: string metadata: type: object TimelineResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: $ref: "#/components/schemas/PaginatedResponse" SessionResumeResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: session: $ref: "#/components/schemas/ConsoleSessionInfo" timeline: type: array items: $ref: "#/components/schemas/ConsoleTimelineEvent" SetModelRequest: type: object required: [providerId, model] properties: providerId: type: string model: type: string # ---- Files ---- FileMetadata: type: object required: [fileId, userId, sessionId, originalFilename, mimeType, extension, sizeBytes, status, createdAt, updatedAt] properties: fileId: type: string userId: type: string sessionId: type: string originalFilename: type: string mimeType: type: string extension: type: string sizeBytes: type: integer status: type: string enum: [uploading, ready, deleted] createdAt: type: string format: date-time updatedAt: type: string format: date-time FileUploadResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [file] properties: file: $ref: "#/components/schemas/FileMetadata" FileListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [files, total] properties: files: type: array items: $ref: "#/components/schemas/FileMetadata" total: type: integer FileDeleteResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [deleted, fileId] properties: deleted: type: boolean fileId: type: string # ---- Agents & Providers ---- AgentConfig: type: object properties: agentConfigId: type: string agentId: type: string scope: type: string enum: [global, user] userId: type: string displayName: type: string enabled: type: boolean systemPrompt: type: string routingPrompt: type: string providerId: type: string model: type: string allowedToolIds: type: array items: type: string description: | Permitted tool IDs. Tools are the execution surface — they execute code, make API calls, and perform side effects. Tools not in this list are blocked from execution. allowedSkillIds: type: array items: type: string nullable: true description: | Permitted skill IDs. Skills are documentation-only records — metadata plus lazily-loaded markdown instructions. Skills do NOT execute code. Semantics: - null or omitted: inherits defaults from agent profile and agent-type envelope - [] (empty array): no skills — agent receives no skill documentation - ["skill-a", "skill-b"]: intersects with agent-type envelope; only skills in both the list and the envelope are projected routingTimeoutMs: type: integer repairAttempts: type: integer searchLlmProviderId: type: string searchLlmModel: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time AgentConfigResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: global: $ref: "#/components/schemas/AgentConfig" userOverride: $ref: "#/components/schemas/AgentConfig" effective: $ref: "#/components/schemas/AgentConfig" UpdateAgentConfigRequest: type: object properties: displayName: type: string enabled: type: boolean systemPrompt: type: string routingPrompt: type: string providerId: type: string model: type: string allowedToolIds: type: array items: type: string description: | Permitted tool IDs. Tools are the execution surface — they execute code, make API calls, and perform side effects. allowedSkillIds: type: array items: type: string nullable: true description: | Permitted skill IDs. Skills are documentation-only records — metadata plus lazily-loaded markdown instructions. Skills do NOT execute code. Semantics: - null: inherits defaults from agent profile and agent-type envelope - [] (empty array): no skills — agent receives no skill documentation - ["skill-a", "skill-b"]: intersects with agent-type envelope routingTimeoutMs: type: integer repairAttempts: type: integer searchLlmProviderId: type: string searchLlmModel: type: string UpdateOverrideConfigRequest: type: object properties: displayName: type: string enabled: type: boolean systemPrompt: type: string nullable: true routingPrompt: type: string nullable: true providerId: type: string nullable: true model: type: string nullable: true allowedToolIds: type: array items: type: string nullable: true description: | Permitted tool IDs. Tools are the execution surface — they execute code, make API calls, and perform side effects. allowedSkillIds: type: array items: type: string nullable: true description: | Permitted skill IDs. Skills are documentation-only records — metadata plus lazily-loaded markdown instructions. Skills do NOT execute code. Semantics: - null: inherits defaults from agent profile and agent-type envelope - [] (empty array): no skills — agent receives no skill documentation - ["skill-a", "skill-b"]: intersects with agent-type envelope routingTimeoutMs: type: integer repairAttempts: type: integer searchLlmProviderId: type: string nullable: true searchLlmModel: type: string nullable: true ProviderSummary: type: object required: [providerId, providerType, displayName, enabled, configured, source] properties: providerId: type: string providerType: type: string enum: [openai, openrouter, ollama, custom] displayName: type: string enabled: type: boolean configured: type: boolean apiKeyLast4: type: string nullable: true baseUrl: type: string nullable: true selectedModel: type: string nullable: true source: type: string lastTestStatus: type: string nullable: true lastTestedAt: type: string format: date-time nullable: true createdAt: type: string format: date-time updatedAt: type: string format: date-time ProviderListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/ProviderSummary" CreateProviderRequest: type: object required: [providerType] properties: providerType: type: string enum: [openai, openrouter, ollama, custom] displayName: type: string apiKey: type: string baseUrl: type: string selectedModel: type: string UpdateProviderRequest: type: object properties: displayName: type: string apiKey: type: string baseUrl: type: string selectedModel: type: string enabled: type: boolean TestProviderResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [success, latencyMs] properties: success: type: boolean latencyMs: type: integer modelCount: type: integer error: type: string ModelsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [providers] properties: providers: type: array items: $ref: "#/components/schemas/ProviderSummary" selectedModel: type: string selectedProviderId: type: string ToolSummary: type: object required: [name, description, category, sensitivity] properties: name: type: string description: type: string category: type: string enum: [read, write, delete, execute, search, admin, connector, internal] sensitivity: type: string enum: [low, medium, high, restricted] ToolsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [tools, total] properties: tools: type: array items: $ref: "#/components/schemas/ToolSummary" total: type: integer ToolResultResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [resultId, toolExecutionId, toolName, userId, sizeBytes, contentType, sensitivity, createdAt] properties: resultId: type: string toolExecutionId: type: string toolName: type: string userId: type: string sessionId: type: string sizeBytes: type: integer contentType: type: string preview: type: string sensitivity: type: string createdAt: type: string format: date-time # ---- Skills ---- SkillSummary: type: object required: [skillId, name, description, category, sensitivity, enabled, source] properties: skillId: type: string name: type: string description: type: string category: type: string enum: [read, write, search, automation, admin, internal, custom] sensitivity: type: string enum: [low, medium, high, restricted] enabled: type: boolean source: type: string enum: [builtin, user, plugin, remote] SkillDetailResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [skillId, name, description, category, sensitivity, enabled, source, allowedAgentTypes, defaultAgentProfiles] properties: skillId: type: string name: type: string description: type: string category: type: string enum: [read, write, search, automation, admin, internal, custom] sensitivity: type: string enum: [low, medium, high, restricted] enabled: type: boolean source: type: string enum: [builtin, user, plugin, remote] allowedAgentTypes: type: array items: type: string enum: [main, subagent, background, workflow_step, remote] defaultAgentProfiles: type: array items: type: string summary: type: string tags: type: array items: type: string SkillsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [skills, total] properties: skills: type: array items: $ref: "#/components/schemas/SkillSummary" total: type: integer # ---- Workflows ---- WorkflowStep: type: object required: [stepId, stepType, name] properties: stepId: type: string stepType: type: string name: type: string config: type: object DraftResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [draftId, name, steps, ownerUserId, status, createdAt, updatedAt] properties: draftId: type: string name: type: string description: type: string steps: type: array items: $ref: "#/components/schemas/WorkflowStep" ownerUserId: type: string status: type: string validationIssues: type: array items: type: object createdAt: type: string format: date-time updatedAt: type: string format: date-time DraftListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/DraftResponse/properties/data" CreateDraftRequest: type: object required: [name, steps] properties: name: type: string description: type: string steps: type: array items: $ref: "#/components/schemas/WorkflowStep" UpdateDraftRequest: type: object properties: name: type: string description: type: string steps: type: array items: $ref: "#/components/schemas/WorkflowStep" ValidationResult: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [valid] properties: valid: type: boolean issues: type: array items: type: object DefinitionResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [workflowId, name, version, steps, ownerUserId, status, createdAt, updatedAt] properties: workflowId: type: string name: type: string description: type: string version: type: integer steps: type: array items: $ref: "#/components/schemas/WorkflowStep" ownerUserId: type: string status: type: string publishedFromDraftId: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time DefinitionListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/DefinitionResponse/properties/data" RunResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [workflowRunId, definitionId, version, status, currentStepIds, stepRuns] properties: workflowRunId: type: string definitionId: type: string version: type: integer status: type: string currentStepIds: type: array items: type: string stepRuns: type: array items: type: object WorkflowRunListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/RunResponse/properties/data" StartRunRequest: type: object required: [definitionId] properties: definitionId: type: string inputData: type: object # ---- Triggers ---- ScheduleTriggerResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [scheduleId, name, schedulePattern, status, runCount, createdAt, updatedAt] properties: scheduleId: type: string name: type: string schedulePattern: type: string status: type: string lastRunAt: type: string format: date-time nextRunAt: type: string format: date-time runCount: type: integer maxRuns: type: integer createdAt: type: string format: date-time updatedAt: type: string format: date-time ScheduleListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/ScheduleTriggerResponse/properties/data" CreateScheduleRequest: type: object required: [name, schedulePattern] properties: name: type: string schedulePattern: type: string maxRuns: type: integer WebhookTriggerResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [webhookId, name, status, secretLast4, createdAt, updatedAt] properties: webhookId: type: string name: type: string status: type: string secretLast4: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time WebhookTriggerCreatedResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [webhookId, name, status, secretLast4, secret, createdAt, updatedAt] properties: webhookId: type: string name: type: string status: type: string secretLast4: type: string secret: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time WebhookListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/WebhookTriggerResponse/properties/data" CreateWebhookRequest: type: object required: [name] properties: name: type: string UpdateTriggerStatusRequest: type: object properties: status: type: string enum: [active, paused] WebhookDeliveryResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: status: type: string eventId: type: string # ---- Approvals ---- ApprovalInfo: type: object required: [id, userId, sessionId, status, actionType, requestedBy, requestedAt] properties: id: type: string userId: type: string sessionId: type: string status: type: string enum: [pending, approved, rejected, expired, cancelled] riskLevel: type: string scope: type: string actionType: type: string resource: type: string justification: type: string requestedBy: type: string requestedAt: type: string format: date-time expiresAt: type: string format: date-time respondedAt: type: string format: date-time responseBy: type: string responseReason: type: string plannerRunId: type: string ApprovalsListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: approvals: type: array items: $ref: "#/components/schemas/ApprovalInfo" total: type: integer ApprovalDetailResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [approval] properties: approval: $ref: "#/components/schemas/ApprovalInfo" ApprovalDecisionRequest: type: object properties: responseType: type: string enum: [reject, approve_once, approve_always] description: | Canonical tri-state approval response (preferred): - `reject`: Deny request, no grant created - `approve_once`: Approve with 60-minute short-TTL grant - `approve_always`: Approve with 24-hour grant decision: type: string enum: [approved, rejected] description: | Legacy two-state approval response (backward compatibility). Normalized to: `approved` → `approve_once`, `rejected` → `reject` reason: type: string description: Optional reason for the decision description: | Provide either `responseType` (preferred) or `decision` (legacy). If both are provided, `responseType` takes precedence. ApprovalDecisionResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [success, approvalId, status, responseType, grantCreated] properties: success: type: boolean description: Whether the decision was recorded successfully approvalId: type: string description: ID of the approval request status: type: string enum: [approved, rejected] description: Final status of the approval (legacy field) responseType: type: string enum: [reject, approve_once, approve_always] description: Canonical response type used grantCreated: type: boolean description: Whether a permission grant was created grantId: type: string description: ID of the created grant (if grantCreated is true) # ---- Memory ---- MemoryContent: type: object properties: text: type: string Memory: type: object required: [memoryId, userId, memoryType, content, lifecycle, createdAt, updatedAt] properties: memoryId: type: string userId: type: string memoryType: type: string enum: [user_profile, user_preference, user_safety_rule, project_state] content: $ref: "#/components/schemas/MemoryContent" lifecycle: type: object properties: status: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time MemoryListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: memories: type: array items: $ref: "#/components/schemas/Memory" total: type: integer MemoryResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [memory] properties: memory: $ref: "#/components/schemas/Memory" MemoryDeleteResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [deleted, memoryId] properties: deleted: type: boolean memoryId: type: string ExtractionRun: type: object properties: runId: type: string userId: type: string sessionId: type: string triggerTurnId: type: string status: type: string attempts: type: integer resultCounts: type: object createdAt: type: string format: date-time ExtractionRunListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: runs: type: array items: $ref: "#/components/schemas/ExtractionRun" total: type: integer DebugExtractRequest: type: object required: [sessionId, turnId] properties: sessionId: type: string turnId: type: string ExtractionResult: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [status] properties: status: type: string resultCounts: type: object errorCode: type: string # ---- Observability ---- RunListEntry: type: object properties: id: type: string type: type: string enum: [planner_run, workflow_run] status: type: string createdAt: type: string format: date-time summary: type: string RunListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: runs: type: array items: $ref: "#/components/schemas/RunListEntry" TimelineEvent: type: object properties: eventId: type: string eventType: type: string timestamp: type: string format: date-time description: type: string status: type: string module: type: string AuditRecord: type: object properties: auditId: type: string auditType: type: string timestamp: type: string format: date-time actionSummary: type: string status: type: string riskLevel: type: string ConsoleView: type: object properties: runId: type: string runType: type: string enum: [planner_run, workflow_run] timeline: type: object properties: events: type: array items: $ref: "#/components/schemas/TimelineEvent" startTime: type: string format: date-time endTime: type: string format: date-time durationMs: type: integer status: type: string audit: type: object properties: totalRecords: type: integer records: type: array items: $ref: "#/components/schemas/AuditRecord" status: type: object properties: runStatus: type: string startedAt: type: string format: date-time completedAt: type: string format: date-time errorMessage: type: string ConsoleViewResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: $ref: "#/components/schemas/ConsoleView" BlockedAction: type: object properties: eventId: type: string eventType: type: string action: type: string reason: type: string module: type: string ReplayPreview: type: object properties: runId: type: string runType: type: string enum: [planner_run, workflow_run] status: type: string enum: [success, partial, blocked, error] timeline: type: object properties: events: type: array items: $ref: "#/components/schemas/TimelineEvent" startTime: type: string format: date-time endTime: type: string format: date-time durationMs: type: integer rootStatus: type: string blockedActions: type: array items: $ref: "#/components/schemas/BlockedAction" stateSnapshot: nullable: true warnings: type: array items: type: string ReplayPreviewResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: $ref: "#/components/schemas/ReplayPreview" # ---- Connectors ---- ConnectorDefinition: type: object properties: id: type: string connectorId: type: string name: type: string connectorType: type: string enum: [api, messaging, storage, database, custom] version: type: string description: type: string capabilities: type: array items: type: string configSchema: type: object status: type: string enum: [draft, active, deprecated, inactive] createdAt: type: string format: date-time updatedAt: type: string format: date-time ConnectorInstance: type: object properties: id: type: string connectorInstanceId: type: string connectorDefinitionId: type: string userId: type: string name: type: string config: type: object status: type: string enum: [draft, active, deprecated, inactive] createdAt: type: string format: date-time updatedAt: type: string format: date-time ConnectorListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/ConnectorDefinition" InstanceListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: array items: $ref: "#/components/schemas/ConnectorInstance" UpdateInstanceConfigRequest: type: object properties: config: type: object OAuthAuthorizeResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [authorizeUrl, stateId, codeVerifier, expiresAt] properties: authorizeUrl: type: string format: uri stateId: type: string codeVerifier: type: string expiresAt: type: string format: date-time OAuthCallbackRequest: type: object required: [code, state, codeVerifier] properties: code: type: string state: type: string codeVerifier: type: string OAuthCallbackResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [instanceId, connectorType, providerId] properties: instanceId: type: string connectorType: type: string providerId: type: string OAuthRevokeResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object required: [data] properties: data: type: object required: [revoked, instanceId] properties: revoked: type: boolean instanceId: type: string # ---- System ---- ModuleHealth: type: object properties: status: type: string enum: [healthy, degraded, unhealthy] message: type: string HealthResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [status, timestamp] properties: status: type: string enum: [healthy, degraded] timestamp: type: string format: date-time modules: type: object additionalProperties: $ref: "#/components/schemas/ModuleHealth" ReadyResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [status, timestamp] properties: status: type: string timestamp: type: string format: date-time checks: type: object RunInfo: type: object required: [runId, status, createdAt] properties: runId: type: string status: type: string enum: [pending, running, completed, failed, cancelled] objective: type: string progress: type: number createdAt: type: string format: date-time updatedAt: type: string format: date-time RunsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: runs: type: array items: $ref: "#/components/schemas/RunInfo" total: type: integer UsageSummary: type: object required: [sessionId, messageCount, turnCount, estimatedInputTokens, estimatedOutputTokens, estimatedTotalTokens, updatedAt] properties: sessionId: type: string messageCount: type: integer turnCount: type: integer toolCallCount: type: integer approvalCount: type: integer artifactCount: type: integer runCount: type: integer estimatedInputTokens: type: integer estimatedOutputTokens: type: integer estimatedTotalTokens: type: integer estimatedCostCents: type: number nullable: true updatedAt: type: string format: date-time UsageSummaryResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: $ref: "#/components/schemas/UsageSummary" UsageListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: $ref: "#/components/schemas/PaginatedResponse" LogEntry: type: object required: [eventId, eventType, sourceModule, severity, summary, createdAt] properties: eventId: type: string eventType: type: string sourceModule: type: string sessionId: type: string severity: type: string enum: [info, warn, error] summary: type: string createdAt: type: string format: date-time payloadPreview: type: string LogListResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: $ref: "#/components/schemas/PaginatedResponse" SettingsConfig: type: object required: [localOnly, providers, retentionDays] properties: localOnly: type: boolean providers: type: object additionalProperties: type: object properties: configured: type: boolean retentionDays: type: integer SettingsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object required: [settings] properties: settings: $ref: "#/components/schemas/SettingsConfig" InstanceSummary: type: object required: [type, status, apiPort, storeStatus] properties: type: type: string status: type: string enum: [healthy, degraded] uptime: type: number apiPort: type: integer storeStatus: type: string InstancesResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: instances: type: array items: $ref: "#/components/schemas/InstanceSummary" ChannelSummary: type: object properties: connectorId: type: string type: type: string status: type: string configured: type: boolean ChannelsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: channels: type: array items: $ref: "#/components/schemas/ChannelSummary" PlannerRunEventsResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: events: type: array items: type: object PlannerRunSummaryResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: status: type: string stepCount: type: integer currentStep: type: string planVersion: type: integer DebugReplayResponse: allOf: - $ref: "#/components/schemas/ApiEnvelope" - type: object properties: data: type: object properties: eventCount: type: integer transcriptCount: type: integer runRefs: type: array items: type: string approvalRefs: type: array items: type: string lastEventId: type: string redactedPreviews: type: array items: type: object # ---- Shared ---- PaginatedResponse: type: object required: [items, total, limit, offset, hasMore] properties: items: type: array items: type: object total: type: integer limit: type: integer offset: type: integer hasMore: type: boolean # ---- Standard Responses ---- responses: BadRequest: description: Invalid request body or parameters content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: ok: false error: code: "BAD_REQUEST" message: "Invalid request body" requestId: "abc12345" Unauthorized: description: Authentication required content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: ok: false error: code: "UNAUTHORIZED" message: "Authentication required" requestId: "abc12345" Forbidden: description: Access denied content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: ok: false error: code: "FORBIDDEN" message: "Access denied" requestId: "abc12345" NotFound: description: Resource not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: ok: false error: code: "NOT_FOUND" message: "Resource not found" requestId: "abc12345" Conflict: description: Resource conflict content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: ok: false error: code: "CONFLICT" message: "Resource already exists" requestId: "abc12345" InternalError: description: Unexpected server error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" example: ok: false error: code: "INTERNAL_ERROR" message: "An unexpected error occurred" requestId: "abc12345"