{"openapi":"3.0.3","info":{"title":"admin API","version":"1.0.0"},"components":{"schemas":{}},"paths":{"/openapi.json":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/api/admin/auth/login":{"post":{"summary":"Admin login","tags":["Admin Auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1}},"required":["email","password"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"}},"required":["id","email","name","role"],"additionalProperties":false}},"required":["accessToken","refreshToken","user"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/auth/refresh":{"post":{"summary":"Refresh access token","tags":["Admin Auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string"}},"required":["refreshToken"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"accessToken":{"type":"string"}},"required":["accessToken"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/auth/me":{"get":{"summary":"Get current admin profile","tags":["Admin Auth"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"avatarUrl":{"type":"string","nullable":true}},"required":["id","email","name","role","avatarUrl"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/public/membership-plans/":{"get":{"summary":"List active membership plans (public, no auth)","tags":["Membership Plans"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":30},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"priceCents":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"currency":{"type":"string","maxLength":3},"billingInterval":{"type":"string","maxLength":10},"maxAiAgents":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreams":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxKb":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreamAnalysesPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxLifeEventsPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"features":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},{"type":"object","additionalProperties":{}},{"type":"array"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","code","name","description","isActive","sortOrder","priceCents","currency","billingInterval","maxAiAgents","maxDreams","maxKb","maxDreamAnalysesPerMonth","maxLifeEventsPerMonth","features","createdAt","updatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/models/":{"get":{"summary":"List models","tags":["Models"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["name","createdAt","provider"],"default":"createdAt"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string","enum":["openai","claude"]},"in":"query","name":"provider","required":false},{"schema":{"type":"string"},"in":"query","name":"isActive","required":false},{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"query","name":"q","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"provider":{"type":"string","maxLength":20},"modelName":{"type":"string","maxLength":50},"isActive":{"type":"boolean"},"temperature":{"type":"string"},"maxTokens":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdBy":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","provider","modelName","isActive","temperature","maxTokens","createdBy","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}},"post":{"summary":"Create model","tags":["Models"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"provider":{"type":"string","enum":["openai","claude"]},"modelName":{"type":"string","minLength":1,"maxLength":50},"temperature":{"type":"number","minimum":0,"maximum":2,"default":0.7},"maxTokens":{"type":"integer","minimum":1,"maximum":128000,"default":2048}},"required":["name","provider","modelName"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"provider":{"type":"string","maxLength":20},"modelName":{"type":"string","maxLength":50},"isActive":{"type":"boolean"},"temperature":{"type":"string"},"maxTokens":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdBy":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","provider","modelName","isActive","temperature","maxTokens","createdBy","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/models/{id}":{"get":{"summary":"Get model by ID","tags":["Models"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"provider":{"type":"string","maxLength":20},"modelName":{"type":"string","maxLength":50},"isActive":{"type":"boolean"},"temperature":{"type":"string"},"maxTokens":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdBy":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","provider","modelName","isActive","temperature","maxTokens","createdBy","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"patch":{"summary":"Update model","tags":["Models"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"provider":{"type":"string","enum":["openai","claude"]},"modelName":{"type":"string","minLength":1,"maxLength":50},"temperature":{"type":"number","minimum":0,"maximum":2,"default":0.7},"maxTokens":{"type":"integer","minimum":1,"maximum":128000,"default":2048},"isActive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"provider":{"type":"string","maxLength":20},"modelName":{"type":"string","maxLength":50},"isActive":{"type":"boolean"},"temperature":{"type":"string"},"maxTokens":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdBy":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","provider","modelName","isActive","temperature","maxTokens","createdBy","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete model","tags":["Models"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/models/{id}/executions":{"get":{"summary":"List recent executions for a model","tags":["Models"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"provider":{"type":"string"},"model":{"type":"string"},"userMessage":{"type":"string"},"assistantMessage":{"type":"string","nullable":true},"promptTokens":{"type":"number","nullable":true},"completionTokens":{"type":"number","nullable":true},"durationMs":{"type":"number","nullable":true},"source":{"type":"string"},"error":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","provider","model","userMessage","assistantMessage","promptTokens","completionTokens","durationMs","source","error","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/admin/prompts/":{"get":{"summary":"List prompts","tags":["Prompts"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["name","createdAt"],"default":"createdAt"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string"},"in":"query","name":"isActive","required":false},{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"query","name":"q","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"categoryId","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"includeHistory","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"includeDeleted","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}},"post":{"summary":"Create prompt","tags":["Prompts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"content":{"type":"string","minLength":1},"description":{"type":"string"},"categoryId":{"type":"string","format":"uuid","nullable":true}},"required":["name","content"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompts/{id}":{"get":{"summary":"Get prompt by ID","tags":["Prompts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"patch":{"summary":"Update prompt (legacy: begin → patch → resolve)","tags":["Prompts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"content":{"type":"string","minLength":1},"description":{"type":"string"},"categoryId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete prompt","tags":["Prompts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/prompts/{id}/versions":{"get":{"summary":"List all versions of a prompt lineage (paginated, newest first)","tags":["Prompts"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":10},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/admin/prompts/{id}/active":{"patch":{"summary":"Toggle isActive on a live prompt without creating a new version","tags":["Prompts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"isActive":{"type":"boolean"}},"required":["isActive"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompts/{id}/restore":{"post":{"summary":"Restore soft-deleted prompt","tags":["Prompts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompts/{id}/begin-edit":{"post":{"summary":"Begin draft edit on a live prompt","tags":["Prompts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"draftPromptId":{"type":"string","format":"uuid"},"draftSessionId":{"type":"string","format":"uuid"}},"required":["draftPromptId","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompts/{id}/draft":{"patch":{"summary":"Apply changes to a draft prompt (id is the draft prompt id)","tags":["Prompts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"content":{"type":"string","minLength":1},"description":{"type":"string"},"categoryId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompts/{id}/resolve":{"post":{"summary":"Promote draft prompt to live (id is the draft prompt id)","tags":["Prompts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompts/{id}/reject":{"post":{"summary":"Reject draft prompt (hard-delete)","tags":["Prompts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/prompts/{id}/set-live":{"post":{"summary":"Set a historical prompt version live (demotes the current live row)","tags":["Prompts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"content":{"type":"string"},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdBy":{"type":"string","format":"uuid","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","content","description","isActive","createdBy","categoryId","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompt-categories/":{"get":{"summary":"List prompt categories","tags":["Prompt Categories"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","description","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}},"post":{"summary":"Create prompt category","tags":["Prompt Categories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string"},"sortOrder":{"type":"integer","default":0}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","description","sortOrder","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/prompt-categories/{id}":{"get":{"summary":"Get prompt category by ID","tags":["Prompt Categories"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","description","sortOrder","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"patch":{"summary":"Update prompt category","tags":["Prompt Categories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string"},"sortOrder":{"type":"integer","default":0}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","description","sortOrder","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete prompt category","tags":["Prompt Categories"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/styles/":{"get":{"summary":"List response styles","tags":["Response Styles"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["name","label","createdAt"],"default":"createdAt"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string"},"in":"query","name":"isActive","required":false},{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"query","name":"q","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"includeHistory","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"includeDeleted","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}},"post":{"summary":"Create response style","tags":["Response Styles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"label":{"type":"string","minLength":1,"maxLength":100},"instruction":{"type":"string","minLength":1}},"required":["name","label","instruction"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/styles/{id}":{"get":{"summary":"Get response style by ID","tags":["Response Styles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"patch":{"summary":"Update response style (legacy: begin → patch → resolve)","tags":["Response Styles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"label":{"type":"string","minLength":1,"maxLength":100},"instruction":{"type":"string","minLength":1}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete response style","tags":["Response Styles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/styles/{id}/versions":{"get":{"summary":"List all versions of a style lineage (paginated, newest first)","tags":["Response Styles"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":10},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/admin/styles/{id}/active":{"patch":{"summary":"Toggle isActive on a live response style without creating a new version","tags":["Response Styles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"isActive":{"type":"boolean"}},"required":["isActive"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/styles/{id}/restore":{"post":{"summary":"Restore soft-deleted response style","tags":["Response Styles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/styles/{id}/begin-edit":{"post":{"summary":"Begin draft edit on a live response style","tags":["Response Styles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"draftStyleId":{"type":"string","format":"uuid"},"draftSessionId":{"type":"string","format":"uuid"}},"required":["draftStyleId","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/styles/{id}/draft":{"patch":{"summary":"Apply changes to a draft response style (id is the draft style id)","tags":["Response Styles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"label":{"type":"string","minLength":1,"maxLength":100},"instruction":{"type":"string","minLength":1}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/styles/{id}/resolve":{"post":{"summary":"Promote draft style to live (id is the draft style id)","tags":["Response Styles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/styles/{id}/reject":{"post":{"summary":"Reject draft style (hard-delete)","tags":["Response Styles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/styles/{id}/set-live":{"post":{"summary":"Set a historical response style version live","tags":["Response Styles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","maxLength":50},"label":{"type":"string","maxLength":100},"instruction":{"type":"string"},"isActive":{"type":"boolean"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"status":{"type":"string","maxLength":12},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"deletedBy":{"type":"string","format":"uuid","nullable":true},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","label","instruction","isActive","lineageId","version","status","parentVersionId","isDeleted","deletedAt","deletedBy","draftSessionId","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/models/{modelId}/keys/":{"post":{"summary":"Add API key for model","tags":["API Keys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["openai","claude"]},"apiKey":{"type":"string","minLength":1},"label":{"type":"string","maxLength":100}},"required":["provider","apiKey"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"modelId","required":true}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"modelId":{"type":"string","format":"uuid"},"provider":{"type":"string"},"label":{"type":"string","nullable":true},"maskedKey":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","modelId","provider","label","maskedKey","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"get":{"summary":"List API keys for model (masked)","tags":["API Keys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"modelId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"modelId":{"type":"string","format":"uuid"},"provider":{"type":"string"},"label":{"type":"string","nullable":true},"maskedKey":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","modelId","provider","label","maskedKey","createdAt","updatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/models/{modelId}/keys/{keyId}":{"delete":{"summary":"Delete API key","tags":["API Keys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"modelId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"keyId","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/provider-keys/":{"get":{"summary":"List provider keys (never returns raw key)","tags":["Provider Keys"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"label":{"type":"string","nullable":true},"hasKey":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["provider","label","hasKey","createdAt","updatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/provider-keys/{provider}":{"put":{"summary":"Upsert provider key","tags":["Provider Keys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"type":"string","minLength":1},"label":{"type":"string","maxLength":100}},"required":["apiKey"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","enum":["openai","claude"]},"in":"path","name":"provider","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"provider":{"type":"string"},"label":{"type":"string","nullable":true},"hasKey":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["provider","label","hasKey","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete provider key","tags":["Provider Keys"],"parameters":[{"schema":{"type":"string","enum":["openai","claude"]},"in":"path","name":"provider","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/system-settings/memory-overrides":{"get":{"summary":"List users with a per-user memory-limit override","tags":["System Settings"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"count":{"type":"integer"},"items":{"type":"array","items":{"type":"object","properties":{"userId":{"type":"string"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"maxDreams":{"type":"integer","nullable":true},"maxKb":{"type":"integer","nullable":true},"recentRawCount":{"type":"integer","nullable":true}},"required":["userId","name","email","maxDreams","maxKb","recentRawCount"],"additionalProperties":false}}},"required":["count","items"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/system-settings/memory-overrides/reset":{"post":{"summary":"Clear all per-user memory-limit overrides (revert to global)","tags":["System Settings"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"cleared":{"type":"integer"}},"required":["cleared"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/system-settings/":{"get":{"summary":"List system settings","tags":["System Settings"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"intValue":{"type":"integer","nullable":true},"stringValue":{"type":"string","nullable":true},"label":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["key","intValue","stringValue","label","description"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/system-settings/{key}":{"put":{"summary":"Upsert an integer system setting","tags":["System Settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"intValue":{"type":"integer"}},"required":["intValue"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"path","name":"key","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"key":{"type":"string"},"intValue":{"type":"integer","nullable":true},"stringValue":{"type":"string","nullable":true},"label":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["key","intValue","stringValue","label","description"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/provider-models/{provider}":{"get":{"summary":"List chat-capable models available for a configured provider","tags":["Provider Models"],"parameters":[{"schema":{"type":"string","enum":["openai","claude"]},"in":"path","name":"provider","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/provider-models/{provider}/refresh":{"post":{"summary":"Drop the cached provider model list and refetch from the provider","tags":["Provider Models"],"parameters":[{"schema":{"type":"string","enum":["openai","claude"]},"in":"path","name":"provider","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/test-users/":{"get":{"summary":"List test users","tags":["Test Users"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["name","email","createdAt"],"default":"createdAt"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"string","enum":["test","real"]},"in":"query","name":"type","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"isTest":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","email","role","isTest","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}},"post":{"summary":"Create test user","tags":["Test Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email"}},"required":["name","email"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"isTest":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","email","role","isTest","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/test-users/by-ids":{"post":{"summary":"Resolve multiple users by id (batch)","tags":["Test Users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":100}},"required":["ids"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true}},"required":["id","name","email"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/test-users/{id}":{"get":{"summary":"Get test user by ID","tags":["Test Users"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"},"isTest":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","email","role","isTest","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete test user","tags":["Test Users"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/test-users/{userId}/dream-sessions":{"get":{"summary":"List dream sessions for a user","tags":["Admin Dreams"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["date","createdAt","updatedAt"],"default":"date"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"date":{"type":"string"},"mainDreamSummary":{"type":"string","nullable":true},"status":{"type":"string"},"messageCount":{"type":"integer","minimum":0},"analysisCount":{"type":"integer","minimum":0},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","userId","date","mainDreamSummary","status","messageCount","analysisCount","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/admin/test-users/{userId}/dream-sessions/{sessionId}":{"get":{"summary":"Get a single dream session","tags":["Admin Dreams"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"sessionId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"date":{"type":"string"},"mainDreamSummary":{"type":"string","nullable":true},"status":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","userId","date","mainDreamSummary","status","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete a (test) user's dream session","tags":["Admin Dreams"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"sessionId","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/test-users/{userId}/dream-sessions/{sessionId}/messages":{"get":{"summary":"List messages for a dream session","tags":["Admin Dreams"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"sessionId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"sessionId":{"type":"string","format":"uuid"},"role":{"type":"string"},"content":{"type":"string"},"audioUploadId":{"type":"string","format":"uuid","nullable":true},"sequenceOrder":{"type":"integer"},"agentId":{"type":"string","format":"uuid","nullable":true},"agentName":{"type":"string","nullable":true},"agentVersion":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sessionId","role","content","audioUploadId","sequenceOrder","agentId","agentName","agentVersion","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/admin/test-users/{userId}/dream-sessions/{sessionId}/dream-summary":{"get":{"summary":"Get the clean dream-content summary for a session","tags":["Admin Dreams"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"sessionId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"content":{"type":"string"},"updatedAt":{"type":"string","nullable":true}},"required":["content","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/test-users/{userId}/dream-sessions/{sessionId}/analyses":{"get":{"summary":"List analyses for a dream session","tags":["Admin Dreams"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"sessionId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"sessionId":{"type":"string","format":"uuid"},"analysisNumber":{"type":"integer"},"mood":{"type":"string","nullable":true},"phase":{"type":"string","nullable":true},"essenceText":{"type":"string","nullable":true},"interpretation":{"type":"string"},"archetypes":{"type":"array","items":{"type":"string"}},"triggeredBy":{"type":"string"},"modelId":{"type":"string","format":"uuid","nullable":true},"modelName":{"type":"string","nullable":true},"modelProvider":{"type":"string","nullable":true},"executionLogId":{"type":"string","format":"uuid","nullable":true},"agentId":{"type":"string","format":"uuid","nullable":true},"agentName":{"type":"string","nullable":true},"agentVersion":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sessionId","analysisNumber","mood","phase","essenceText","interpretation","archetypes","triggeredBy","modelId","modelName","modelProvider","executionLogId","agentId","agentName","agentVersion","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/admin/agents/":{"get":{"summary":"List agents","tags":["Agents"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["name","createdAt"],"default":"createdAt"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"string","enum":["dream","life"]},"in":"query","name":"type","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"isDefault","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"includeHistory","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"includeDeleted","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}},"post":{"summary":"Create agent","tags":["Agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"modelId":{"type":"string","format":"uuid","nullable":true},"promptIds":{"type":"array","items":{"type":"string","format":"uuid"}},"responseStyleId":{"type":"string","format":"uuid","nullable":true}},"required":["name","type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/agents/{id}":{"get":{"summary":"Get agent","tags":["Agents"],"parameters":[{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"withDraft","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"patch":{"summary":"Update agent (legacy: begin → patch → resolve in one call)","tags":["Agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"modelId":{"type":"string","format":"uuid","nullable":true},"promptIds":{"type":"array","items":{"type":"string","format":"uuid"}},"responseStyleId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete agent","tags":["Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/agents/{id}/versions":{"get":{"summary":"List all versions of an agent lineage (resolves the lineage from the given id; paginated, newest first)","tags":["Agents"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":10},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}}},"/api/admin/agents/{id}/restore":{"post":{"summary":"Restore a soft-deleted agent","tags":["Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/agents/{id}/begin-edit":{"post":{"summary":"Begin a draft edit session — clones the agent into a draft and acquires the lock","tags":["Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"draftAgentId":{"type":"string","format":"uuid"},"draftSessionId":{"type":"string","format":"uuid"}},"required":["draftAgentId","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/agents/{id}/draft":{"patch":{"summary":"Apply changes to a draft agent (id is the draft agent id)","tags":["Agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"modelId":{"type":"string","format":"uuid","nullable":true},"responseStyleId":{"type":"string","format":"uuid","nullable":true},"prompts":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["reuse"]},"promptId":{"type":"string","format":"uuid"}},"required":["mode","promptId"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["edit"]},"promptId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":100},"content":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true}},"required":["mode","promptId"],"additionalProperties":false},{"type":"object","properties":{"mode":{"type":"string","enum":["create"]},"name":{"type":"string","minLength":1,"maxLength":100},"content":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"categoryId":{"type":"string","format":"uuid","nullable":true}},"required":["mode","name","content"],"additionalProperties":false}]}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/agents/{id}/resolve":{"post":{"summary":"Promote draft to live (id is the draft agent id)","tags":["Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/agents/{id}/reject":{"post":{"summary":"Reject draft (hard-delete all rows in the draft session)","tags":["Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/agents/{id}/set-default":{"post":{"summary":"Mark agent as default","tags":["Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/agents/{id}/set-live":{"post":{"summary":"Set a historical agent version live","tags":["Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","enum":["dream","life"]},"description":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"model":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"prompts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"status":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","lineageId","status","version"],"additionalProperties":false}},"responseStyle":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"lineageId":{"type":"string","format":"uuid"}},"required":["id","name","lineageId"],"additionalProperties":false,"nullable":true},"activeAssignmentCount":{"type":"integer","minimum":0,"default":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lineageId":{"type":"string","format":"uuid"},"version":{"type":"integer"},"status":{"type":"string","enum":["live","historical","draft"]},"parentVersionId":{"type":"string","format":"uuid","nullable":true},"isDeleted":{"type":"boolean"},"draftSessionId":{"type":"string","format":"uuid","nullable":true},"draft":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"editingBy":{"type":"string","format":"uuid","nullable":true},"editingStartedAt":{"type":"string","nullable":true}},"required":["id","editingBy","editingStartedAt"],"additionalProperties":false,"nullable":true}},"required":["id","name","type","description","isDefault","model","prompts","responseStyle","createdAt","updatedAt","lineageId","version","status","parentVersionId","isDeleted","draftSessionId"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/users/{userId}/agents":{"get":{"summary":"List agent assignment history for a user","tags":["User Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agent":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"version":{"type":"integer"}},"required":["id","name","version"],"additionalProperties":false,"nullable":true},"type":{"type":"string","enum":["dream","life"]},"modelSnapshot":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"promptSnapshots":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true}},"required":["id","name"],"additionalProperties":false}},"responseStyleSnapshot":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"activatedAt":{"type":"string"},"deactivatedAt":{"type":"string","nullable":true},"assignedBy":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true}},"required":["id","agent","type","modelSnapshot","promptSnapshots","responseStyleSnapshot","activatedAt","deactivatedAt","assignedBy"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}},"post":{"summary":"Assign an agent to a user","tags":["User Agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string","format":"uuid"}},"required":["agentId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/users/{userId}/agents/active":{"get":{"summary":"Get currently active agent assignments (one per type)","tags":["User Agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"agentId":{"type":"string","format":"uuid","nullable":true},"agentName":{"type":"string","nullable":true},"agentVersion":{"type":"integer","nullable":true},"type":{"type":"string","enum":["dream","life"]},"modelIdSnapshot":{"type":"string","format":"uuid","nullable":true},"modelName":{"type":"string","nullable":true},"promptSnapshots":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true}},"required":["id","name"],"additionalProperties":false}},"responseStyleIdSnapshot":{"type":"string","format":"uuid","nullable":true},"responseStyleName":{"type":"string","nullable":true},"activatedAt":{"type":"string"},"deactivatedAt":{"type":"string","nullable":true}},"required":["id","agentId","agentName","agentVersion","type","modelIdSnapshot","modelName","promptSnapshots","responseStyleIdSnapshot","responseStyleName","activatedAt","deactivatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Deactivate the active assignment for a user (per type)","tags":["User Agents"],"parameters":[{"schema":{"type":"string","enum":["dream","life"]},"in":"query","name":"type","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/admin/test-users/{userId}/memory-limits":{"get":{"summary":"Get a user's memory-limit override + effective values","tags":["System Settings"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"maxDreams":{"type":"integer","nullable":true},"maxKb":{"type":"integer","nullable":true},"recentRawCount":{"type":"integer","nullable":true},"globalMaxDreams":{"type":"integer"},"globalMaxKb":{"type":"integer"},"globalRecentRawCount":{"type":"integer"},"effectiveMaxDreams":{"type":"integer"},"effectiveMaxKb":{"type":"integer"},"effectiveRecentRawCount":{"type":"integer"}},"required":["maxDreams","maxKb","recentRawCount","globalMaxDreams","globalMaxKb","globalRecentRawCount","effectiveMaxDreams","effectiveMaxKb","effectiveRecentRawCount"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"put":{"summary":"Set/clear a user's memory-limit override","tags":["System Settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"maxDreams":{"type":"integer","nullable":true},"maxKb":{"type":"integer","nullable":true},"recentRawCount":{"type":"integer","nullable":true}},"required":["maxDreams","maxKb","recentRawCount"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"userId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"maxDreams":{"type":"integer","nullable":true},"maxKb":{"type":"integer","nullable":true},"recentRawCount":{"type":"integer","nullable":true},"globalMaxDreams":{"type":"integer"},"globalMaxKb":{"type":"integer"},"globalRecentRawCount":{"type":"integer"},"effectiveMaxDreams":{"type":"integer"},"effectiveMaxKb":{"type":"integer"},"effectiveRecentRawCount":{"type":"integer"}},"required":["maxDreams","maxKb","recentRawCount","globalMaxDreams","globalMaxKb","globalRecentRawCount","effectiveMaxDreams","effectiveMaxKb","effectiveRecentRawCount"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/membership-plans/":{"get":{"summary":"List membership plans","tags":["Membership Plans"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["name","code","sortOrder","priceCents","createdAt"],"default":"sortOrder"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false},{"schema":{"type":"string"},"in":"query","name":"isActive","required":false},{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"query","name":"q","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":30},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"priceCents":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"currency":{"type":"string","maxLength":3},"billingInterval":{"type":"string","maxLength":10},"maxAiAgents":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreams":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxKb":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreamAnalysesPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxLifeEventsPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"features":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},{"type":"object","additionalProperties":{}},{"type":"array"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","code","name","description","isActive","sortOrder","priceCents","currency","billingInterval","maxAiAgents","maxDreams","maxKb","maxDreamAnalysesPerMonth","maxLifeEventsPerMonth","features","createdAt","updatedAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","limit","total","totalPages"],"additionalProperties":false}},"required":["data","pagination"],"additionalProperties":false}}}}}},"post":{"summary":"Create membership plan","tags":["Membership Plans"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":30,"pattern":"^[a-z0-9_-]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","nullable":true},"sortOrder":{"type":"integer","default":0},"priceCents":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"billingInterval":{"type":"string","enum":["month","year"],"default":"month"},"maxAiAgents":{"type":"integer","minimum":0,"nullable":true},"maxDreams":{"type":"integer","minimum":0,"nullable":true},"maxKb":{"type":"integer","minimum":0,"nullable":true},"maxDreamAnalysesPerMonth":{"type":"integer","minimum":0,"nullable":true},"maxLifeEventsPerMonth":{"type":"integer","minimum":0,"nullable":true},"features":{"type":"object","additionalProperties":{"type":"boolean"},"default":{}}},"required":["code","name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":30},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"priceCents":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"currency":{"type":"string","maxLength":3},"billingInterval":{"type":"string","maxLength":10},"maxAiAgents":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreams":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxKb":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreamAnalysesPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxLifeEventsPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"features":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},{"type":"object","additionalProperties":{}},{"type":"array"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","code","name","description","isActive","sortOrder","priceCents","currency","billingInterval","maxAiAgents","maxDreams","maxKb","maxDreamAnalysesPerMonth","maxLifeEventsPerMonth","features","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}}},"/api/admin/membership-plans/{id}":{"get":{"summary":"Get membership plan by ID","tags":["Membership Plans"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":30},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"priceCents":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"currency":{"type":"string","maxLength":3},"billingInterval":{"type":"string","maxLength":10},"maxAiAgents":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreams":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxKb":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreamAnalysesPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxLifeEventsPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"features":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},{"type":"object","additionalProperties":{}},{"type":"array"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","code","name","description","isActive","sortOrder","priceCents","currency","billingInterval","maxAiAgents","maxDreams","maxKb","maxDreamAnalysesPerMonth","maxLifeEventsPerMonth","features","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"patch":{"summary":"Update membership plan","tags":["Membership Plans"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":30,"pattern":"^[a-z0-9_-]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","nullable":true},"sortOrder":{"type":"integer","default":0},"priceCents":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"billingInterval":{"type":"string","enum":["month","year"],"default":"month"},"maxAiAgents":{"type":"integer","minimum":0,"nullable":true},"maxDreams":{"type":"integer","minimum":0,"nullable":true},"maxKb":{"type":"integer","minimum":0,"nullable":true},"maxDreamAnalysesPerMonth":{"type":"integer","minimum":0,"nullable":true},"maxLifeEventsPerMonth":{"type":"integer","minimum":0,"nullable":true},"features":{"type":"object","additionalProperties":{"type":"boolean"},"default":{}},"isActive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string","maxLength":30},"name":{"type":"string","maxLength":100},"description":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"priceCents":{"type":"integer","minimum":-2147483648,"maximum":2147483647},"currency":{"type":"string","maxLength":3},"billingInterval":{"type":"string","maxLength":10},"maxAiAgents":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreams":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxKb":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxDreamAnalysesPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"maxLifeEventsPerMonth":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"nullable":true},"features":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},{"type":"object","additionalProperties":{}},{"type":"array"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","code","name","description","isActive","sortOrder","priceCents","currency","billingInterval","maxAiAgents","maxDreams","maxKb","maxDreamAnalysesPerMonth","maxLifeEventsPerMonth","features","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete membership plan","tags":["Membership Plans"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}}}}