openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: AIOS — Personal AI Operating System API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: builder description: Website builder projects, AI generation, and settings - name: projects description: AI-generated software projects - name: workflows description: AI automation workflows - name: deployments description: Project deployment management - name: models description: AI model catalog and routing - name: activity description: Activity and audit log - name: dashboard description: Dashboard aggregates - name: ai description: AI generation and model routing - name: conversations description: Project AI conversation memory - name: versions description: Project version history - name: checklist description: Security pre-deploy checklist - name: usage description: Token usage and cost tracking - name: notifications description: Push notifications and in-app alerts - name: agent description: Self-healing agent status and fixes - name: subscription description: Subscription plans and billing paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /projects: get: operationId: listProjects tags: [projects] summary: List all projects responses: "200": description: List of projects content: application/json: schema: type: array items: $ref: "#/components/schemas/Project" post: operationId: createProject tags: [projects] summary: Create a new project from a prompt requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateProjectRequest" responses: "201": description: Project created content: application/json: schema: $ref: "#/components/schemas/Project" /projects/{id}: get: operationId: getProject tags: [projects] summary: Get project detail parameters: - name: id in: path required: true schema: type: string responses: "200": description: Project detail content: application/json: schema: $ref: "#/components/schemas/Project" "404": description: Not found patch: operationId: updateProject tags: [projects] summary: Update a project parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateProjectRequest" responses: "200": description: Updated project content: application/json: schema: $ref: "#/components/schemas/Project" delete: operationId: deleteProject tags: [projects] summary: Delete a project parameters: - name: id in: path required: true schema: type: string responses: "204": description: Deleted /projects/{id}/generate: post: operationId: generateProject tags: [projects] summary: Trigger AI generation for a project parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GenerateRequest" responses: "200": description: Generation started content: application/json: schema: $ref: "#/components/schemas/GenerationJob" /projects/{id}/scan: post: operationId: scanProject tags: [projects] summary: Run security scan on a project parameters: - name: id in: path required: true schema: type: string responses: "200": description: Scan result content: application/json: schema: $ref: "#/components/schemas/SecurityScan" /projects/{id}/deploy: post: operationId: deployProject tags: [projects] summary: Deploy a project parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DeployRequest" responses: "200": description: Deployment started content: application/json: schema: $ref: "#/components/schemas/Deployment" /projects/{id}/deployments: get: operationId: listProjectDeployments tags: [projects] summary: List deployments for a project parameters: - name: id in: path required: true schema: type: string responses: "200": description: Deployments content: application/json: schema: type: array items: $ref: "#/components/schemas/Deployment" /workflows: get: operationId: listWorkflows tags: [workflows] summary: List all AI workflows responses: "200": description: List of workflows content: application/json: schema: type: array items: $ref: "#/components/schemas/Workflow" post: operationId: createWorkflow tags: [workflows] summary: Create a new workflow requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateWorkflowRequest" responses: "201": description: Workflow created content: application/json: schema: $ref: "#/components/schemas/Workflow" /workflows/{id}: get: operationId: getWorkflow tags: [workflows] summary: Get workflow detail parameters: - name: id in: path required: true schema: type: string responses: "200": description: Workflow content: application/json: schema: $ref: "#/components/schemas/Workflow" delete: operationId: deleteWorkflow tags: [workflows] summary: Delete a workflow parameters: - name: id in: path required: true schema: type: string responses: "204": description: Deleted /workflows/{id}/run: post: operationId: runWorkflow tags: [workflows] summary: Execute a workflow parameters: - name: id in: path required: true schema: type: string responses: "200": description: Workflow run result content: application/json: schema: $ref: "#/components/schemas/WorkflowRun" /deployments: get: operationId: listDeployments tags: [deployments] summary: List all deployments across all projects responses: "200": description: Deployments content: application/json: schema: type: array items: $ref: "#/components/schemas/Deployment" /models: get: operationId: listModels tags: [models] summary: List available AI models responses: "200": description: AI model catalog content: application/json: schema: type: array items: $ref: "#/components/schemas/AiModel" /activity: get: operationId: listActivity tags: [activity] summary: Get recent activity across all projects parameters: - name: limit in: query schema: type: integer default: 20 responses: "200": description: Activity events content: application/json: schema: type: array items: $ref: "#/components/schemas/ActivityEvent" /dashboard: get: operationId: getDashboard tags: [dashboard] summary: Get dashboard summary stats responses: "200": description: Dashboard aggregates content: application/json: schema: $ref: "#/components/schemas/DashboardSummary" /notifications: get: operationId: getNotifications tags: [notifications] summary: List notifications parameters: - name: unreadOnly in: query schema: type: string responses: "200": description: Notifications list content: application/json: schema: type: array items: $ref: "#/components/schemas/Notification" /notifications/unread-count: get: operationId: getNotificationsUnreadCount tags: [notifications] summary: Get unread notification count responses: "200": description: Unread count content: application/json: schema: $ref: "#/components/schemas/UnreadCount" /notifications/{id}/read: patch: operationId: patchNotificationsIdRead tags: [notifications] summary: Mark notification as read parameters: - name: id in: path required: true schema: type: string responses: "200": description: Updated notification content: application/json: schema: $ref: "#/components/schemas/Notification" /notifications/read-all: post: operationId: postNotificationsReadAll tags: [notifications] summary: Mark all notifications as read responses: "200": description: Success content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /notifications/{id}: delete: operationId: deleteNotificationsId tags: [notifications] summary: Delete a notification parameters: - name: id in: path required: true schema: type: string responses: "204": description: Deleted /notifications/push-token: post: operationId: postNotificationsPushToken tags: [notifications] summary: Register a push notification token requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PushTokenRequest" responses: "200": description: Registered content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /agent/status: get: operationId: getAgentStatus tags: [agent] summary: Get self-healing agent status responses: "200": description: Agent status content: application/json: schema: $ref: "#/components/schemas/AgentStatus" /agent/fixes: get: operationId: getAgentFixes tags: [agent] summary: List agent-detected fixes parameters: - name: status in: query schema: type: string - name: limit in: query schema: type: integer responses: "200": description: Fixes content: application/json: schema: type: array items: $ref: "#/components/schemas/AgentFix" /agent/fixes/{id}: get: operationId: getAgentFixesId tags: [agent] summary: Get a specific fix parameters: - name: id in: path required: true schema: type: string responses: "200": description: Fix detail content: application/json: schema: $ref: "#/components/schemas/AgentFix" /agent/scan: post: operationId: postAgentScan tags: [agent] summary: Trigger a full agent scan responses: "200": description: Scan started content: application/json: schema: $ref: "#/components/schemas/ScanJob" /agent/pause: post: operationId: postAgentPause tags: [agent] summary: Pause the self-healing agent responses: "200": description: Agent status content: application/json: schema: $ref: "#/components/schemas/AgentStatus" /agent/resume: post: operationId: postAgentResume tags: [agent] summary: Resume the self-healing agent responses: "200": description: Agent status content: application/json: schema: $ref: "#/components/schemas/AgentStatus" /agent/fixes/{id}/approve: post: operationId: postAgentFixesIdApprove tags: [agent] summary: Approve and apply a pending fix parameters: - name: id in: path required: true schema: type: string responses: "200": description: Applied fix content: application/json: schema: $ref: "#/components/schemas/AgentFix" /subscription: get: operationId: getSubscription tags: [subscription] summary: Get current subscription responses: "200": description: Subscription content: application/json: schema: $ref: "#/components/schemas/Subscription" /subscription/plans: get: operationId: getSubscriptionPlans tags: [subscription] summary: Get available plans responses: "200": description: Plans content: application/json: schema: type: object additionalProperties: $ref: "#/components/schemas/Plan" /subscription/upgrade: post: operationId: postSubscriptionUpgrade tags: [subscription] summary: Upgrade subscription plan requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpgradeRequest" responses: "200": description: Upgrade result content: application/json: schema: $ref: "#/components/schemas/UpgradeResponse" /builder/projects: get: operationId: listBuilderProjects tags: [builder] summary: List all website builder projects responses: "200": description: List of builder projects content: application/json: schema: type: array items: $ref: "#/components/schemas/BuilderProject" post: operationId: createBuilderProject tags: [builder] summary: Create a new builder project requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BuilderProjectInput" responses: "201": description: Created content: application/json: schema: $ref: "#/components/schemas/BuilderProject" /builder/projects/{id}: get: operationId: getBuilderProject tags: [builder] summary: Get a builder project with its files parameters: - name: id in: path required: true schema: type: string responses: "200": description: Builder project with files content: application/json: schema: $ref: "#/components/schemas/BuilderProjectDetail" "404": description: Not found patch: operationId: updateBuilderProject tags: [builder] summary: Update a builder project (name, files, preview) parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BuilderProjectUpdate" responses: "200": description: Updated project content: application/json: schema: $ref: "#/components/schemas/BuilderProject" delete: operationId: deleteBuilderProject tags: [builder] summary: Delete a builder project parameters: - name: id in: path required: true schema: type: string responses: "204": description: Deleted /builder/projects/{id}/generate: post: operationId: generateBuilderCode tags: [builder] summary: Generate code via AI for a builder project parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BuilderGenerateInput" responses: "200": description: Generated code result content: application/json: schema: $ref: "#/components/schemas/BuilderGenerateResult" /builder/projects/{id}/snapshots: get: operationId: listBuilderSnapshots tags: [builder] summary: List version snapshots for a project parameters: - name: id in: path required: true schema: type: string responses: "200": description: Snapshots content: application/json: schema: type: array items: $ref: "#/components/schemas/BuilderSnapshot" post: operationId: createBuilderSnapshot tags: [builder] summary: Save a version snapshot parameters: - name: id in: path required: true schema: type: string requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BuilderSnapshotInput" responses: "201": description: Snapshot created content: application/json: schema: $ref: "#/components/schemas/BuilderSnapshot" /builder/projects/{id}/snapshots/{snapshotId}/restore: post: operationId: restoreBuilderSnapshot tags: [builder] summary: Restore project to a snapshot parameters: - name: id in: path required: true schema: type: string - name: snapshotId in: path required: true schema: type: string responses: "200": description: Restored project content: application/json: schema: $ref: "#/components/schemas/BuilderProjectDetail" /builder/settings: get: operationId: getBuilderSettings tags: [builder] summary: Get builder API settings and model config responses: "200": description: Settings content: application/json: schema: $ref: "#/components/schemas/BuilderSettings" patch: operationId: updateBuilderSettings tags: [builder] summary: Update builder settings (model, API keys) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/BuilderSettingsUpdate" responses: "200": description: Updated settings content: application/json: schema: $ref: "#/components/schemas/BuilderSettings" components: schemas: HealthStatus: type: object properties: status: type: string required: - status Project: type: object properties: id: type: string name: type: string description: type: string prompt: type: string status: type: string enum: [idle, generating, ready, deploying, deployed, error] tech: type: array items: type: string deployedUrl: type: string lastDeployedAt: type: string format: date-time securityScore: type: integer minimum: 0 maximum: 100 createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - name - status - createdAt - updatedAt CreateProjectRequest: type: object properties: name: type: string prompt: type: string tech: type: array items: type: string required: - name - prompt UpdateProjectRequest: type: object properties: name: type: string description: type: string status: type: string enum: [idle, generating, ready, deploying, deployed, error] GenerateRequest: type: object properties: prompt: type: string modelId: type: string required: - prompt GenerationJob: type: object properties: jobId: type: string projectId: type: string status: type: string enum: [queued, running, completed, failed] modelUsed: type: string estimatedSeconds: type: integer startedAt: type: string format: date-time required: - jobId - projectId - status - startedAt SecurityScan: type: object properties: projectId: type: string score: type: integer minimum: 0 maximum: 100 criticalIssues: type: integer highIssues: type: integer mediumIssues: type: integer lowIssues: type: integer findings: type: array items: $ref: "#/components/schemas/SecurityFinding" scannedAt: type: string format: date-time required: - projectId - score - criticalIssues - highIssues - mediumIssues - lowIssues - findings - scannedAt SecurityFinding: type: object properties: severity: type: string enum: [critical, high, medium, low] title: type: string description: type: string file: type: string line: type: integer required: - severity - title - description DeployRequest: type: object properties: provider: type: string enum: [vercel, netlify, railway, cloudflare] branch: type: string required: - provider Deployment: type: object properties: id: type: string projectId: type: string provider: type: string enum: [vercel, netlify, railway, cloudflare] status: type: string enum: [queued, building, live, failed, cancelled] url: type: string branch: type: string duration: type: integer description: Build duration in seconds createdAt: type: string format: date-time completedAt: type: string format: date-time required: - id - projectId - provider - status - createdAt Workflow: type: object properties: id: type: string name: type: string description: type: string trigger: type: string enum: [manual, schedule, webhook, event] steps: type: integer enabled: type: boolean lastRunAt: type: string format: date-time lastRunStatus: type: string enum: [success, failed, running] createdAt: type: string format: date-time required: - id - name - trigger - steps - enabled - createdAt CreateWorkflowRequest: type: object properties: name: type: string description: type: string trigger: type: string enum: [manual, schedule, webhook, event] required: - name - trigger WorkflowRun: type: object properties: runId: type: string workflowId: type: string status: type: string enum: [queued, running, completed, failed] startedAt: type: string format: date-time completedAt: type: string format: date-time logs: type: array items: type: string required: - runId - workflowId - status - startedAt AiModel: type: object properties: id: type: string name: type: string provider: type: string tier: type: string enum: [fast, balanced, powerful] contextWindow: type: integer costPer1kTokens: type: number capabilities: type: array items: type: string recommended: type: boolean required: - id - name - provider - tier - contextWindow - capabilities ActivityEvent: type: object properties: id: type: string type: type: string enum: [project_created, project_generated, deployment_started, deployment_live, scan_completed, workflow_run, model_switched] projectId: type: string projectName: type: string summary: type: string metadata: type: object createdAt: type: string format: date-time required: - id - type - summary - createdAt DashboardSummary: type: object properties: totalProjects: type: integer liveProjects: type: integer totalDeployments: type: integer activeWorkflows: type: integer avgSecurityScore: type: integer tokensUsedToday: type: integer costToday: type: number recentActivity: type: array items: $ref: "#/components/schemas/ActivityEvent" required: - totalProjects - liveProjects - totalDeployments - activeWorkflows - avgSecurityScore - tokensUsedToday - costToday - recentActivity Conversation: type: object properties: id: type: string projectId: type: string title: type: string modelId: type: string totalTokens: type: string createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - projectId - title - modelId - totalTokens - createdAt - updatedAt ConversationMessage: type: object properties: id: type: string conversationId: type: string projectId: type: string role: type: string enum: [user, assistant, system] content: type: string modelId: type: string tokensUsed: type: integer createdAt: type: string format: date-time required: - id - conversationId - projectId - role - content - createdAt SendMessageRequest: type: object properties: conversationId: type: string content: type: string taskType: type: string enum: [code_generation, ui_styling, architecture, security_audit, debugging, general] required: - content SendMessageResponse: type: object properties: userMessage: $ref: "#/components/schemas/ConversationMessage" assistantMessage: $ref: "#/components/schemas/ConversationMessage" modelUsed: type: string tokensUsed: type: integer conversationId: type: string required: - userMessage - assistantMessage - modelUsed - tokensUsed - conversationId ProjectVersion: type: object properties: id: type: string projectId: type: string version: type: string major: type: integer minor: type: integer patch: type: integer changelog: type: string deployedUrl: type: string securityScore: type: integer createdAt: type: string format: date-time required: - id - projectId - version - major - minor - patch - changelog - createdAt CreateVersionRequest: type: object properties: changelog: type: string bumpType: type: string enum: [major, minor, patch] required: - changelog - bumpType SecurityChecklist: type: object properties: projectId: type: string authConfigured: type: boolean rateLimitingEnabled: type: boolean inputValidation: type: boolean corsConfigured: type: boolean helmetEnabled: type: boolean envSecretsProtected: type: boolean sqlInjectionPrevented: type: boolean xssProtection: type: boolean httpsOnly: type: boolean dependenciesScanned: type: boolean passed: type: boolean score: type: integer lastCheckedAt: type: string format: date-time passedAt: type: string format: date-time required: - projectId - authConfigured - rateLimitingEnabled - inputValidation - corsConfigured - helmetEnabled - envSecretsProtected - sqlInjectionPrevented - xssProtection - httpsOnly - dependenciesScanned - passed - score UpdateChecklistItemRequest: type: object properties: value: type: boolean required: - value AiRouteRequest: type: object properties: taskType: type: string enum: [code_generation, ui_styling, architecture, security_audit, debugging, general] complexity: type: number minimum: 0 maximum: 1 required: - taskType AiRouteResponse: type: object properties: modelId: type: string modelName: type: string tier: type: string enum: [fast, balanced, powerful] reason: type: string estimatedTokens: type: integer estimatedCostUsd: type: number required: - modelId - modelName - tier - reason UsageSummary: type: object properties: todayTokens: type: integer todayCostUsd: type: number monthTokens: type: integer monthCostUsd: type: number totalTokens: type: integer totalCostUsd: type: number byModel: type: array items: type: object properties: modelId: type: string tokens: type: integer costUsd: type: number required: - modelId - tokens - costUsd byProject: type: array items: type: object properties: projectId: type: string tokens: type: integer costUsd: type: number required: - projectId - tokens - costUsd required: - todayTokens - todayCostUsd - monthTokens - monthCostUsd - totalTokens - totalCostUsd - byModel - byProject Notification: type: object properties: id: type: string type: type: string enum: [generation_complete, generation_failed, deployment_live, deployment_failed, scan_complete, scan_critical, agent_fix, billing, system] title: type: string body: type: string projectId: type: string projectName: type: string read: type: boolean deepLink: type: string createdAt: type: string format: date-time required: - id - type - title - body - read - createdAt UnreadCount: type: object properties: count: type: integer required: - count SuccessResponse: type: object properties: success: type: boolean required: - success PushTokenRequest: type: object properties: token: type: string platform: type: string enum: [ios, android, web] required: - token - platform AgentStatus: type: object properties: mode: type: string enum: [active, paused] isScanning: type: boolean lastScanAt: type: string format: date-time totalFixesApplied: type: integer totalIssuesDetected: type: integer uptime: type: number health: type: string enum: [nominal, degraded, error] required: - mode - isScanning - lastScanAt - totalFixesApplied - totalIssuesDetected - uptime - health AgentFix: type: object properties: id: type: string issue: type: string severity: type: string enum: [critical, high, medium, low] category: type: string enum: [security, performance, type_error, config, dependency] description: type: string solution: type: string status: type: string enum: [detected, researching, applied, verified, failed] projectId: type: string projectName: type: string autoApplied: type: boolean createdAt: type: string format: date-time resolvedAt: type: string format: date-time required: - id - issue - severity - category - description - status - autoApplied - createdAt ScanJob: type: object properties: jobId: type: string status: type: string startedAt: type: string format: date-time required: - jobId - status - startedAt Subscription: type: object properties: plan: type: string enum: [free, pro, enterprise] status: type: string enum: [active, cancelled, expired] billingCycle: type: string enum: [monthly, yearly] currentPeriodEnd: type: string format: date-time usage: type: object properties: aiTokensUsed: type: integer aiTokensLimit: type: integer projectsCount: type: integer projectsLimit: type: integer deploymentsThisMonth: type: integer deploymentsLimit: type: integer required: - aiTokensUsed - aiTokensLimit - projectsCount - projectsLimit - deploymentsThisMonth - deploymentsLimit features: type: array items: type: string required: - plan - status - billingCycle - currentPeriodEnd - usage - features Plan: type: object properties: name: type: string price: type: number features: type: array items: type: string limits: type: object properties: projects: type: integer tokens: type: integer deployments: type: integer required: - projects - tokens - deployments required: - name - price - features - limits UpgradeRequest: type: object properties: plan: type: string enum: [pro, enterprise] required: - plan UpgradeResponse: type: object properties: success: type: boolean subscription: $ref: "#/components/schemas/Subscription" checkoutUrl: type: string required: - success BuilderProject: type: object properties: id: type: string name: type: string description: type: ["string", "null"] htmlContent: type: ["string", "null"] previewUrl: type: ["string", "null"] messageCount: type: integer snapshotCount: type: integer createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - name - messageCount - snapshotCount - createdAt - updatedAt BuilderProjectDetail: type: object properties: id: type: string name: type: string description: type: ["string", "null"] htmlContent: type: ["string", "null"] previewUrl: type: ["string", "null"] messages: type: array items: $ref: "#/components/schemas/BuilderMessage" snapshots: type: array items: $ref: "#/components/schemas/BuilderSnapshot" createdAt: type: string format: date-time updatedAt: type: string format: date-time required: - id - name - messages - snapshots - createdAt - updatedAt BuilderProjectInput: type: object properties: name: type: string description: type: string required: - name BuilderProjectUpdate: type: object properties: name: type: string description: type: string htmlContent: type: string previewUrl: type: string BuilderMessage: type: object properties: id: type: string projectId: type: string role: type: string enum: [user, assistant] content: type: string model: type: ["string", "null"] tokensUsed: type: ["integer", "null"] createdAt: type: string format: date-time required: - id - projectId - role - content - createdAt BuilderGenerateInput: type: object properties: prompt: type: string taskType: type: string enum: [ui, logic, debug, general] currentHtml: type: string conversationHistory: type: array items: type: object properties: role: type: string enum: [user, assistant] content: type: string required: - role - content required: - prompt BuilderGenerateResult: type: object properties: html: type: string explanation: type: string model: type: string tokensUsed: type: integer messageId: type: string required: - html - model - tokensUsed - messageId BuilderSnapshot: type: object properties: id: type: string projectId: type: string label: type: string htmlContent: type: string createdAt: type: string format: date-time required: - id - projectId - label - htmlContent - createdAt BuilderSnapshotInput: type: object properties: label: type: string htmlContent: type: string required: - label - htmlContent BuilderSettings: type: object properties: openrouterKeyConfigured: type: boolean openrouterKeyMasked: type: ["string", "null"] activeModel: type: string fallbackModel: type: string premiumModelsEnabled: type: boolean freeModels: type: array items: type: string premiumModels: type: array items: type: string required: - openrouterKeyConfigured - activeModel - fallbackModel - premiumModelsEnabled - freeModels - premiumModels BuilderSettingsUpdate: type: object properties: openrouterApiKey: type: string activeModel: type: string premiumModelsEnabled: type: boolean