{"openapi":"3.1.0","info":{"title":"CuriosityAI API","version":"1.0.0","description":"Agent-readable endpoints for CuriosityAI. The stable API is versioned under /api/v1. The unversioned /api paths remain compatibility aliases and will receive a Sunset header before removal. Breaking changes use a new major URL version; non-breaking changes are added to the current version.","contact":{"name":"CuriosityAI support","url":"https://localhost:3000/support"}},"servers":[{"url":"https://localhost:3000","description":"CuriosityAI web origin"}],"tags":[{"name":"AI","description":"Learning conversations and AI-powered study tools."},{"name":"Account","description":"Signed-in account management."}],"paths":{"/api/ai":{"post":{"operationId":"generateLearningResponse","tags":["AI"],"summary":"Generate a learning response","description":"Runs a chat, exploration, quiz, or thinking feature for an authenticated user's conversation. Responses may stream for chat features.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiRequest"}}}},"responses":{"200":{"description":"A JSON feature result or a text/event-stream chat response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiResponse"}},"text/event-stream":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"},"502":{"$ref":"#/components/responses/ProviderError"},"503":{"$ref":"#/components/responses/NotConfigured"}}}},"/api/account/delete":{"post":{"operationId":"deleteAccount","tags":["Account"],"summary":"Delete the signed-in account","description":"Permanently deletes the signed-in user's CuriosityAI data and Clerk account after an exact confirmation phrase.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteAccountRequest"}}}},"responses":{"200":{"description":"Application data and sign-in account were deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteAccountResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"},"502":{"$ref":"#/components/responses/ProviderError"}}}},"/api/v1/ai":{"$ref":"#/paths/~1api~1ai"},"/api/v1/account/delete":{"$ref":"#/paths/~1api~1account~1delete"}},"x-api-versioning":{"strategy":"url-path","currentVersion":"v1","basePath":"/api/v1","compatibilityAliases":["/api/ai","/api/account/delete"],"deprecationPolicy":"Breaking changes require a new major version. Compatibility aliases are retained until a Sunset header and migration notice are published."},"components":{"securitySchemes":{"clerkSession":{"type":"http","scheme":"bearer","bearerFormat":"Clerk session token","description":"A Clerk-authenticated session token."}},"schemas":{"ApiError":{"type":"object","required":["error","code"],"properties":{"error":{"type":"string","description":"Human-readable error message."},"code":{"type":"string","description":"Stable machine-readable error code."},"resolution":{"type":"string","description":"Suggested next action."}}},"AiRequest":{"type":"object","required":["feature","conversationId"],"properties":{"feature":{"type":"string","enum":["chat","learn-more","curiosity-map","curiosity-branch","quiz","think-first","think-first-review","explain-back","explain-back-review","think-challenge","think-challenge-reply"],"description":"Learning operation to run."},"conversationId":{"type":"string","description":"The signed-in user's conversation ID."},"learnMoreType":{"type":"string","description":"Optional kind of deeper explanation."},"parentMessageId":{"type":"string"},"topic":{"type":"string"},"requestId":{"type":"string"},"branch":{"type":"object","required":["kind","title"],"properties":{"kind":{"type":"string","enum":["question","related","experiment","custom"]},"title":{"type":"string"},"note":{"type":"string"}}},"claimMessageId":{"type":"string"}},"additionalProperties":false},"AiResponse":{"type":"object","additionalProperties":true,"description":"Feature-specific JSON result."},"DeleteAccountRequest":{"type":"object","required":["confirmation"],"properties":{"confirmation":{"type":"string","description":"The exact phrase shown in the account deletion UI."}},"additionalProperties":false},"DeleteAccountResponse":{"type":"object","required":["deleted","accountDeleted","signInDeleted"],"properties":{"deleted":{"type":"integer","minimum":0},"accountDeleted":{"type":"boolean"},"signInDeleted":{"type":"boolean"}}}},"responses":{"BadRequest":{"description":"The request is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"Unauthorized":{"description":"Authentication is required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"Forbidden":{"description":"The request is not allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"NotFound":{"description":"The requested resource was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"RateLimited":{"description":"Too many requests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"ServerError":{"description":"The server could not complete the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"ProviderError":{"description":"An upstream provider or account deletion dependency failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"NotConfigured":{"description":"Required server configuration is missing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}