openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: RealityOS API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: Auth description: Browser and mobile authentication endpoints. - name: projects description: User project management - name: community description: Community showcase posts - name: agent description: AI agent execution - name: openai description: OpenAI AI chat, image, and audio operations paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/user: get: tags: [Auth] operationId: getCurrentAuthUser summary: Get the currently authenticated user parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' responses: '200': description: Auth status resolved successfully. content: application/json: schema: $ref: '#/components/schemas/AuthUserEnvelope' /login: get: tags: [Auth] operationId: beginBrowserLogin summary: Start the browser OIDC login flow parameters: - name: returnTo in: query required: false description: Relative path to redirect to after login (must start with `/`). Defaults to `/`. schema: type: string responses: '302': description: Redirect to the OIDC authorization endpoint. /callback: get: tags: [Auth] operationId: handleBrowserLoginCallback summary: Complete the browser OIDC login flow parameters: - name: code in: query required: false schema: type: string - name: state in: query required: false schema: type: string - name: iss in: query required: false schema: type: string format: uri responses: '302': description: Redirect to the `returnTo` path on success (defaults to `/`) or `/api/login` on failure. /logout: get: tags: [Auth] operationId: logoutBrowserSession summary: Clear the session and begin OIDC logout parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' responses: '302': description: Redirect to the OIDC provider logout URL. /mobile-auth/token-exchange: post: tags: [Auth] operationId: exchangeMobileAuthorizationCode summary: Exchange a mobile OIDC code for a session token requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MobileTokenExchangeRequest' responses: '200': description: Session created successfully. content: application/json: schema: $ref: '#/components/schemas/MobileTokenExchangeSuccess' '400': description: Missing or invalid required fields. content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' '401': description: Token did not contain usable claims. content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' '500': description: Token exchange failed. content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /mobile-auth/logout: post: tags: [Auth] operationId: logoutMobileSession summary: Delete a mobile session token parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' responses: '200': description: Logout processed. content: application/json: schema: $ref: '#/components/schemas/LogoutSuccess' /projects: get: operationId: listProjects tags: [projects] summary: List the current user's projects parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' responses: '200': description: List of projects content: application/json: schema: type: array items: $ref: '#/components/schemas/Project' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' post: operationId: createProject tags: [projects] summary: Create a new project parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateProjectBody' responses: '201': description: Created project content: application/json: schema: $ref: '#/components/schemas/Project' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /projects/{id}: get: operationId: getProject tags: [projects] summary: Get a project by ID parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' - name: id in: path required: true schema: type: integer responses: '200': description: Project content: application/json: schema: $ref: '#/components/schemas/Project' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' put: operationId: updateProject tags: [projects] summary: Update a project parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/UpdateProjectBody' responses: '200': description: Updated project content: application/json: schema: $ref: '#/components/schemas/Project' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' delete: operationId: deleteProject tags: [projects] summary: Delete a project parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' - name: id in: path required: true schema: type: integer responses: '204': description: Deleted '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /community: get: operationId: listCommunityPosts tags: [community] summary: List community showcase posts parameters: - name: tag in: query required: false schema: type: string - name: limit in: query required: false schema: type: integer default: 20 - name: offset in: query required: false schema: type: integer default: 0 responses: '200': description: List of community posts content: application/json: schema: type: array items: $ref: '#/components/schemas/CommunityPost' post: operationId: createCommunityPost tags: [community] summary: Publish a project to the community gallery parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CreateCommunityPostBody' responses: '201': description: Created community post content: application/json: schema: $ref: '#/components/schemas/CommunityPost' '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /community/{id}: get: operationId: getCommunityPost tags: [community] summary: Get a community post by ID parameters: - name: id in: path required: true schema: type: integer responses: '200': description: Community post content: application/json: schema: $ref: '#/components/schemas/CommunityPost' '404': description: Not found content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /agent/run: post: operationId: runAgent tags: [agent] summary: Run the AI agent with a prompt description: Accepts a prompt and optional project context, streams back agent response via SSE. parameters: - $ref: '#/components/parameters/AuthorizationSessionHeader' - $ref: '#/components/parameters/SessionCookie' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/RunAgentBody' responses: '200': description: SSE stream of agent output chunks content: text/event-stream: {} '401': description: Unauthorized content: application/json: schema: $ref: '#/components/schemas/ErrorEnvelope' /openai/conversations: get: operationId: listOpenaiConversations tags: [openai] summary: List all conversations responses: "200": description: List of conversations content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiConversation" post: operationId: createOpenaiConversation tags: [openai] summary: Create a new conversation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateOpenaiConversationBody" responses: "201": description: Created conversation content: application/json: schema: $ref: "#/components/schemas/OpenaiConversation" /openai/conversations/{id}: get: operationId: getOpenaiConversation tags: [openai] summary: Get conversation with messages parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Conversation with messages content: application/json: schema: $ref: "#/components/schemas/OpenaiConversationWithMessages" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" delete: operationId: deleteOpenaiConversation tags: [openai] summary: Delete a conversation parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/OpenaiError" /openai/conversations/{id}/messages: get: operationId: listOpenaiMessages tags: [openai] summary: List messages in a conversation parameters: - name: id in: path required: true schema: type: integer responses: "200": description: List of messages content: application/json: schema: type: array items: $ref: "#/components/schemas/OpenaiMessage" post: operationId: sendOpenaiMessage tags: [openai] summary: Send a text message and receive a streaming text response parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendOpenaiMessageBody" responses: "200": description: SSE stream of assistant text chunks content: text/event-stream: {} /openai/conversations/{id}/voice-messages: post: operationId: sendOpenaiVoiceMessage tags: [openai] summary: Send audio and receive a streaming voice response description: | This endpoint is for gpt-audio speech-to-speech flows. It accepts base64-encoded audio input and streams back transcript and audio events. parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/SendOpenaiVoiceMessageBody" responses: "200": description: SSE stream of transcript and audio chunks content: text/event-stream: {} /openai/generate-image: post: operationId: generateOpenaiImage tags: [openai] summary: Generate an image from a text prompt requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/GenerateOpenaiImageBody" responses: "200": description: Generated image data content: application/json: schema: $ref: "#/components/schemas/GenerateOpenaiImageResponse" components: parameters: AuthorizationSessionHeader: name: Authorization in: header required: false description: Opaque session token — `Bearer `. schema: type: string SessionCookie: name: sid in: cookie required: false description: Browser session cookie. schema: type: string schemas: HealthStatus: type: object properties: status: type: string required: - status AuthUser: type: object required: [id, email, firstName, lastName, profileImageUrl] properties: id: type: string email: type: [string, 'null'] format: email firstName: type: [string, 'null'] lastName: type: [string, 'null'] profileImageUrl: type: [string, 'null'] AuthUserEnvelope: type: object required: [user] properties: user: oneOf: - $ref: '#/components/schemas/AuthUser' - type: 'null' MobileTokenExchangeRequest: type: object required: [code, code_verifier, redirect_uri, state] properties: code: type: string minLength: 1 code_verifier: type: string minLength: 1 redirect_uri: type: string minLength: 1 format: uri state: type: string minLength: 1 nonce: type: string minLength: 1 MobileTokenExchangeSuccess: type: object required: [token] properties: token: type: string LogoutSuccess: type: object required: [success] properties: success: type: boolean const: true ErrorEnvelope: type: object required: [error] properties: error: type: string Project: type: object required: [id, userId, name, description, type, status, createdAt, updatedAt] properties: id: type: integer userId: type: string name: type: string description: type: [string, 'null'] type: type: string enum: [app, website, game, 3d, other] status: type: string enum: [draft, published] thumbnailUrl: type: [string, 'null'] createdAt: type: string format: date-time updatedAt: type: string format: date-time CreateProjectBody: type: object required: [name] properties: name: type: string minLength: 1 description: type: string type: type: string enum: [app, website, game, 3d, other] default: app UpdateProjectBody: type: object properties: name: type: string minLength: 1 description: type: string type: type: string enum: [app, website, game, 3d, other] status: type: string enum: [draft, published] thumbnailUrl: type: string CommunityPost: type: object required: [id, projectId, userId, title, description, tags, likes, createdAt] properties: id: type: integer projectId: type: [integer, 'null'] userId: type: string title: type: string description: type: [string, 'null'] thumbnailUrl: type: [string, 'null'] tags: type: array items: type: string likes: type: integer authorName: type: [string, 'null'] authorImageUrl: type: [string, 'null'] createdAt: type: string format: date-time CreateCommunityPostBody: type: object required: [title] properties: title: type: string minLength: 1 description: type: string projectId: type: integer thumbnailUrl: type: string tags: type: array items: type: string RunAgentBody: type: object required: [prompt] properties: prompt: type: string minLength: 1 projectId: type: integer context: type: string OpenaiConversation: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time required: - id - title - createdAt OpenaiMessage: type: object properties: id: type: integer conversationId: type: integer role: type: string content: type: string createdAt: type: string format: date-time required: - id - conversationId - role - content - createdAt CreateOpenaiConversationBody: type: object properties: title: type: string required: - title SendOpenaiMessageBody: type: object properties: content: type: string required: - content SendOpenaiVoiceMessageBody: type: object properties: audio: type: string description: Base64-encoded audio data required: - audio OpenaiConversationWithMessages: type: object properties: id: type: integer title: type: string createdAt: type: string format: date-time messages: type: array items: $ref: "#/components/schemas/OpenaiMessage" required: - id - title - createdAt - messages GenerateOpenaiImageBody: type: object properties: prompt: type: string size: type: string enum: ["1024x1024", "512x512", "256x256"] required: - prompt GenerateOpenaiImageResponse: type: object properties: b64_json: type: string required: - b64_json OpenaiError: type: object properties: error: type: string required: - error