{"openapi":"3.1.0","info":{"title":"Stacksync Enterprise OS API","version":"2.0.0","description":"Workspace-scoped application and database management. Resource access requires current workspace membership and a direct or group grant. Highest role wins: owner > editor > viewer > operator. Owners manage grants and delete resources; editors modify configuration and read secrets; viewers receive allowlisted metadata only; operators cannot use management endpoints. These rules apply to UI sessions and CLI bearer tokens, without an administrator bypass. Use /workspace/{workspace_id}/api/... for workspace-scoped requests. Legacy /api/... endpoints still accept X-Workspace-Id; if both are supplied, they must match. Invalid API scope returns an error, never a fallback write. Dashboard URLs use /workspace/{workspace_id}/...; missing or inaccessible dashboard scope falls back to the current default."},"paths":{"/api/access/{kind}/{id}":{"parameters":[{"in":"path","name":"kind","required":true,"schema":{"type":"string","enum":["apps","databases","inference","storage"]}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"get":{"summary":"List resource grants and sharing directory (owner only)","responses":{"200":{"description":"Success"},"403":{"description":"Owner required"},"404":{"description":"Resource not found"}}},"put":{"summary":"Set a user, group, or pending invitation grant (owner only)","responses":{"204":{"description":"Success"},"403":{"description":"Owner required"},"404":{"description":"Resource not found"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","subjectId","role"],"properties":{"type":{"type":"string","enum":["user","group","invitation"]},"subjectId":{"type":"string"},"role":{"type":"string","enum":["owner","editor","viewer","operator"]}}}}}}},"delete":{"summary":"Remove a user or group grant (owner only)","responses":{"204":{"description":"Success"},"403":{"description":"Owner required"},"404":{"description":"Resource not found"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","subjectId"],"properties":{"type":{"type":"string","enum":["user","group","invitation"]},"subjectId":{"type":"string"},"role":{"type":"string","enum":["owner","editor","viewer","operator"]}}}}}}}},"/api/deployments":{"get":{"summary":"List deployment versions, optionally filtered by project","parameters":[{"in":"query","name":"project","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deployment summaries without environment-variable values or log bodies"},"404":{"description":"Project not found"}}},"post":{"summary":"Create or update an application","description":"Waits for the application to deploy. Omitted variables retain their previous values; supplied keys are upserted.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["project"],"oneOf":[{"required":["file"]},{"required":["uploadId"]}],"properties":{"project":{"type":"string","minLength":1,"maxLength":63,"pattern":"^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$","description":"Immutable URL-safe name unique within the selected workspace. For new apps, the combined {project}-w{workspace_id} DNS label must not exceed 63 characters. New apps use {project}-w{workspace_id}.stacksync.app. Existing app URLs and service IDs are preserved.","example":"my-project"},"memory":{"type":"string","enum":["512Mi","1Gi","2Gi","4Gi"],"description":"Memory per container. Omitted values retain the last successful deployment setting or server default. Changes create a new version."},"maxInstances":{"type":"integer","minimum":1,"maximum":20,"description":"Maximum container instances per application version. Omitted values retain the last successful deployment setting or server default."},"uploadId":{"type":"string","format":"uuid","description":"Completed chunk upload ID, supplied instead of file"},"file":{"type":"string","format":"binary","description":"ZIP archive containing the application source at its root"},"variables":{"type":"string","description":"JSON object encoded as a multipart text field","example":"{\"API_URL\":\"https://example.com\"}"}}}}}},"responses":{"200":{"description":"Existing service updated successfully"},"201":{"description":"New service created successfully"},"400":{"description":"Invalid project, variables, or ZIP"},"409":{"description":"Another deployment for this project is running"},"500":{"description":"Build or application deployment failed"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/deployments/{id}":{"get":{"summary":"Get one deployment and its logs by ID","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Deployment and structured customer-safe events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentEvent"}},"logs":{"type":"string","description":"Compatibility text generated only from customer events."}}}}}},"404":{"description":"Not found"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/deployments/{id}/logs":{"get":{"summary":"Get plain-text build and rollout logs for one deployment","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Customer-safe events formatted as text/plain"},"400":{"description":"Invalid deployment ID"},"404":{"description":"Not found"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/deployments/{id}/variables":{"get":{"summary":"Get the environment variables saved for one deployment","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Saved environment-variable object"},"400":{"description":"Invalid deployment ID"},"404":{"description":"Not found"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/deployments/{id}/files":{"get":{"summary":"List retained source files or preview a single UTF-8 file (up to 2 MB)","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}},{"in":"query","name":"path","description":"Exact archive file path; omit to list entries","schema":{"type":"string"}}],"responses":{"200":{"description":"Entry listing, file text, or an unsupported-preview reason"},"400":{"description":"Invalid deployment ID or path"},"404":{"description":"Deployment or file not found"},"409":{"description":"Source archive unavailable"},"413":{"description":"Archive or preview limit exceeded"},"422":{"description":"Invalid source archive"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/deployments/{id}/source":{"get":{"summary":"Download the retained source ZIP for one deployment","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Source archive as application/zip"},"404":{"description":"Not found"},"409":{"description":"Source archive unavailable"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/deployments/{id}/cancel":{"post":{"summary":"Cancel an active deployment (Editor or Owner)","description":"Stops remaining deployment steps and cancels queued or running build jobs. Idempotent for cancelling/cancelled deployments. Already applied rollout changes are not rolled back. Poll the deployment until status is cancelled before deploying again.","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Deployment cancelled; another deployment can start"},"202":{"description":"Cancellation requested; active work is stopping"},"403":{"description":"Editor access required"},"404":{"description":"Deployment not found"},"409":{"description":"Deployment has already finished"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/deployments/{id}/retry":{"post":{"summary":"Retry a deployment using its retained source archive, optionally upserting or deleting individual environment variables","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"memory":{"type":"string","enum":["512Mi","1Gi","2Gi","4Gi"]},"maxInstances":{"type":"integer","minimum":1,"maximum":20},"variable_changes":{"type":"object","description":"Apply changes to the selected deployment snapshot. Omitted keys are retained. Cannot be combined with variables.","additionalProperties":false,"properties":{"upsert":{"type":"object","additionalProperties":{"type":["string","number","boolean"]}},"delete":{"type":"array","items":{"type":"string"}}}},"variables":{"type":"object","additionalProperties":{"type":["string","number","boolean"]}}}}}}},"responses":{"200":{"description":"New version deployed successfully"},"409":{"description":"Source archive is unavailable"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/apps":{"get":{"summary":"List all applications","responses":{"200":{"description":"Application list"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/projects":{"get":{"summary":"List project summaries without environment-variable values","responses":{"200":{"description":"Project summary list"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/ui/me":{"get":{"summary":"Get the signed-in UI user","responses":{"200":{"description":"Current UI identity"},"401":{"description":"UI sign-in required"}}}},"/api/apps/{project}":{"get":{"summary":"Get one application","parameters":[{"in":"path","name":"project","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Application"},"404":{"description":"Not found"}}},"delete":{"summary":"Permanently remove an application and its deployed service","parameters":[{"in":"path","name":"project","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["confirmDelete","confirmProject"],"properties":{"confirmDelete":{"type":"boolean","const":true},"confirmProject":{"type":"string"}}}}}},"responses":{"200":{"description":"Service, history, and retained archives removed"},"400":{"description":"Double confirmation missing or mismatched"},"409":{"description":"Deployment currently active"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/apps/{project}/deployments":{"get":{"summary":"Get deployment history and diagnostic logs","parameters":[{"in":"path","name":"project","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Recent deployments including failure logs"},"404":{"description":"Not found"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases":{"get":{"summary":"List only managed databases shared with the authenticated user","responses":{"200":{"description":"Database metadata without credentials"}}},"post":{"summary":"Provision an isolated PostgreSQL database and user","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Database, user, generated tenant password, and connection string created"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/users":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"List users with explicit access to a database","responses":{"200":{"description":"Resource members"},"404":{"description":"Database not found or not shared with you"}}},"post":{"summary":"Share database access with an existing member of the selected workspace","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"201":{"description":"Updated resource members"},"404":{"description":"Database not found or not shared with you"}}}},"/api/databases/{id}/users/{userId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"userId","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"$ref":"#/components/parameters/workspace"}],"delete":{"summary":"Remove another member’s dashboard and API access to a database","responses":{"200":{"description":"Updated members"},"400":{"description":"Cannot remove your own access"},"404":{"description":"Database or member not found"}}}},"/api/databases/{id}/credentials":{"get":{"summary":"Retrieve and audit the generated tenant password and full connection string","responses":{"200":{"description":"Managed database credentials"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}":{"patch":{"summary":"Rename a managed database display name without changing its PostgreSQL database, role, or credentials","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":80}}}}}},"responses":{"200":{"description":"Updated database metadata"},"404":{"description":"Database not found"},"409":{"description":"Display name already exists"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/schema":{"get":{"summary":"Inspect schemas, tables, and columns","responses":{"200":{"description":"Schema tree"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/table-ddl":{"get":{"summary":"Export the selected table definition, constraints and indexes without row data","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"query","name":"schema","required":true,"schema":{"type":"string"}},{"in":"query","name":"table","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"DDL SQL in the ddl field"},"400":{"description":"Invalid schema or table name"},"404":{"description":"Database or table not found"},"503":{"description":"PostgreSQL client unavailable"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/workspace":{"get":{"summary":"Load only the authenticated user’s saved SQL tabs for this database","responses":{"200":{"description":"Ordered tabs, activeTabId and version"},"404":{"description":"Database not accessible"}}},"put":{"summary":"Autosave ordered SQL tabs with optimistic concurrency","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tabs","activeTabId","version"],"properties":{"tabs":{"type":"array","maxItems":50,"items":{"type":"object","required":["id","label","sql"],"properties":{"id":{"type":"integer"},"label":{"type":"string"},"sql":{"type":"string","maxLength":100000},"tableKey":{"type":["string","null"]}}}},"activeTabId":{"type":["integer","null"]},"version":{"type":"integer","minimum":0}}}}}},"responses":{"200":{"description":"New version and saved timestamp"},"400":{"description":"Invalid workspace or over 500 KB"},"404":{"description":"Database not accessible"},"409":{"description":"Workspace changed in another window"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/ai":{"get":{"summary":"Read Gemini suggestion availability without exposing credentials","responses":{"200":{"description":"enabled and model"},"404":{"description":"Database not accessible"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/ai-completion":{"post":{"summary":"Suggest SQL at the cursor using before/after strings and this database’s schema; does not execute SQL","responses":{"200":{"description":"completion text and replaceText (the exact leading SQL after the cursor to replace); empty values mean no change"},"400":{"description":"Invalid input or editor exceeds 80 KB"},"429":{"description":"Rate or provider quota limit"},"503":{"description":"Gemini not configured"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/ai-assist":{"post":{"summary":"Improve selected SQL or answer a question using action (improve/ask), selected, before, after and question strings","responses":{"200":{"description":"Answer, optional SQL replacement, exact original SQL and replaceRange with UTF-16 start/end offsets for review"},"400":{"description":"Invalid selection or question"},"429":{"description":"Rate or provider quota limit"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/lint":{"post":{"summary":"Check PostgreSQL syntax without executing SQL; returns diagnostics with one-based line and column positions","responses":{"200":{"description":"Syntax diagnostics (empty for valid SQL)"},"400":{"description":"Invalid SQL input or input exceeds 100 KB"},"404":{"description":"Database not found or not shared with you"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/query":{"post":{"summary":"Run SQL as the isolated tenant user","responses":{"200":{"description":"Fields and up to 1,000 result rows"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/databases/{id}/audit":{"get":{"summary":"List credential and database audit events","responses":{"200":{"description":"Audit history"}}},"parameters":[{"$ref":"#/components/parameters/workspace"}]},"/api/system/load":{"get":{"summary":"Get current normalized load, memory, and storage usage","responses":{"200":{"description":"Current VM resource metrics"}}}},"/api/system/metrics":{"get":{"summary":"Get current VM resources and five-second samples from the last 24 hours","responses":{"200":{"description":"Current metrics and retained history"}}}},"/health":{"get":{"summary":"Health check","responses":{"200":{"description":"Healthy"}},"security":[]}},"/api/workspaces":{"get":{"summary":"List your workspaces","parameters":[{"in":"query","name":"search","schema":{"type":"string","minLength":1,"maxLength":80},"description":"Optional case-insensitive literal substring of the workspace name; only your accessible workspaces are returned."}],"responses":{"200":{"description":"Workspace IDs, names and your roles"}}},"post":{"summary":"Create a workspace owned by you","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80}}}}}},"responses":{"201":{"description":"Created workspace"}}}},"/api/workspaces/search":{"get":{"summary":"Search your accessible workspaces by name","parameters":[{"in":"query","name":"q","required":true,"schema":{"type":"string","minLength":1,"maxLength":80},"description":"Case-insensitive literal substring; matches workspace names, not IDs."}],"responses":{"200":{"description":"Matching workspaces in the same order as the workspace list"},"400":{"description":"Missing or invalid search term"}}}},"/api/workspaces/{id}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"get":{"summary":"Get workspace settings, members and pending invitations","responses":{"200":{"description":"Workspace settings"},"404":{"description":"Not a workspace member"}}},"patch":{"summary":"Rename a workspace (owner or admin)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80}}}}}},"responses":{"200":{"description":"Updated workspace"},"403":{"description":"Workspace admin required"}}}},"/api/workspaces/{id}/members":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"get":{"summary":"List workspace users; admins also receive pending invitations","responses":{"200":{"description":"users and invitations arrays; invitations empty for members"},"404":{"description":"Not a workspace member"}}}},"/api/workspaces/{id}/groups":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"get":{"summary":"List all workspace groups for admins, only own groups for members","responses":{"200":{"description":"Filtered groups array"},"404":{"description":"Not a workspace member"}}},"post":{"summary":"Create a workspace group (Admin only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"memberIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"}},"invitationIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"}},"subjectType":{"type":"string","enum":["user","invitation"],"description":"Required for management-token requests with initial recipients; must match the populated array"}},"required":["name","memberIds"]}}}},"responses":{"201":{"description":"Created group with member_ids"},"400":{"description":"Invalid members or incompatible group grants; groups with external operators are app-Operator-only"},"403":{"description":"Admin required"},"409":{"description":"Group name already exists"}}}},"/api/workspaces/{id}/groups/{groupId}/members":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"groupId","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"}}],"post":{"summary":"Add group members atomically (Admin only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","invitation"]},"subjectIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"minItems":1}},"required":["subjectType","subjectIds"]}}}},"responses":{"200":{"description":"Updated group, member_ids and invitation_ids; only explicitly typed recipients are changed"},"400":{"description":"Invalid or missing subject type, ineligible users or non-pending invitations; no partial changes"},"403":{"description":"Admin required"},"404":{"description":"Workspace or group unavailable"}}},"delete":{"summary":"Remove group members atomically (Admin only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","invitation"]},"subjectIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"minItems":1}},"required":["subjectType","subjectIds"]}}}},"responses":{"200":{"description":"Updated group, member_ids and invitation_ids; only explicitly typed recipients are changed"},"400":{"description":"Invalid or missing subject type, ineligible users or non-pending invitations; no partial changes"},"403":{"description":"Admin required"},"404":{"description":"Workspace or group unavailable"}}}},"/api/workspaces/{id}/select":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"Workspace ID, or a URL-encoded name substring. Numeric values are IDs. Name matching is case-insensitive and must resolve to exactly one accessible workspace."}],"post":{"summary":"Select a workspace by ID or unambiguous name substring","responses":{"200":{"description":"Selected workspace; CLI must persist its returned ID locally and send X-Workspace-Id"},"400":{"description":"Invalid search term"},"404":{"description":"Not a workspace member or no matching workspace"},"409":{"description":"WORKSPACE_AMBIGUOUS with matching workspaces; no selection changed. Retry with an explicit ID."}}}},"/api/workspaces/{id}/invitations":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"post":{"summary":"Create an expiring invitation and email the recipient (owner or admin)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","member","external_operator"]}}}}}},"responses":{"201":{"description":"Admin/member: invitation metadata and invitePath. External operator: immediate user membership, no email or invitation."}},"description":"Guest owners must sign in and claim this workspace before inviting members or adding External Operators. Signing in alone does not claim a workspace."}},"/api/workspace-invitations/accept":{"post":{"summary":"Accept an invitation while signed in with its recipient email","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Workspace membership created; assigned pending group memberships and resource grants activate"},"404":{"description":"Expired, revoked, consumed or wrong recipient"}}}},"/api/workspaces/{id}/members/{userId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"userId","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Remove a workspace member and revoke resource grants","responses":{"204":{"description":"Removed"},"400":{"description":"Cannot remove the last admin or a sole resource owner"},"403":{"description":"Workspace admin required"}}}},"/api/workspaces/{id}/invitations/{invitationId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"invitationId","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Revoke an unused workspace invitation","responses":{"204":{"description":"Revoked"},"403":{"description":"Workspace admin required"}}}},"/api/profile/api-keys":{"get":{"summary":"List personal key metadata for the authenticated user","responses":{"200":{"description":"Keys without secrets or hashes"}}},"post":{"summary":"Create a personal runtime API key (two UUIDs without dashes)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":40}},"required":["name"]}}}},"responses":{"201":{"description":"Key metadata and token; token is shown only once"}}}},"/api/profile/api-keys/{keyId}":{"parameters":[{"in":"path","name":"keyId","required":true,"schema":{"type":"string","format":"uuid"}}],"delete":{"summary":"Revoke your personal API key","responses":{"204":{"description":"Revoked"},"404":{"description":"Key not found or belongs to another user"}}}},"/api/profile":{"get":{"summary":"Get your profile","responses":{"200":{"description":"ID, name and email"}}},"patch":{"summary":"Update your name; email changes require the separate verification flow","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated profile"},"403":{"description":"Email change requires verification"}}}},"/api/profile/email-change":{"post":{"summary":"Send a six-digit verification code to a new email address","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]}}}},"responses":{"200":{"description":"requestId, normalized email and expiresInSeconds (600); account email remains unchanged"},"403":{"description":"Incorrect current password"},"409":{"description":"Email already in use"},"429":{"description":"Resend or attempt limit reached"},"503":{"description":"Email delivery unavailable"}}}},"/api/profile/email-change/confirm":{"post":{"summary":"Verify the code and atomically change your email","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"code":{"type":"string","pattern":"^[0-9]{6}$"}},"required":["requestId","code"]}}}},"responses":{"200":{"description":"Updated profile"},"400":{"description":"Invalid, expired, used or attempt-limited code"},"409":{"description":"Email already in use"}}}},"/api/access/apps/{id}/runtime-policy":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]*$"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"Read an app runtime access preset (resource owner only)","responses":{"200":{"description":"policy and enforcement (active)"},"403":{"description":"Resource owner required"}}},"patch":{"summary":"Save an app runtime access preset (resource owner only)","description":"Updates the access policy evaluated by managed authentication on subsequent app requests. Does not alter direct origin access controls. New apps default to entire_workspace (All workspace members). Existing apps retain their selected policy. Workspace administration does not grant permission to change this setting.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["policy"],"properties":{"policy":{"type":"string","enum":["specific_members","entire_workspace","public_authenticated","public"]}}}}}},"responses":{"200":{"description":"Saved policy and enforcement (active)"},"400":{"description":"Invalid policy"},"403":{"description":"Resource owner required"},"404":{"description":"App not found or inaccessible"}}}},"/api/runtime/sessions/start":{"post":{"summary":"Create a browser login transaction (Worker only)","security":[{"runtimeWorker":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hostname","state","code_challenge"],"properties":{"hostname":{"type":"string","description":"Exact registered app hostname"},"state":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"code_challenge":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$","description":"SHA-256 PKCE challenge, base64url encoded"},"return_to":{"type":"string","description":"App-local path; defaults to /"}}}}}},"responses":{"200":{"description":"authorization_url on EOS, with transaction in fragment; ten-minute lifetime"},"400":{"description":"Invalid request"},"401":{"description":"Worker key required"},"404":{"description":"App unavailable"}}}},"/api/runtime/sessions/exchange":{"post":{"summary":"Exchange a single-use code and PKCE verifier (Worker only)","security":[{"runtimeWorker":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hostname","code","state","code_verifier"],"properties":{"hostname":{"type":"string","description":"Exact registered app hostname"},"code":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"state":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"},"code_verifier":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}}}}}},"responses":{"200":{"description":"token (opaque app session), return_to, expires_in (at most eight hours and capped to parent EOS session)"},"400":{"description":"Expired, consumed, or incorrectly bound code"},"401":{"description":"Worker key required"}}}},"/api/runtime/sessions/revoke":{"post":{"summary":"Revoke a hostname-bound app session (Worker only)","security":[{"runtimeWorker":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hostname","token"],"properties":{"hostname":{"type":"string","description":"Exact registered app hostname"},"token":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}}}}}},"responses":{"204":{"description":"Revoked or already absent"},"401":{"description":"Worker key required"}}}},"/auth/apps/authorize":{"get":{"summary":"Public same-origin browser sign-in bridge; request transaction is in the URL fragment","security":[],"responses":{"200":{"description":"HTML page; no-store, CSP and no-referrer"}}},"post":{"summary":"Authorize an app sign-in using the existing EOS browser session","security":[{"eosBrowserSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["request"],"properties":{"request":{"type":"string","pattern":"^[A-Za-z0-9_-]{43}$"}}}}}},"responses":{"200":{"description":"redirect_url to the exact app callback with a 60-second single-use code; concurrent tabs in the same EOS session receive pending:true until completion, then redirect_url to the original app path"},"401":{"description":"login_url preserving the transaction"},"403":{"description":"Same-origin Origin header required"},"404":{"description":"App unavailable or user lacks access"}}}},"/api/runtime/authorize":{"post":{"summary":"Evaluate app runtime access for a trusted Worker","description":"No workspace header or end-user authentication is required. Worker authentication is mandatory. Every successful evaluation returns HTTP 200: inspect decision, action and http_status. Never forward on HTTP errors, unknown decisions or unavailable EOS. No caching. eos_session means an EOS dashboard session. app_session means a hostname-bound browser app session linked to its originating EOS login. Managed authentication enforces this decision for app requests.","security":[{"runtimeWorker":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hostname","request"],"properties":{"identity_version":{"type":"integer","enum":[1,2],"default":1,"description":"New Workers send 2 for the five-field identity. Omitted/1 temporarily supports the legacy Worker contract during rollout."},"hostname":{"type":"string","example":"my-app-w123.stacksync.app","description":"Actual requested Stacksync hostname, without scheme, port or path. Exact registered app identity is checked."},"request":{"type":"object","required":["method","path"],"properties":{"method":{"type":"string","enum":["GET","HEAD","POST","PUT","PATCH","DELETE","OPTIONS","CONNECT","TRACE"]},"path":{"type":"string","maxLength":8192,"example":"/api/orders"}}},"credential":{"type":["object","null"],"required":["type","value"],"properties":{"type":{"type":"string","enum":["personal_api_key","eos_session","app_session"]},"value":{"type":"string","maxLength":4096,"writeOnly":true}}}}}}}},"responses":{"200":{"description":"Decision; http_status is suggested client status, not the status of this API call","content":{"application/json":{"schema":{"type":"object","required":["decision","action","authorized","authenticated","http_status","identity","cache_ttl_seconds","enforcement"],"properties":{"decision":{"type":"string","enum":["user_authorized","user_not_authorized","authentication_required","app_public"]},"action":{"type":"string","enum":["forward","reject","authenticate"]},"authorized":{"type":"boolean"},"authenticated":{"type":"boolean"},"http_status":{"type":"integer","enum":[200,401,404]},"enforcement":{"const":"active"},"cache_ttl_seconds":{"const":0},"app_id":{"type":"string"},"policy":{"type":"string","enum":["specific_members","entire_workspace","public_authenticated","public"]},"message":{"type":"string"},"identity":{"type":["object","null"],"additionalProperties":false,"required":["app_id","user_id","email","eos_resource_role","app_role"],"properties":{"app_id":{"type":"string"},"user_id":{"type":"string"},"email":{"type":"string"},"eos_resource_role":{"type":"string","enum":["operator","viewer","editor","owner"]},"app_role":{"type":["string","null"],"description":"Custom role ID scoped to this app, or null"}}}}}}}},"400":{"description":"Malformed query; reject"},"401":{"description":"Invalid Worker credential; reject"},"503":{"description":"Unconfigured or unavailable authorization service; reject"}}}},"/api/access/apps/{id}/app-roles":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"List custom app roles","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"post":{"summary":"Create a custom app role","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Success"},"201":{"description":"Created role"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/app-roles/{roleId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"roleId","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"}}],"put":{"summary":"Update role name/description; ID is immutable","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"delete":{"summary":"Delete an unassigned role","responses":{"200":{"description":"Success"},"204":{"description":"Deleted"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/app-members":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"List explicit app members and custom role assignments","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"put":{"summary":"Add or update an app member with default EOS Operator access","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"user_id":{"type":"string"},"app_role":{"type":["string","null"]}},"description":"Use email to add a user, or user_id to update a known user. App role is a custom role ID; null clears it. No EOS infrastructure privilege is granted."}}}},"responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/app-members/{userId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"userId","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Remove app membership (independent EOS grants and public policies still apply)","responses":{"200":{"description":"Success"},"204":{"description":"Removed"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/app-access/v1/roles":{"parameters":[],"get":{"security":[{"appAccessToken":[]}],"summary":"List custom app roles","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"post":{"security":[{"appAccessToken":[]}],"summary":"Create a custom app role","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Success"},"201":{"description":"Created role"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/app-access/v1/roles/{roleId}":{"parameters":[{"in":"path","name":"roleId","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"}}],"put":{"security":[{"appAccessToken":[]}],"summary":"Update role name/description; ID is immutable","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"delete":{"security":[{"appAccessToken":[]}],"summary":"Delete an unassigned role","responses":{"200":{"description":"Success"},"204":{"description":"Deleted"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/app-access/v1/users":{"parameters":[],"get":{"security":[{"appAccessToken":[]}],"summary":"List explicit app members and custom role assignments","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"put":{"security":[{"appAccessToken":[]}],"summary":"Add or update an app member with default EOS Operator access","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"user_id":{"type":"string"},"app_role":{"type":["string","null"]}},"description":"Use email to add a user, or user_id to update a known user. App role is a custom role ID; null clears it. No EOS infrastructure privilege is granted."}}}},"responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/app-access/v1/users/{userId}":{"parameters":[{"in":"path","name":"userId","required":true,"schema":{"type":"string"}}],"delete":{"security":[{"appAccessToken":[]}],"summary":"Remove app membership (independent EOS grants and public policies still apply)","responses":{"200":{"description":"Success"},"204":{"description":"Removed"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/app-role-invitations":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"List pending app role assignments (Owner only)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/app-role-invitations/{invitationId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"invitationId","required":true,"schema":{"type":"string"}}],"put":{"summary":"Assign a custom role activated only on invitation acceptance","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"app_role":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"Success"},"204":{"description":"Assignment saved"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/app-tokens":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"List app access token metadata (Owner only)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"post":{"summary":"Create an app access token (Owner only); secret returned once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80}}}}}},"responses":{"200":{"description":"Success"},"201":{"description":"id, name, prefix, created_at, token. Store token privately in server-side deployment variables."},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/app-tokens/{tokenId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"tokenId","required":true,"schema":{"type":"string","format":"uuid"}}],"delete":{"summary":"Revoke one app access token; other tokens remain active","responses":{"200":{"description":"Success"},"204":{"description":"Revoked"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/api/access/apps/{id}/domains":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"get":{"summary":"List app custom domains and DNS instructions (editor or owner)","responses":{"200":{"description":"domains and routing_enabled; records contain type, name and value"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}},"post":{"summary":"Reserve a custom hostname for an app (editor or owner)","description":"Idempotent for the same hostname and app. Only verified workspace ID 1 may reserve stacksync.com hostnames; eos.stacksync.com and its subdomains remain reserved everywhere, as do stacksync.ai and stacksync.app. DNS ownership TXT proof is required before provider registration. Verification and HTTPS activation run asynchronously.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hostname"],"properties":{"hostname":{"type":"string","example":"portal.example.com"}}}}}},"responses":{"202":{"description":"domain with DNS instructions"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}}},"/api/access/apps/{id}/domains/{domainId}/verify":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"domainId","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Queue DNS and certificate verification","responses":{"202":{"description":"Verification queued; poll the list endpoint"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}}},"/api/access/apps/{id}/domains/{domainId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"domainId","required":true,"schema":{"type":"string","format":"uuid"}}],"delete":{"summary":"Disable a domain immediately and queue certificate cleanup","responses":{"202":{"description":"Domain is deleting; existing app URLs remain available"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}}},"/api/inference/keys":{"parameters":[{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"List only owned or explicitly shared inference keys and spending","responses":{"200":{"description":"keys array including can_manage, spent, reserved, remaining, period_start and resets_at; monetary values are exact decimal strings; no key secrets"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"post":{"summary":"Create an inference key with a recurring USD budget","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","cost_limit","reset_count","reset_unit"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"cost_limit":{"type":"number","minimum":0,"maximum":1000000,"multipleOf":0.01},"reset_count":{"type":"integer","minimum":1,"maximum":365},"reset_unit":{"type":"string","enum":["days","weeks","months"]}}}}}},"responses":{"201":{"description":"key metadata and api_key; the secret is returned only once"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/keys/{id}":{"parameters":[{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Read an owned or explicitly shared key and its usage","responses":{"200":{"description":"key metadata and can_manage; never returns the secret"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"patch":{"summary":"Rename a key or change its limit","description":"Supply the existing reset schedule. Schedule and anchor are immutable; changing limits does not reset spending.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","cost_limit","reset_count","reset_unit"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"cost_limit":{"type":"number","minimum":0,"maximum":1000000,"multipleOf":0.01},"reset_count":{"type":"integer","minimum":1,"maximum":365},"reset_unit":{"type":"string","enum":["days","weeks","months"]}}}}}},"responses":{"200":{"description":"Updated key and usage"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"409":{"description":"Key revoked or schedule changed"},"503":{"description":"Service unavailable"}}},"delete":{"summary":"Revoke or delete an owned key","parameters":[{"in":"query","name":"remove","schema":{"type":"boolean","default":false},"description":"true permanently disables and removes the key from listings and denies access to details and logs, including shared members. Internal accounting records are retained. Omit to revoke while retaining visible history."}],"responses":{"204":{"description":"Revoked or deleted"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/keys/{id}/logs":{"parameters":[{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"before","schema":{"type":"string"},"description":"next_cursor returned by the previous page"}],"get":{"summary":"Read asynchronous logs for an owned or explicitly shared key","description":"Newest first, 100 per page. Cache status and cached-token count included; null cache status means unknown. No prompts or responses. Null cost means unconfirmed usage, with the reservation retained.","responses":{"200":{"description":"logs and next_cursor"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/keys/{id}/users":{"parameters":[{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"List people with access to this key","responses":{"200":{"description":"users with Owner or Viewer access_role"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"post":{"summary":"Owner shares view access with an existing workspace member","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Updated users; no key secret is shared"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/keys/{id}/users/{userId}":{"parameters":[{"$ref":"#/components/parameters/workspace"},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"userId","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]*$"}}],"delete":{"summary":"Owner removes shared view access","responses":{"200":{"description":"Updated users"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/usage":{"parameters":[{"$ref":"#/components/parameters/workspace"},{"in":"query","name":"before","schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Workspace billing ledger (owner/admin only)","description":"All-time customer charges as exact USD decimal strings, including deleted keys. entries are newest first, 100 per page; next_cursor paginates. Unknown costs remain unconfirmed and are excluded from total_cost until resolved. No private request content. Key deletion never removes charges.","responses":{"200":{"description":"total_cost, unconfirmed_requests, entries and next_cursor"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/model-policy":{"parameters":[{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"Read workspace AI settings and the full model catalog","description":"Members can read; only workspace admins can update. allowed_models is null when all current and future models are allowed, or an explicit allowlist. data includes enabled and selectable flags.","responses":{"200":{"description":"allowed_models and data"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"put":{"summary":"Set the workspace model allowlist (admins only)","description":"Replaces the selection for every existing and future API key. Null allows all current and future models. An empty array disables all inference. An explicit array requires approval for new models and cannot include automatic routing aliases. Applies immediately to model discovery and new requests; already running requests can finish.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["allowed_models"],"properties":{"allowed_models":{"type":["array","null"],"maxItems":10000,"uniqueItems":true,"items":{"type":"string","maxLength":256}}}}}}},"responses":{"200":{"description":"Saved allowed_models"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/models":{"parameters":[{"$ref":"#/components/parameters/workspace"},{"in":"query","name":"provider","schema":{"type":"string"},"description":"Filter by provider name, case-insensitive"},{"in":"query","name":"search","schema":{"type":"string"},"description":"Search provider, model name or ID"}],"get":{"summary":"List workspace-enabled models for the dashboard and CLI","responses":{"200":{"description":"data array: model IDs, names, provider, model_name, context_length, input_modalities (text/image/file), supported_parameters and customer prices in USD/token"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/api/inference/v1/models":{"parameters":[{"in":"query","name":"provider","schema":{"type":"string"},"description":"Filter by provider name, case-insensitive"},{"in":"query","name":"search","schema":{"type":"string"},"description":"Search provider, model name or ID"}],"get":{"summary":"List models using an inference key","security":[{"inferenceKey":[]}],"responses":{"200":{"description":"Chat-compatible models enabled in the inference key’s workspace"},"401":{"description":"Authentication required"},"503":{"description":"Service unavailable"}}}},"/api/inference/v1/chat/completions":{"post":{"summary":"Run Stacksync chat inference","security":[{"inferenceKey":[]}],"description":"Text, image and PDF attachments, and function-tool messages; optional SSE streaming. Send attachments in user message content arrays. Use image_url for images and file.file_data for PDFs; URLs and base64 data URLs are accepted. Models must advertise image/file in input_modalities. PDFs use native model processing. Stored file IDs and a separate Files API are not supported. Model is selected per call and must be enabled by the workspace administrator. Atomic spending reservation before inference, asynchronous completion logs after response. 32 MiB JSON request limit including base64 data, 120 second timeout.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string"},"messages":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"object","properties":{"role":{"type":"string","enum":["system","developer","user","assistant","tool"]},"content":{"oneOf":[{"type":["string","null"]},{"type":"array","minItems":1,"maxItems":1000,"items":{"oneOf":[{"type":"object","required":["type","text"],"properties":{"type":{"const":"text"},"text":{"type":"string"}}},{"type":"object","required":["type","image_url"],"properties":{"type":{"const":"image_url"},"image_url":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"Public HTTPS URL or base64 PNG/JPEG/WebP/GIF data URL"},"detail":{"enum":["auto","low","high"]}}}}},{"type":"object","required":["type","file"],"properties":{"type":{"const":"file"},"file":{"type":"object","required":["file_data"],"properties":{"filename":{"type":"string","maxLength":255},"file_data":{"type":"string","description":"Public HTTPS PDF URL or data:application/pdf;base64,..."}}}}}]}}]},"tool_calls":{"type":"array"},"tool_call_id":{"type":"string"}}}},"max_tokens":{"type":"integer","minimum":1,"default":1024},"max_completion_tokens":{"type":"integer","minimum":1},"stream":{"type":"boolean","default":false},"temperature":{"type":"number"},"top_p":{"type":"number"},"tools":{"type":"array"},"tool_choice":{},"response_format":{"type":"object"},"reasoning":{"type":"object"}}}}}},"responses":{"200":{"description":"Chat completion or SSE chunks with a Stacksync request ID and usage.cost as an exact USD decimal string","content":{"application/json":{"schema":{"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"402":{"description":"Insufficient key allowance for the conservative reservation"},"403":{"description":"Model disabled by the workspace administrator"},"413":{"description":"JSON body exceeds 32 MiB"},"415":{"description":"Send application/json with inline attachment parts"},"429":{"description":"Model capacity exhausted"},"502":{"description":"Model failed or response interrupted"},"503":{"description":"Service unavailable"}}}},"/api/storage/buckets":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}}],"get":{"summary":"List buckets with explicit resource access","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}},"post":{"summary":"Create a private bucket; internal name is eos-storage-w{workspace_id}-{name}","responses":{"200":{"description":"Success"},"201":{"description":"Bucket created with creator as Owner"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"jurisdiction":{"type":"string","enum":["us","eu"],"default":"us","description":"Storage jurisdiction, fixed at creation."},"name":{"type":"string","pattern":"^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"},"byte_limit":{"type":"integer","minimum":0},"object_limit":{"type":"integer","minimum":0},"description":{"type":"string","maxLength":10000}},"required":["name"]}}}}}},"/api/storage/buckets/{id}":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"get":{"summary":"Read bucket metadata (Viewer or higher)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}},"patch":{"summary":"Update limits and description (Owner)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"byte_limit":{"type":"integer","minimum":0},"object_limit":{"type":"integer","minimum":0},"description":{"type":"string","maxLength":10000}},"required":[]}}}}},"delete":{"summary":"Delete an empty bucket (Owner); names remain reserved","responses":{"200":{"description":"Success"},"204":{"description":"Bucket deleted; keys revoked"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirm_name":{"type":"string"}},"required":["confirm_name"]}}}}}},"/api/storage/buckets/{id}/keys":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"get":{"summary":"List key metadata (Owner); no secrets or hashes","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}},"post":{"summary":"Create a bucket API key (Owner); secret shown once","responses":{"200":{"description":"Success"},"201":{"description":"Key metadata and one-time api_key"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80},"scopes":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","enum":["objects:read","objects:write","objects:list","objects:delete"]}},"expires_at":{"type":["string","null"],"format":"date-time"}},"required":["name","scopes"]}}}}}},"/api/storage/buckets/{id}/keys/{keyId}":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"keyId","required":true,"schema":{"type":"string"}}],"patch":{"summary":"Replace an active bucket key’s permissions (Owner); existing token remains valid","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scopes":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","enum":["objects:read","objects:write","objects:list","objects:delete"]}}},"required":["scopes"]}}}}},"delete":{"summary":"Revoke a bucket key (Owner)","responses":{"200":{"description":"Success"},"204":{"description":"Revoked"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/api/storage/buckets/{id}/objects":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"query","name":"prefix","required":false,"schema":{"type":"string"}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"pending","required":false,"schema":{"type":"string"}},{"in":"query","name":"delimiter","required":false,"schema":{"type":"string","enum":["/"]}}],"get":{"summary":"List committed files or pending uploads (Editor); 100 items and next_cursor; delimiter=/ lists immediate files and folders","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/api/storage/buckets/{id}/objects/{objectId}":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"objectId","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Queue file deletion (Editor); physical cleanup may take five minutes","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/api/storage/buckets/{id}/uploads/{operationId}":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"operationId","required":true,"schema":{"type":"string"}}],"delete":{"summary":"Resolve an abandoned upload (Editor); commit stored bytes or cancel safely","responses":{"200":{"description":"Success"},"204":{"description":"Resolved"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/api/storage/buckets/{id}/check-key":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"post":{"summary":"Verify that a transfer key belongs to this bucket (Editor)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string","writeOnly":true}},"required":["api_key"]}}}}}},"/api/storage/buckets/{id}/browser-token":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"post":{"summary":"Issue a five-minute dashboard transfer token (UI session and Editor access required)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/api/storage/usage":{"parameters":[{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string"}}],"get":{"summary":"Read workspace aggregate storage and limits (workspace Admin)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/api/storage/v1/objects":{"get":{"summary":"List objects using a bucket key with objects:list scope","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"security":[{"StorageKey":[]}],"parameters":[{"in":"query","name":"prefix","required":false,"schema":{"type":"string"}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}}]}},"/api/storage/v1/objects/{path}":{"parameters":[{"in":"path","name":"path","required":true,"schema":{"type":"string"}}],"put":{"summary":"Upload raw bytes in one request; existing paths are not overwritten","responses":{"200":{"description":"Success"},"201":{"description":"Stored and committed"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"411":{"description":"Content-Length required"},"413":{"description":"File too large"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"security":[{"StorageKey":[]}],"parameters":[{"in":"header","name":"Content-Length","required":true,"schema":{"type":"integer","minimum":0}},{"in":"header","name":"Idempotency-Key","required":false,"schema":{"type":"string"}}]},"get":{"summary":"Download as attachment with objects:read scope","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"security":[{"StorageKey":[]}],"parameters":[{"in":"header","name":"Range","required":false,"schema":{"type":"string"}}]},"head":{"summary":"Read object headers with objects:read scope","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"security":[{"StorageKey":[]}]},"delete":{"summary":"Delete a file with objects:delete scope","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"security":[{"StorageKey":[]}]}},"/api/databases/{id}/password/reset":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}}],"post":{"summary":"Reset the main database user password","description":"Requires database owner access. Omit password to generate one. Returns new credentials once. Existing connections stay open; update applications with the new password. Main-user connection details stored by EOS are updated.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","minLength":16,"maxLength":256,"writeOnly":true}},"additionalProperties":false}}}},"responses":{"200":{"description":"role_name and credentials: username, password, connection_string"},"400":{"description":"Password must be 16–256 characters"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/api/databases/{id}/logins/{loginId}/password/reset":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"loginId","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Reset an active database user password","description":"Requires database owner access. Omit password to generate one. Returns new credentials once. Existing connections stay open; update applications with the new password. Main-user connection details stored by EOS are updated.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","minLength":16,"maxLength":256,"writeOnly":true}},"additionalProperties":false}}}},"responses":{"200":{"description":"role_name and credentials: username, password, connection_string"},"400":{"description":"Password must be 16–256 characters"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/api/databases/{id}/logins/catalog":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}}],"get":{"summary":"List schemas and tables available for database-user permissions","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","responses":{"200":{"description":"schemas array with schema/table names, OIDs and table kind"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/api/databases/{id}/logins":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}}],"get":{"summary":"List database users and permissions","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","responses":{"200":{"description":"users array; never passwords"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}},"post":{"summary":"Create a restricted PostgreSQL user","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","permissions"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"permissions":{"type":"object","required":["schemas"],"properties":{"create_schema":{"type":"boolean"},"schemas":{"type":"array","items":{"type":"object","required":["name","access","tables"],"properties":{"name":{"type":"string"},"access":{"type":"boolean"},"structure":{"type":"object","properties":{"create_table":{"type":"boolean"},"rename":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false},"tables":{"type":"array","items":{"type":"object","required":["name","data"],"properties":{"name":{"type":"string"},"data":{"type":"array","items":{"type":"string","enum":["select","insert","update","delete"]}},"structure":{"type":"object","properties":{"alter":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false}},"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"201":{"description":"Login ID, name, role_name, permissions and one-time credentials (username, password, connection_string)"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/api/databases/{id}/logins/{loginId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"loginId","required":true,"schema":{"type":"string","format":"uuid"}}],"put":{"summary":"Replace a database user permission set","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","permissions"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"permissions":{"type":"object","required":["schemas"],"properties":{"create_schema":{"type":"boolean"},"schemas":{"type":"array","items":{"type":"object","required":["name","access","tables"],"properties":{"name":{"type":"string"},"access":{"type":"boolean"},"structure":{"type":"object","properties":{"create_table":{"type":"boolean"},"rename":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false},"tables":{"type":"array","items":{"type":"object","required":["name","data"],"properties":{"name":{"type":"string"},"data":{"type":"array","items":{"type":"string","enum":["select","insert","update","delete"]}},"structure":{"type":"object","properties":{"alter":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false}},"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Updated login and permissions"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}},"delete":{"summary":"Revoke a database user","description":"Requires database owner. Blocks new connections and terminates existing sessions. The role is retained for history and removed when its database is deleted.","responses":{"200":{"description":"revoked: true"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/api/deployments/uploads":{"post":{"summary":"Start a verified source archive upload","parameters":[{"in":"header","name":"X-Workspace-Id","schema":{"type":"string"}}],"description":"Up to 600 MiB by default. Uploads belong to the authenticated user and workspace, expire after one hour, and allow two pending uploads per user.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["size","sha256"],"properties":{"size":{"type":"integer","minimum":1,"maximum":629145600},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}}}},"responses":{"201":{"description":"Upload created","content":{"application/json":{"schema":{"type":"object","properties":{"uploadId":{"type":"string","format":"uuid"},"chunkBytes":{"type":"integer"},"size":{"type":"integer"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"413":{"description":"Archive exceeds the configured limit"},"429":{"description":"Too many pending uploads"}}}},"/api/deployments/uploads/{id}/{index}":{"put":{"summary":"Upload or retry one source chunk","parameters":[{"in":"header","name":"X-Workspace-Id","schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"index","required":true,"schema":{"type":"integer","minimum":0}},{"in":"header","name":"X-Chunk-SHA256","required":true,"schema":{"type":"string"}}],"description":"Send exactly chunkBytes bytes, except the final chunk, with Content-Length. Retrying an index replaces that chunk. Submit uploadId to POST /api/deployments when all chunks are complete.","requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"204":{"description":"Chunk verified and stored"},"400":{"description":"Invalid index or checksum"},"404":{"description":"Upload not accessible"},"409":{"description":"Upload busy; retry"},"410":{"description":"Upload expired"},"413":{"description":"Incorrect chunk size"}}}},"/api/deployments/uploads/{id}":{"delete":{"summary":"Cancel a pending source upload","parameters":[{"in":"header","name":"X-Workspace-Id","schema":{"type":"string"}},{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Upload removed"},"404":{"description":"Upload not accessible"}}}},"/api/auth/guest":{"post":{"summary":"Create or resume a guest workspace without account sign-in","security":[],"description":"Send a cryptographically random 32-byte hexadecimal credential as Authorization: Bearer. Save it privately before the first request and reuse it for retries. Only its hash is stored. Returns the same workspace until claimed or expired; never resets the 14-day deadline.","parameters":[{"in":"header","name":"Authorization","required":true,"schema":{"type":"string","pattern":"^Bearer [a-f0-9]{64}$"}}],"responses":{"200":{"description":"workspace: id, name, role, guest, expiresAt"},"400":{"description":"Invalid guest credential format"},"410":{"description":"Credential was claimed, expired or revoked"},"503":{"description":"New guest workspace creation is disabled"}}}},"/api/workspaces/{id}/claim":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}}],"post":{"summary":"Claim a guest workspace for the signed-in account","description":"Requires a normal account bearer/session plus the original guest credential. Atomic ownership transfer with guest credential revocation. Retry by the same claimant is idempotent. Must finish before expiration; no merge or redeployment occurs.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"guestToken":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["guestToken"]}}}},"responses":{"200":{"description":"Claimed workspace, no guest expiration"},"400":{"description":"Invalid ID or proof format"},"401":{"description":"Account authentication required"},"403":{"description":"Guest identity or incorrect proof"},"410":{"description":"Already claimed by another account, expired or deleting"}}}},"/api/auth/device":{"post":{"summary":"Start CLI login or background guest deployment activation","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"guestToken":{"type":"string","description":"Private guest credential, sent only in the request body"},"purpose":{"type":"string","enum":["guest-deployment"],"description":"Requires an active guest; provides a 30-minute browser link distinct from the private deviceCode"}}}}}},"responses":{"201":{"description":"deviceCode, verificationUrl, expiresIn and polling interval; regular login expires in 120 seconds"},"403":{"description":"Guest deployment activation requires a valid guest credential"}}}},"/api/ui/device/claim-status":{"post":{"summary":"Wait for the CLI claim and select the claimed browser workspace","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceCode":{"type":"string"}},"required":["deviceCode"]}}}},"responses":{"200":{"description":"status and a workspace-scoped redirectPath when claimed"},"401":{"description":"Browser login required"},"410":{"description":"Expired or belongs to another account"}}}},"/api/access/github/apps":{"parameters":[{"$ref":"#/components/parameters/workspace"}],"post":{"summary":"Create an application for GitHub deployment without a terminal","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["project"],"properties":{"project":{"type":"string"},"variables":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"201":{"description":"Application created; no deployment has started"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"409":{"description":"Application name unavailable"},"503":{"description":"GitHub integration unavailable"}}}},"/api/access/apps/{id}/github":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"Get GitHub connection and recent deployment requests","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}},"put":{"summary":"Configure repository, target branch and deployment mode","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["repository_id","branch","enabled"],"properties":{"repository_id":{"type":"string"},"branch":{"type":"string"},"root_directory":{"type":"string","default":"."},"mode":{"type":"string","enum":["merge","pipeline"],"default":"merge"},"enabled":{"type":"boolean"},"variable_names":{"type":"array","items":{"type":"string"},"description":"Runtime variable allowlist; pipeline mode only"}}}}}}},"delete":{"summary":"Disconnect GitHub and stop future automatic deployments","responses":{"204":{"description":"Disconnected"},"403":{"description":"Editor access required"}}}},"/api/access/apps/{id}/github/connect":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"post":{"summary":"Begin browser-bound GitHub authorization (intent=install explicitly installs for another account)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"intent":{"type":"string","enum":["authorize","install"],"default":"authorize"}}}}}}}},"/api/access/apps/{id}/github/repositories":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"List repositories authorized by the connecting user","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}}},"/api/access/apps/{id}/github/branches":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"},{"in":"query","name":"repository_id","required":true,"schema":{"type":"string"}}],"get":{"summary":"List branches in an authorized repository","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}}},"/api/access/apps/{id}/github/workflow":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"get":{"summary":"Download optional pipeline submission workflow","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}}},"/api/access/apps/{id}/github/deploy":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/workspace"}],"post":{"summary":"Deploy the saved branch current commit using saved EOS runtime variables","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["revision"],"properties":{"revision":{"type":"string","format":"uuid"}}}}}},"responses":{"202":{"description":"Queued request (duplicates reuse the same request)"},"403":{"description":"Editor access required"},"409":{"description":"Configuration changed or not saved"},"503":{"description":"GitHub integration unavailable"}}}},"/api/integrations/github/webhook":{"post":{"summary":"Receive GitHub App webhooks","security":[],"description":"Requires X-Hub-Signature-256 over the exact JSON body, X-GitHub-Delivery and X-GitHub-Event. Merged PRs enqueue only merge-mode connections. Delivery and commit deduplication are durable.","responses":{"202":{"description":"Delivery recorded; accepted deployment count"},"401":{"description":"Invalid HMAC"},"503":{"description":"Unavailable or queue full"}}}},"/api/integrations/github/deployments":{"post":{"summary":"Submit commit and runtime variables from GitHub Actions","security":[{"githubOidc":[]}],"description":"Pipeline mode only. Validates repository, target ref, workflow, merged PR and immutable commit. Audience is EOS origin + /github-actions.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["app_id","pull_request","variables"],"properties":{"app_id":{"type":"string"},"pull_request":{"type":"integer"},"variables":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"202":{"description":"Durable deployment request ID and status"},"400":{"description":"Variable allowlist mismatch"},"401":{"description":"Invalid workflow identity"},"403":{"description":"Wrong mode, repository, branch, workflow or merge"}}}},"/api/integrations/github/callback":{"get":{"summary":"Complete GitHub installation and OAuth","security":[],"description":"Requires single-use state and the initiating browser cookie.","responses":{"303":{"description":"Continue authorization or return to application"},"403":{"description":"Expired or invalid state"}}}},"/workspace/{workspace_id}/api/access/{kind}/{id}":{"parameters":[{"in":"path","name":"kind","required":true,"schema":{"type":"string","enum":["apps","databases","inference","storage"]}},{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List resource grants and sharing directory (owner only)","responses":{"200":{"description":"Success"},"403":{"description":"Owner required"},"404":{"description":"Resource not found"}}},"put":{"summary":"Set a user, group, or pending invitation grant (owner only)","responses":{"204":{"description":"Success"},"403":{"description":"Owner required"},"404":{"description":"Resource not found"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","subjectId","role"],"properties":{"type":{"type":"string","enum":["user","group","invitation"]},"subjectId":{"type":"string"},"role":{"type":"string","enum":["owner","editor","viewer","operator"]}}}}}}},"delete":{"summary":"Remove a user or group grant (owner only)","responses":{"204":{"description":"Success"},"403":{"description":"Owner required"},"404":{"description":"Resource not found"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","subjectId"],"properties":{"type":{"type":"string","enum":["user","group","invitation"]},"subjectId":{"type":"string"},"role":{"type":"string","enum":["owner","editor","viewer","operator"]}}}}}}}},"/workspace/{workspace_id}/api/deployments":{"get":{"summary":"List deployment versions, optionally filtered by project","parameters":[{"in":"query","name":"project","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deployment summaries without environment-variable values or log bodies"},"404":{"description":"Project not found"}}},"post":{"summary":"Create or update an application","description":"Waits for the application to deploy. Omitted variables retain their previous values; supplied keys are upserted.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["project"],"oneOf":[{"required":["file"]},{"required":["uploadId"]}],"properties":{"project":{"type":"string","minLength":1,"maxLength":63,"pattern":"^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$","description":"Immutable URL-safe name unique within the selected workspace. For new apps, the combined {project}-w{workspace_id} DNS label must not exceed 63 characters. New apps use {project}-w{workspace_id}.stacksync.app. Existing app URLs and service IDs are preserved.","example":"my-project"},"memory":{"type":"string","enum":["512Mi","1Gi","2Gi","4Gi"],"description":"Memory per container. Omitted values retain the last successful deployment setting or server default. Changes create a new version."},"maxInstances":{"type":"integer","minimum":1,"maximum":20,"description":"Maximum container instances per application version. Omitted values retain the last successful deployment setting or server default."},"uploadId":{"type":"string","format":"uuid","description":"Completed chunk upload ID, supplied instead of file"},"file":{"type":"string","format":"binary","description":"ZIP archive containing the application source at its root"},"variables":{"type":"string","description":"JSON object encoded as a multipart text field","example":"{\"API_URL\":\"https://example.com\"}"}}}}}},"responses":{"200":{"description":"Existing service updated successfully"},"201":{"description":"New service created successfully"},"400":{"description":"Invalid project, variables, or ZIP"},"409":{"description":"Another deployment for this project is running"},"500":{"description":"Build or application deployment failed"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/{id}":{"get":{"summary":"Get one deployment and its logs by ID","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Deployment and structured customer-safe events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentEvent"}},"logs":{"type":"string","description":"Compatibility text generated only from customer events."}}}}}},"404":{"description":"Not found"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/{id}/logs":{"get":{"summary":"Get plain-text build and rollout logs for one deployment","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Customer-safe events formatted as text/plain"},"400":{"description":"Invalid deployment ID"},"404":{"description":"Not found"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/{id}/variables":{"get":{"summary":"Get the environment variables saved for one deployment","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Saved environment-variable object"},"400":{"description":"Invalid deployment ID"},"404":{"description":"Not found"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/{id}/files":{"get":{"summary":"List retained source files or preview a single UTF-8 file (up to 2 MB)","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}},{"in":"query","name":"path","description":"Exact archive file path; omit to list entries","schema":{"type":"string"}}],"responses":{"200":{"description":"Entry listing, file text, or an unsupported-preview reason"},"400":{"description":"Invalid deployment ID or path"},"404":{"description":"Deployment or file not found"},"409":{"description":"Source archive unavailable"},"413":{"description":"Archive or preview limit exceeded"},"422":{"description":"Invalid source archive"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/{id}/source":{"get":{"summary":"Download the retained source ZIP for one deployment","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Source archive as application/zip"},"404":{"description":"Not found"},"409":{"description":"Source archive unavailable"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/{id}/cancel":{"post":{"summary":"Cancel an active deployment (Editor or Owner)","description":"Stops remaining deployment steps and cancels queued or running build jobs. Idempotent for cancelling/cancelled deployments. Already applied rollout changes are not rolled back. Poll the deployment until status is cancelled before deploying again.","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"responses":{"200":{"description":"Deployment cancelled; another deployment can start"},"202":{"description":"Cancellation requested; active work is stopping"},"403":{"description":"Editor access required"},"404":{"description":"Deployment not found"},"409":{"description":"Deployment has already finished"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/{id}/retry":{"post":{"summary":"Retry a deployment using its retained source archive, optionally upserting or deleting individual environment variables","parameters":[{"in":"path","name":"id","required":true,"example":"dep_123","schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"memory":{"type":"string","enum":["512Mi","1Gi","2Gi","4Gi"]},"maxInstances":{"type":"integer","minimum":1,"maximum":20},"variable_changes":{"type":"object","description":"Apply changes to the selected deployment snapshot. Omitted keys are retained. Cannot be combined with variables.","additionalProperties":false,"properties":{"upsert":{"type":"object","additionalProperties":{"type":["string","number","boolean"]}},"delete":{"type":"array","items":{"type":"string"}}}},"variables":{"type":"object","additionalProperties":{"type":["string","number","boolean"]}}}}}}},"responses":{"200":{"description":"New version deployed successfully"},"409":{"description":"Source archive is unavailable"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/apps":{"get":{"summary":"List all applications","responses":{"200":{"description":"Application list"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/projects":{"get":{"summary":"List project summaries without environment-variable values","responses":{"200":{"description":"Project summary list"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/ui/me":{"get":{"summary":"Get the signed-in UI user","responses":{"200":{"description":"Current UI identity"},"401":{"description":"UI sign-in required"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/apps/{project}":{"get":{"summary":"Get one application","parameters":[{"in":"path","name":"project","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Application"},"404":{"description":"Not found"}}},"delete":{"summary":"Permanently remove an application and its deployed service","parameters":[{"in":"path","name":"project","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["confirmDelete","confirmProject"],"properties":{"confirmDelete":{"type":"boolean","const":true},"confirmProject":{"type":"string"}}}}}},"responses":{"200":{"description":"Service, history, and retained archives removed"},"400":{"description":"Double confirmation missing or mismatched"},"409":{"description":"Deployment currently active"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/apps/{project}/deployments":{"get":{"summary":"Get deployment history and diagnostic logs","parameters":[{"in":"path","name":"project","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Recent deployments including failure logs"},"404":{"description":"Not found"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases":{"get":{"summary":"List only managed databases shared with the authenticated user","responses":{"200":{"description":"Database metadata without credentials"}}},"post":{"summary":"Provision an isolated PostgreSQL database and user","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Database, user, generated tenant password, and connection string created"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/users":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List users with explicit access to a database","responses":{"200":{"description":"Resource members"},"404":{"description":"Database not found or not shared with you"}}},"post":{"summary":"Share database access with an existing member of the selected workspace","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"201":{"description":"Updated resource members"},"404":{"description":"Database not found or not shared with you"}}}},"/workspace/{workspace_id}/api/databases/{id}/users/{userId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"userId","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Remove another member’s dashboard and API access to a database","responses":{"200":{"description":"Updated members"},"400":{"description":"Cannot remove your own access"},"404":{"description":"Database or member not found"}}}},"/workspace/{workspace_id}/api/databases/{id}/credentials":{"get":{"summary":"Retrieve and audit the generated tenant password and full connection string","responses":{"200":{"description":"Managed database credentials"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}":{"patch":{"summary":"Rename a managed database display name without changing its PostgreSQL database, role, or credentials","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":80}}}}}},"responses":{"200":{"description":"Updated database metadata"},"404":{"description":"Database not found"},"409":{"description":"Display name already exists"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/schema":{"get":{"summary":"Inspect schemas, tables, and columns","responses":{"200":{"description":"Schema tree"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/table-ddl":{"get":{"summary":"Export the selected table definition, constraints and indexes without row data","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"query","name":"schema","required":true,"schema":{"type":"string"}},{"in":"query","name":"table","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"DDL SQL in the ddl field"},"400":{"description":"Invalid schema or table name"},"404":{"description":"Database or table not found"},"503":{"description":"PostgreSQL client unavailable"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/workspace":{"get":{"summary":"Load only the authenticated user’s saved SQL tabs for this database","responses":{"200":{"description":"Ordered tabs, activeTabId and version"},"404":{"description":"Database not accessible"}}},"put":{"summary":"Autosave ordered SQL tabs with optimistic concurrency","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tabs","activeTabId","version"],"properties":{"tabs":{"type":"array","maxItems":50,"items":{"type":"object","required":["id","label","sql"],"properties":{"id":{"type":"integer"},"label":{"type":"string"},"sql":{"type":"string","maxLength":100000},"tableKey":{"type":["string","null"]}}}},"activeTabId":{"type":["integer","null"]},"version":{"type":"integer","minimum":0}}}}}},"responses":{"200":{"description":"New version and saved timestamp"},"400":{"description":"Invalid workspace or over 500 KB"},"404":{"description":"Database not accessible"},"409":{"description":"Workspace changed in another window"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/ai":{"get":{"summary":"Read Gemini suggestion availability without exposing credentials","responses":{"200":{"description":"enabled and model"},"404":{"description":"Database not accessible"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/ai-completion":{"post":{"summary":"Suggest SQL at the cursor using before/after strings and this database’s schema; does not execute SQL","responses":{"200":{"description":"completion text and replaceText (the exact leading SQL after the cursor to replace); empty values mean no change"},"400":{"description":"Invalid input or editor exceeds 80 KB"},"429":{"description":"Rate or provider quota limit"},"503":{"description":"Gemini not configured"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/ai-assist":{"post":{"summary":"Improve selected SQL or answer a question using action (improve/ask), selected, before, after and question strings","responses":{"200":{"description":"Answer, optional SQL replacement, exact original SQL and replaceRange with UTF-16 start/end offsets for review"},"400":{"description":"Invalid selection or question"},"429":{"description":"Rate or provider quota limit"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/lint":{"post":{"summary":"Check PostgreSQL syntax without executing SQL; returns diagnostics with one-based line and column positions","responses":{"200":{"description":"Syntax diagnostics (empty for valid SQL)"},"400":{"description":"Invalid SQL input or input exceeds 100 KB"},"404":{"description":"Database not found or not shared with you"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/query":{"post":{"summary":"Run SQL as the isolated tenant user","responses":{"200":{"description":"Fields and up to 1,000 result rows"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/databases/{id}/audit":{"get":{"summary":"List credential and database audit events","responses":{"200":{"description":"Audit history"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/system/load":{"get":{"summary":"Get current normalized load, memory, and storage usage","responses":{"200":{"description":"Current VM resource metrics"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/system/metrics":{"get":{"summary":"Get current VM resources and five-second samples from the last 24 hours","responses":{"200":{"description":"Current metrics and retained history"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/workspaces":{"get":{"summary":"List your workspaces","parameters":[{"in":"query","name":"search","schema":{"type":"string","minLength":1,"maxLength":80},"description":"Optional case-insensitive literal substring of the workspace name; only your accessible workspaces are returned."}],"responses":{"200":{"description":"Workspace IDs, names and your roles"}}},"post":{"summary":"Create a workspace owned by you","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80}}}}}},"responses":{"201":{"description":"Created workspace"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/workspaces/search":{"get":{"summary":"Search your accessible workspaces by name","parameters":[{"in":"query","name":"q","required":true,"schema":{"type":"string","minLength":1,"maxLength":80},"description":"Case-insensitive literal substring; matches workspace names, not IDs."}],"responses":{"200":{"description":"Matching workspaces in the same order as the workspace list"},"400":{"description":"Missing or invalid search term"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/workspaces/{id}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Get workspace settings, members and pending invitations","responses":{"200":{"description":"Workspace settings"},"404":{"description":"Not a workspace member"}}},"patch":{"summary":"Rename a workspace (owner or admin)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80}}}}}},"responses":{"200":{"description":"Updated workspace"},"403":{"description":"Workspace admin required"}}}},"/workspace/{workspace_id}/api/workspaces/{id}/members":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List workspace users; admins also receive pending invitations","responses":{"200":{"description":"users and invitations arrays; invitations empty for members"},"404":{"description":"Not a workspace member"}}}},"/workspace/{workspace_id}/api/workspaces/{id}/groups":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List all workspace groups for admins, only own groups for members","responses":{"200":{"description":"Filtered groups array"},"404":{"description":"Not a workspace member"}}},"post":{"summary":"Create a workspace group (Admin only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"memberIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"}},"invitationIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"}},"subjectType":{"type":"string","enum":["user","invitation"],"description":"Required for management-token requests with initial recipients; must match the populated array"}},"required":["name","memberIds"]}}}},"responses":{"201":{"description":"Created group with member_ids"},"400":{"description":"Invalid members or incompatible group grants; groups with external operators are app-Operator-only"},"403":{"description":"Admin required"},"409":{"description":"Group name already exists"}}}},"/workspace/{workspace_id}/api/workspaces/{id}/groups/{groupId}/members":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"groupId","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Add group members atomically (Admin only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","invitation"]},"subjectIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"minItems":1}},"required":["subjectType","subjectIds"]}}}},"responses":{"200":{"description":"Updated group, member_ids and invitation_ids; only explicitly typed recipients are changed"},"400":{"description":"Invalid or missing subject type, ineligible users or non-pending invitations; no partial changes"},"403":{"description":"Admin required"},"404":{"description":"Workspace or group unavailable"}}},"delete":{"summary":"Remove group members atomically (Admin only)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","invitation"]},"subjectIds":{"type":"array","maxItems":10000,"items":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"minItems":1}},"required":["subjectType","subjectIds"]}}}},"responses":{"200":{"description":"Updated group, member_ids and invitation_ids; only explicitly typed recipients are changed"},"400":{"description":"Invalid or missing subject type, ineligible users or non-pending invitations; no partial changes"},"403":{"description":"Admin required"},"404":{"description":"Workspace or group unavailable"}}}},"/workspace/{workspace_id}/api/workspaces/{id}/select":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"Workspace ID, or a URL-encoded name substring. Numeric values are IDs. Name matching is case-insensitive and must resolve to exactly one accessible workspace."},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Select a workspace by ID or unambiguous name substring","responses":{"200":{"description":"Selected workspace; CLI must persist its returned ID locally and send X-Workspace-Id"},"400":{"description":"Invalid search term"},"404":{"description":"Not a workspace member or no matching workspace"},"409":{"description":"WORKSPACE_AMBIGUOUS with matching workspaces; no selection changed. Retry with an explicit ID."}}}},"/workspace/{workspace_id}/api/workspaces/{id}/invitations":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Create an expiring invitation and email the recipient (owner or admin)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","member","external_operator"]}}}}}},"responses":{"201":{"description":"Admin/member: invitation metadata and invitePath. External operator: immediate user membership, no email or invitation."}},"description":"Guest owners must sign in and claim this workspace before inviting members or adding External Operators. Signing in alone does not claim a workspace."}},"/workspace/{workspace_id}/api/workspace-invitations/accept":{"post":{"summary":"Accept an invitation while signed in with its recipient email","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"Workspace membership created; assigned pending group memberships and resource grants activate"},"404":{"description":"Expired, revoked, consumed or wrong recipient"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/workspaces/{id}/members/{userId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"userId","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Remove a workspace member and revoke resource grants","responses":{"204":{"description":"Removed"},"400":{"description":"Cannot remove the last admin or a sole resource owner"},"403":{"description":"Workspace admin required"}}}},"/workspace/{workspace_id}/api/workspaces/{id}/invitations/{invitationId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"invitationId","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Revoke an unused workspace invitation","responses":{"204":{"description":"Revoked"},"403":{"description":"Workspace admin required"}}}},"/workspace/{workspace_id}/api/profile/api-keys":{"get":{"summary":"List personal key metadata for the authenticated user","responses":{"200":{"description":"Keys without secrets or hashes"}}},"post":{"summary":"Create a personal runtime API key (two UUIDs without dashes)","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":40}},"required":["name"]}}}},"responses":{"201":{"description":"Key metadata and token; token is shown only once"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/profile/api-keys/{keyId}":{"parameters":[{"in":"path","name":"keyId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Revoke your personal API key","responses":{"204":{"description":"Revoked"},"404":{"description":"Key not found or belongs to another user"}}}},"/workspace/{workspace_id}/api/profile":{"get":{"summary":"Get your profile","responses":{"200":{"description":"ID, name and email"}}},"patch":{"summary":"Update your name; email changes require the separate verification flow","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated profile"},"403":{"description":"Email change requires verification"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/profile/email-change":{"post":{"summary":"Send a six-digit verification code to a new email address","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string"}},"required":["email","password"]}}}},"responses":{"200":{"description":"requestId, normalized email and expiresInSeconds (600); account email remains unchanged"},"403":{"description":"Incorrect current password"},"409":{"description":"Email already in use"},"429":{"description":"Resend or attempt limit reached"},"503":{"description":"Email delivery unavailable"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/profile/email-change/confirm":{"post":{"summary":"Verify the code and atomically change your email","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requestId":{"type":"string","format":"uuid"},"code":{"type":"string","pattern":"^[0-9]{6}$"}},"required":["requestId","code"]}}}},"responses":{"200":{"description":"Updated profile"},"400":{"description":"Invalid, expired, used or attempt-limited code"},"409":{"description":"Email already in use"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/access/apps/{id}/runtime-policy":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]*$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Read an app runtime access preset (resource owner only)","responses":{"200":{"description":"policy and enforcement (active)"},"403":{"description":"Resource owner required"}}},"patch":{"summary":"Save an app runtime access preset (resource owner only)","description":"Updates the access policy evaluated by managed authentication on subsequent app requests. Does not alter direct origin access controls. New apps default to entire_workspace (All workspace members). Existing apps retain their selected policy. Workspace administration does not grant permission to change this setting.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["policy"],"properties":{"policy":{"type":"string","enum":["specific_members","entire_workspace","public_authenticated","public"]}}}}}},"responses":{"200":{"description":"Saved policy and enforcement (active)"},"400":{"description":"Invalid policy"},"403":{"description":"Resource owner required"},"404":{"description":"App not found or inaccessible"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-roles":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List custom app roles","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"post":{"summary":"Create a custom app role","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Success"},"201":{"description":"Created role"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-roles/{roleId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"roleId","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"put":{"summary":"Update role name/description; ID is immutable","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9_-]{0,63}$"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"delete":{"summary":"Delete an unassigned role","responses":{"200":{"description":"Success"},"204":{"description":"Deleted"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-members":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List explicit app members and custom role assignments","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"put":{"summary":"Add or update an app member with default EOS Operator access","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"user_id":{"type":"string"},"app_role":{"type":["string","null"]}},"description":"Use email to add a user, or user_id to update a known user. App role is a custom role ID; null clears it. No EOS infrastructure privilege is granted."}}}},"responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-members/{userId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"userId","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Remove app membership (independent EOS grants and public policies still apply)","responses":{"200":{"description":"Success"},"204":{"description":"Removed"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-role-invitations":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List pending app role assignments (Owner only)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-role-invitations/{invitationId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"invitationId","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"put":{"summary":"Assign a custom role activated only on invitation acceptance","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"app_role":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"Success"},"204":{"description":"Assignment saved"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-tokens":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List app access token metadata (Owner only)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}},"post":{"summary":"Create an app access token (Owner only); secret returned once","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80}}}}}},"responses":{"200":{"description":"Success"},"201":{"description":"id, name, prefix, created_at, token. Store token privately in server-side deployment variables."},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/app-tokens/{tokenId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"tokenId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Revoke one app access token; other tokens remain active","responses":{"200":{"description":"Success"},"204":{"description":"Revoked"},"400":{"description":"Invalid input"},"401":{"description":"Invalid or revoked credential"},"403":{"description":"Owner required or guest workspace"},"404":{"description":"Not found"},"409":{"description":"Role ID conflict, role in use, or disabled user"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/domains":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List app custom domains and DNS instructions (editor or owner)","responses":{"200":{"description":"domains and routing_enabled; records contain type, name and value"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}},"post":{"summary":"Reserve a custom hostname for an app (editor or owner)","description":"Idempotent for the same hostname and app. Only verified workspace ID 1 may reserve stacksync.com hostnames; eos.stacksync.com and its subdomains remain reserved everywhere, as do stacksync.ai and stacksync.app. DNS ownership TXT proof is required before provider registration. Verification and HTTPS activation run asynchronously.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["hostname"],"properties":{"hostname":{"type":"string","example":"portal.example.com"}}}}}},"responses":{"202":{"description":"domain with DNS instructions"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/domains/{domainId}/verify":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"domainId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Queue DNS and certificate verification","responses":{"202":{"description":"Verification queued; poll the list endpoint"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/domains/{domainId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"domainId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Disable a domain immediately and queue certificate cleanup","responses":{"202":{"description":"Domain is deleting; existing app URLs remain available"},"400":{"description":"Invalid hostname or domain ID"},"403":{"description":"App editor or owner access required; mutations also require a claimed workspace"},"404":{"description":"Resource not found"},"409":{"description":"Hostname already reserved or app domain limit reached"},"503":{"description":"Custom domains disabled or unavailable"}}}},"/workspace/{workspace_id}/api/inference/keys":{"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List only owned or explicitly shared inference keys and spending","responses":{"200":{"description":"keys array including can_manage, spent, reserved, remaining, period_start and resets_at; monetary values are exact decimal strings; no key secrets"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"post":{"summary":"Create an inference key with a recurring USD budget","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","cost_limit","reset_count","reset_unit"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"cost_limit":{"type":"number","minimum":0,"maximum":1000000,"multipleOf":0.01},"reset_count":{"type":"integer","minimum":1,"maximum":365},"reset_unit":{"type":"string","enum":["days","weeks","months"]}}}}}},"responses":{"201":{"description":"key metadata and api_key; the secret is returned only once"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/inference/keys/{id}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Read an owned or explicitly shared key and its usage","responses":{"200":{"description":"key metadata and can_manage; never returns the secret"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"patch":{"summary":"Rename a key or change its limit","description":"Supply the existing reset schedule. Schedule and anchor are immutable; changing limits does not reset spending.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","cost_limit","reset_count","reset_unit"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"cost_limit":{"type":"number","minimum":0,"maximum":1000000,"multipleOf":0.01},"reset_count":{"type":"integer","minimum":1,"maximum":365},"reset_unit":{"type":"string","enum":["days","weeks","months"]}}}}}},"responses":{"200":{"description":"Updated key and usage"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"409":{"description":"Key revoked or schedule changed"},"503":{"description":"Service unavailable"}}},"delete":{"summary":"Revoke or delete an owned key","parameters":[{"in":"query","name":"remove","schema":{"type":"boolean","default":false},"description":"true permanently disables and removes the key from listings and denies access to details and logs, including shared members. Internal accounting records are retained. Omit to revoke while retaining visible history."}],"responses":{"204":{"description":"Revoked or deleted"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/inference/keys/{id}/logs":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"query","name":"before","schema":{"type":"string"},"description":"next_cursor returned by the previous page"},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Read asynchronous logs for an owned or explicitly shared key","description":"Newest first, 100 per page. Cache status and cached-token count included; null cache status means unknown. No prompts or responses. Null cost means unconfirmed usage, with the reservation retained.","responses":{"200":{"description":"logs and next_cursor"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/inference/keys/{id}/users":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List people with access to this key","responses":{"200":{"description":"users with Owner or Viewer access_role"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"post":{"summary":"Owner shares view access with an existing workspace member","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Updated users; no key secret is shared"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/inference/keys/{id}/users/{userId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"userId","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]*$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Owner removes shared view access","responses":{"200":{"description":"Updated users"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/inference/usage":{"parameters":[{"in":"query","name":"before","schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Workspace billing ledger (owner/admin only)","description":"All-time customer charges as exact USD decimal strings, including deleted keys. entries are newest first, 100 per page; next_cursor paginates. Unknown costs remain unconfirmed and are excluded from total_cost until resolved. No private request content. Key deletion never removes charges.","responses":{"200":{"description":"total_cost, unconfirmed_requests, entries and next_cursor"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/inference/model-policy":{"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Read workspace AI settings and the full model catalog","description":"Members can read; only workspace admins can update. allowed_models is null when all current and future models are allowed, or an explicit allowlist. data includes enabled and selectable flags.","responses":{"200":{"description":"allowed_models and data"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}},"put":{"summary":"Set the workspace model allowlist (admins only)","description":"Replaces the selection for every existing and future API key. Null allows all current and future models. An empty array disables all inference. An explicit array requires approval for new models and cannot include automatic routing aliases. Applies immediately to model discovery and new requests; already running requests can finish.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["allowed_models"],"properties":{"allowed_models":{"type":["array","null"],"maxItems":10000,"uniqueItems":true,"items":{"type":"string","maxLength":256}}}}}}},"responses":{"200":{"description":"Saved allowed_models"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/inference/models":{"parameters":[{"in":"query","name":"provider","schema":{"type":"string"},"description":"Filter by provider name, case-insensitive"},{"in":"query","name":"search","schema":{"type":"string"},"description":"Search provider, model name or ID"},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List workspace-enabled models for the dashboard and CLI","responses":{"200":{"description":"data array: model IDs, names, provider, model_name, context_length, input_modalities (text/image/file), supported_parameters and customer prices in USD/token"},"400":{"description":"Invalid parameters"},"401":{"description":"Authentication required"},"403":{"description":"Workspace access denied"},"404":{"description":"Key not found"},"503":{"description":"Service unavailable"}}}},"/workspace/{workspace_id}/api/storage/buckets":{"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List buckets with explicit resource access","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}},"post":{"summary":"Create a private bucket; internal name is eos-storage-w{workspace_id}-{name}","responses":{"200":{"description":"Success"},"201":{"description":"Bucket created with creator as Owner"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"jurisdiction":{"type":"string","enum":["us","eu"],"default":"us","description":"Storage jurisdiction, fixed at creation."},"name":{"type":"string","pattern":"^[a-z0-9]([a-z0-9-]*[a-z0-9])?$"},"byte_limit":{"type":"integer","minimum":0},"object_limit":{"type":"integer","minimum":0},"description":{"type":"string","maxLength":10000}},"required":["name"]}}}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Read bucket metadata (Viewer or higher)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}},"patch":{"summary":"Update limits and description (Owner)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"byte_limit":{"type":"integer","minimum":0},"object_limit":{"type":"integer","minimum":0},"description":{"type":"string","maxLength":10000}},"required":[]}}}}},"delete":{"summary":"Delete an empty bucket (Owner); names remain reserved","responses":{"200":{"description":"Success"},"204":{"description":"Bucket deleted; keys revoked"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirm_name":{"type":"string"}},"required":["confirm_name"]}}}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}/keys":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List key metadata (Owner); no secrets or hashes","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}},"post":{"summary":"Create a bucket API key (Owner); secret shown once","responses":{"200":{"description":"Success"},"201":{"description":"Key metadata and one-time api_key"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80},"scopes":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","enum":["objects:read","objects:write","objects:list","objects:delete"]}},"expires_at":{"type":["string","null"],"format":"date-time"}},"required":["name","scopes"]}}}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}/keys/{keyId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"keyId","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"patch":{"summary":"Replace an active bucket key’s permissions (Owner); existing token remains valid","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scopes":{"type":"array","minItems":1,"uniqueItems":true,"items":{"type":"string","enum":["objects:read","objects:write","objects:list","objects:delete"]}}},"required":["scopes"]}}}}},"delete":{"summary":"Revoke a bucket key (Owner)","responses":{"200":{"description":"Success"},"204":{"description":"Revoked"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}/objects":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"query","name":"prefix","required":false,"schema":{"type":"string"}},{"in":"query","name":"cursor","required":false,"schema":{"type":"string"}},{"in":"query","name":"pending","required":false,"schema":{"type":"string"}},{"in":"query","name":"delimiter","required":false,"schema":{"type":"string","enum":["/"]}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List committed files or pending uploads (Editor); 100 items and next_cursor; delimiter=/ lists immediate files and folders","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}/objects/{objectId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"objectId","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Queue file deletion (Editor); physical cleanup may take five minutes","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}/uploads/{operationId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"operationId","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"delete":{"summary":"Resolve an abandoned upload (Editor); commit stored bytes or cancel safely","responses":{"200":{"description":"Success"},"204":{"description":"Resolved"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}/check-key":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Verify that a transfer key belongs to this bucket (Editor)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string","writeOnly":true}},"required":["api_key"]}}}}}},"/workspace/{workspace_id}/api/storage/buckets/{id}/browser-token":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Issue a five-minute dashboard transfer token (UI session and Editor access required)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/workspace/{workspace_id}/api/storage/usage":{"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Read workspace aggregate storage and limits (workspace Admin)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid request"},"401":{"description":"Authentication required"},"403":{"description":"Permission denied"},"404":{"description":"Not found or inaccessible"},"409":{"description":"Conflict or pending operation"},"429":{"description":"Storage or request limit reached"},"503":{"description":"Storage temporarily unavailable"}}}},"/workspace/{workspace_id}/api/databases/{id}/password/reset":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Reset the main database user password","description":"Requires database owner access. Omit password to generate one. Returns new credentials once. Existing connections stay open; update applications with the new password. Main-user connection details stored by EOS are updated.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","minLength":16,"maxLength":256,"writeOnly":true}},"additionalProperties":false}}}},"responses":{"200":{"description":"role_name and credentials: username, password, connection_string"},"400":{"description":"Password must be 16–256 characters"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/workspace/{workspace_id}/api/databases/{id}/logins/{loginId}/password/reset":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"loginId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Reset an active database user password","description":"Requires database owner access. Omit password to generate one. Returns new credentials once. Existing connections stay open; update applications with the new password. Main-user connection details stored by EOS are updated.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string","minLength":16,"maxLength":256,"writeOnly":true}},"additionalProperties":false}}}},"responses":{"200":{"description":"role_name and credentials: username, password, connection_string"},"400":{"description":"Password must be 16–256 characters"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/workspace/{workspace_id}/api/databases/{id}/logins/catalog":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List schemas and tables available for database-user permissions","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","responses":{"200":{"description":"schemas array with schema/table names, OIDs and table kind"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/workspace/{workspace_id}/api/databases/{id}/logins":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List database users and permissions","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","responses":{"200":{"description":"users array; never passwords"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}},"post":{"summary":"Create a restricted PostgreSQL user","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","permissions"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"permissions":{"type":"object","required":["schemas"],"properties":{"create_schema":{"type":"boolean"},"schemas":{"type":"array","items":{"type":"object","required":["name","access","tables"],"properties":{"name":{"type":"string"},"access":{"type":"boolean"},"structure":{"type":"object","properties":{"create_table":{"type":"boolean"},"rename":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false},"tables":{"type":"array","items":{"type":"object","required":["name","data"],"properties":{"name":{"type":"string"},"data":{"type":"array","items":{"type":"string","enum":["select","insert","update","delete"]}},"structure":{"type":"object","properties":{"alter":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false}},"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"201":{"description":"Login ID, name, role_name, permissions and one-time credentials (username, password, connection_string)"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/workspace/{workspace_id}/api/databases/{id}/logins/{loginId}":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}},{"in":"path","name":"loginId","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"put":{"summary":"Replace a database user permission set","description":"Requires database resource owner access in the selected workspace. Data operations are native PostgreSQL grants. Structural operations use the controlled eos_access.change_structure SQL function, never ownership or unrestricted DDL. Permissions apply to existing selected objects, not future tables. Password is returned only on creation. Credentials remain valid across resource moves; revoke them separately when needed.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","permissions"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"permissions":{"type":"object","required":["schemas"],"properties":{"create_schema":{"type":"boolean"},"schemas":{"type":"array","items":{"type":"object","required":["name","access","tables"],"properties":{"name":{"type":"string"},"access":{"type":"boolean"},"structure":{"type":"object","properties":{"create_table":{"type":"boolean"},"rename":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false},"tables":{"type":"array","items":{"type":"object","required":["name","data"],"properties":{"name":{"type":"string"},"data":{"type":"array","items":{"type":"string","enum":["select","insert","update","delete"]}},"structure":{"type":"object","properties":{"alter":{"type":"boolean"},"drop":{"type":"boolean"}},"additionalProperties":false}},"additionalProperties":false}}},"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false}}}},"responses":{"200":{"description":"Updated login and permissions"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}},"delete":{"summary":"Revoke a database user","description":"Requires database owner. Blocks new connections and terminates existing sessions. The role is retained for history and removed when its database is deleted.","responses":{"200":{"description":"revoked: true"},"403":{"description":"Database owner access required"},"404":{"description":"Database or login not found"},"409":{"description":"Database unavailable, conflicting PUBLIC privileges, or operation failed"}}}},"/workspace/{workspace_id}/api/deployments/uploads":{"post":{"summary":"Start a verified source archive upload","parameters":[],"description":"Up to 600 MiB by default. Uploads belong to the authenticated user and workspace, expire after one hour, and allow two pending uploads per user.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["size","sha256"],"properties":{"size":{"type":"integer","minimum":1,"maximum":629145600},"sha256":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}}}},"responses":{"201":{"description":"Upload created","content":{"application/json":{"schema":{"type":"object","properties":{"uploadId":{"type":"string","format":"uuid"},"chunkBytes":{"type":"integer"},"size":{"type":"integer"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"413":{"description":"Archive exceeds the configured limit"},"429":{"description":"Too many pending uploads"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/uploads/{id}/{index}":{"put":{"summary":"Upload or retry one source chunk","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}},{"in":"path","name":"index","required":true,"schema":{"type":"integer","minimum":0}},{"in":"header","name":"X-Chunk-SHA256","required":true,"schema":{"type":"string"}}],"description":"Send exactly chunkBytes bytes, except the final chunk, with Content-Length. Retrying an index replaces that chunk. Submit uploadId to POST /api/deployments when all chunks are complete.","requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"204":{"description":"Chunk verified and stored"},"400":{"description":"Invalid index or checksum"},"404":{"description":"Upload not accessible"},"409":{"description":"Upload busy; retry"},"410":{"description":"Upload expired"},"413":{"description":"Incorrect chunk size"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/deployments/uploads/{id}":{"delete":{"summary":"Cancel a pending source upload","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"Upload removed"},"404":{"description":"Upload not accessible"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/workspaces/{id}/claim":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Claim a guest workspace for the signed-in account","description":"Requires a normal account bearer/session plus the original guest credential. Atomic ownership transfer with guest credential revocation. Retry by the same claimant is idempotent. Must finish before expiration; no merge or redeployment occurs.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"guestToken":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["guestToken"]}}}},"responses":{"200":{"description":"Claimed workspace, no guest expiration"},"400":{"description":"Invalid ID or proof format"},"401":{"description":"Account authentication required"},"403":{"description":"Guest identity or incorrect proof"},"410":{"description":"Already claimed by another account, expired or deleting"}}}},"/workspace/{workspace_id}/api/ui/device/claim-status":{"post":{"summary":"Wait for the CLI claim and select the claimed browser workspace","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceCode":{"type":"string"}},"required":["deviceCode"]}}}},"responses":{"200":{"description":"status and a workspace-scoped redirectPath when claimed"},"401":{"description":"Browser login required"},"410":{"description":"Expired or belongs to another account"}}},"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}]},"/workspace/{workspace_id}/api/access/github/apps":{"parameters":[{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Create an application for GitHub deployment without a terminal","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["project"],"properties":{"project":{"type":"string"},"variables":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"responses":{"201":{"description":"Application created; no deployment has started"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"409":{"description":"Application name unavailable"},"503":{"description":"GitHub integration unavailable"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/github":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Get GitHub connection and recent deployment requests","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}},"put":{"summary":"Configure repository, target branch and deployment mode","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["repository_id","branch","enabled"],"properties":{"repository_id":{"type":"string"},"branch":{"type":"string"},"root_directory":{"type":"string","default":"."},"mode":{"type":"string","enum":["merge","pipeline"],"default":"merge"},"enabled":{"type":"boolean"},"variable_names":{"type":"array","items":{"type":"string"},"description":"Runtime variable allowlist; pipeline mode only"}}}}}}},"delete":{"summary":"Disconnect GitHub and stop future automatic deployments","responses":{"204":{"description":"Disconnected"},"403":{"description":"Editor access required"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/github/connect":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Begin browser-bound GitHub authorization (intent=install explicitly installs for another account)","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"intent":{"type":"string","enum":["authorize","install"],"default":"authorize"}}}}}}}},"/workspace/{workspace_id}/api/access/apps/{id}/github/repositories":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List repositories authorized by the connecting user","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/github/branches":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"query","name":"repository_id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"List branches in an authorized repository","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/github/workflow":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"get":{"summary":"Download optional pipeline submission workflow","responses":{"200":{"description":"Success"},"400":{"description":"Invalid configuration"},"403":{"description":"Editor access required"},"404":{"description":"Application not found"},"503":{"description":"GitHub integration unavailable"}}}},"/workspace/{workspace_id}/api/access/apps/{id}/github/deploy":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"in":"path","name":"workspace_id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]{0,17}$"},"description":"Workspace membership is required. Conflicting X-Workspace-Id is rejected."}],"post":{"summary":"Deploy the saved branch current commit using saved EOS runtime variables","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["revision"],"properties":{"revision":{"type":"string","format":"uuid"}}}}}},"responses":{"202":{"description":"Queued request (duplicates reuse the same request)"},"403":{"description":"Editor access required"},"409":{"description":"Configuration changed or not saved"},"503":{"description":"GitHub integration unavailable"}}}}},"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"runtimeWorker":{"type":"http","scheme":"bearer","description":"Dedicated Worker service key from EOS_RUNTIME_WORKER_KEYS_FILE (hot-reloaded, overlapping keys supported), not an end-user token. Legacy EOS_RUNTIME_WORKER_TOKEN applies only without a keyring."},"eosBrowserSession":{"type":"apiKey","in":"cookie","name":"stacksync_session"},"appAccessToken":{"type":"http","scheme":"bearer","description":"Per-app bearer token. May manage only its own app roles/users. Cannot manage EOS resource grants, tokens, deployments or workspace users."},"inferenceKey":{"type":"http","scheme":"bearer","description":"Stacksync inference key (sk-ss-…), issued once at key creation. Separate from EOS management credentials."},"StorageKey":{"type":"http","scheme":"bearer","description":"Bucket-scoped storage_ API key. Never an EOS management or Worker token."},"githubOidc":{"type":"http","scheme":"bearer","bearerFormat":"GitHub Actions OIDC JWT"}},"parameters":{"workspace":{"in":"header","name":"X-Workspace-Id","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]*$"},"description":"Selected workspace ID. Membership is checked on every request."}},"schemas":{"DeploymentError":{"type":"object","additionalProperties":false,"required":["code","stage","title","message","severity","error_id"],"properties":{"code":{"type":"string","enum":["DEPLOYMENT_CANCELLED","DEPLOYMENT_NOT_ACTIVE","UNSUPPORTED_RUNTIME_VERSION","DEPLOYMENT_IN_PROGRESS","OUT_OF_MEMORY","BUILD_COMMAND_MISSING","MODULE_NOT_FOUND","PORT_BINDING_FAILED","HEALTH_CHECK_FAILED","DEPLOYMENT_TIMEOUT","MISSING_ENVIRONMENT_VARIABLE","DEPENDENCY_INSTALL_FAILED","AUTH_CONFIGURATION_FAILED","RESOURCE_LIMIT_REACHED","INVALID_DOCKERFILE","BUILD_COMMAND_FAILED","BUILD_FAILED","APPLICATION_CRASHED","APP_START_FAILED","INVALID_CONFIGURATION","UNKNOWN_DEPLOYMENT_ERROR"]},"stage":{"type":"string","enum":["upload","prepare","dependencies","build","package","deploy","configure","verify","ready","failed","cancelling","cancelled"]},"title":{"type":"string"},"message":{"type":"string"},"suggestion":{"type":"string"},"severity":{"const":"error"},"details":{"type":"array","items":{"type":"string"}},"error_id":{"type":"string","pattern":"^err_[a-f0-9]{32}$"}}},"DeploymentEvent":{"type":"object","additionalProperties":false,"required":["id","type","timestamp","deployment_id","stage","status","message"],"properties":{"id":{"type":"string"},"type":{"const":"deployment_event"},"timestamp":{"type":"string","format":"date-time"},"deployment_id":{"type":"string"},"stage":{"type":"string","enum":["upload","prepare","dependencies","build","package","deploy","configure","verify","ready","failed","cancelling","cancelled"]},"status":{"enum":["pending","in_progress","success","failed","warning","cancelled"]},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}},"url":{"type":"string","format":"uri"},"error":{"$ref":"#/components/schemas/DeploymentError"}}}}}}