{"openapi":"3.1.0","info":{"title":"ContextKit API","version":"0.1.0","description":"Context Infrastructure for AI Agents. Bankr-native context compression, handoff, and profile APIs with x402 payments."},"servers":[{"url":"https://contextkit.pro"},{"url":"http://localhost:3000"}],"tags":[{"name":"Context"},{"name":"Authentication"},{"name":"Analytics"},{"name":"Tokens"},{"name":"Webhooks"}],"externalDocs":{"description":"ContextKit developer documentation","url":"https://contextkit.pro/docs"},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"ContextKit API key"},"X402Payment":{"type":"apiKey","in":"header","name":"X-Payment","description":"x402 payment payload returned from a prior HTTP 402 response."}},"schemas":{},"parameters":{}},"paths":{"/api/context/upload":{"post":{"summary":"Upload long context for contextId-based calls","description":"Stores long message payloads temporarily and returns a small contextId that can be sent to paid endpoints, including Bankr-hosted x402 services.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["role","content"]},"minItems":1,"maxItems":200},"metadata":{"type":"object","additionalProperties":{}},"precompute":{"type":"object","properties":{"endpoint":{"type":"string","enum":["summarize","compress-context","handoff","extract-profile","memory-enrichment"]},"mode":{"type":"string","enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]}},"required":["endpoint"]},"ttlSeconds":{"type":"integer","minimum":300,"maximum":86400,"default":3600}},"required":["messages"]}}}},"responses":{"201":{"description":"Context uploaded.","content":{"application/json":{"schema":{"type":"object","properties":{"contextId":{"type":"string"},"expiresAt":{"type":"string"},"messageCount":{"type":"number"},"inputTokens":{"type":"number"},"precomputed":{"type":["object","null"],"properties":{"endpoint":{"type":"string","enum":["summarize","compress-context","handoff","extract-profile","memory-enrichment"]},"mode":{"type":["string","null"],"enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]}},"required":["endpoint","mode"]}},"required":["contextId","expiresAt","messageCount","inputTokens"]}}}},"422":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/context/upload-text":{"post":{"summary":"Upload plain-text long context","description":"Accepts a plain text body, precomputes the requested endpoint, and returns a contextId for hosted Bankr x402 calls. Query params: endpoint=summarize|compress-context|handoff|extract-profile|memory-enrichment and mode=micro|compact|extended|debug|extract-profile|memory-enrichment.","requestBody":{"content":{"text/plain":{"schema":{"type":"string"}}}},"responses":{"201":{"description":"Plain-text context uploaded.","content":{"application/json":{"schema":{"type":"object","properties":{"contextId":{"type":"string"},"expiresAt":{"type":"string"},"messageCount":{"type":"number"},"inputTokens":{"type":"number"},"precomputed":{"type":["object","null"],"properties":{"endpoint":{"type":"string","enum":["summarize","compress-context","handoff","extract-profile","memory-enrichment"]},"mode":{"type":["string","null"],"enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]}},"required":["endpoint","mode"]}},"required":["contextId","expiresAt","messageCount","inputTokens"]}}}},"422":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/summarize":{"post":{"summary":"Summarize context","description":"Requires Bearer API key with context:write scope and x402 payment of $0.05.","security":[{"ApiKeyAuth":[],"X402Payment":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["role","content"]},"minItems":1,"maxItems":200},"contextId":{"type":"string","pattern":"^ctx_[a-f0-9]{24}$"},"mode":{"type":"string","enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]},"metadata":{"type":"object","additionalProperties":{}},"webhookUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Successful context operation.","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["micro"]},"micro":{"type":"string"},"metrics":{"type":"object","properties":{"inputTokens":{"type":"number"},"microTokens":{"type":"number"},"reductionPercent":{"type":"number"}},"required":["inputTokens","microTokens","reductionPercent"]}},"required":["mode","micro","metrics"]},{"type":"object","properties":{"mode":{"type":"string","enum":["compact","extended","debug"]},"summary":{"type":"string"},"micro":{"type":"string"},"compact":{"type":"string"},"extended":{"type":"string"},"state":{"type":"object","properties":{"goal":{"type":"string"},"status":{"type":"string"},"blockers":{"type":"array","items":{"type":"string"}},"next":{"type":"array","items":{"type":"string"}}},"required":["goal","status","blockers","next"]},"keyDecisions":{"type":"array","items":{"type":"string"}},"actionItems":{"type":"array","items":{"type":"string"}},"openQuestions":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"metrics":{"type":"object","properties":{"inputTokens":{"type":"number"},"compactTokens":{"type":"number"},"stateTokens":{"type":"number"},"totalOutputTokens":{"type":"number"},"reductionPercent":{"type":"number"},"latencyMs":{"type":"number"}},"required":["inputTokens","compactTokens","stateTokens","totalOutputTokens","reductionPercent","latencyMs"]},"confidence":{"type":"number"}},"required":["mode","state","metrics"]}]}}}},"401":{"description":"Invalid API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"x402 payment required or verification failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/compress-context":{"post":{"summary":"Compress context","description":"Requires Bearer API key with context:write scope and x402 payment of $0.03.","security":[{"ApiKeyAuth":[],"X402Payment":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["role","content"]},"minItems":1,"maxItems":200},"contextId":{"type":"string","pattern":"^ctx_[a-f0-9]{24}$"},"mode":{"type":"string","enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]},"metadata":{"type":"object","additionalProperties":{}},"webhookUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Successful context operation.","content":{"application/json":{"schema":{"type":"object","properties":{"compressedContext":{"type":"string"},"state":{"type":"object","properties":{"goals":{"type":"array","items":{"type":"string"}},"status":{"type":"array","items":{"type":"string"}},"activeProblems":{"type":"array","items":{"type":"string"}},"constraints":{"type":"array","items":{"type":"string"}},"decisions":{"type":"array","items":{"type":"string"}},"nextSteps":{"type":"array","items":{"type":"string"}}},"required":["goals","status","activeProblems","constraints","decisions","nextSteps"]},"entities":{"type":"object","properties":{"people":{"type":"array","items":{"type":"string"}},"projects":{"type":"array","items":{"type":"string"}},"technologies":{"type":"array","items":{"type":"string"}},"organizations":{"type":"array","items":{"type":"string"}},"deadlines":{"type":"array","items":{"type":"string"}}},"required":["people","projects","technologies","organizations","deadlines"]},"conflicts":{"type":"array","items":{"type":"object","properties":{"old":{"type":"string"},"new":{"type":"string"}},"required":["old","new"]}},"metrics":{"type":"object","properties":{"inputTokens":{"type":"number"},"compressedTokens":{"type":"number"},"reductionPercent":{"type":"number"}},"required":["inputTokens","compressedTokens","reductionPercent"]}},"required":["compressedContext","state","entities","metrics"]}}}},"401":{"description":"Invalid API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"x402 payment required or verification failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/handoff":{"post":{"summary":"Create agent handoff","description":"Requires Bearer API key with context:write scope and x402 payment of $0.03.","security":[{"ApiKeyAuth":[],"X402Payment":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["role","content"]},"minItems":1,"maxItems":200},"contextId":{"type":"string","pattern":"^ctx_[a-f0-9]{24}$"},"mode":{"type":"string","enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]},"metadata":{"type":"object","additionalProperties":{}},"webhookUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Successful context operation.","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"type":"object","properties":{"name":{"type":"string"},"goal":{"type":"string"},"currentState":{"type":"string"}},"required":["name","goal","currentState"]},"completed":{"type":"array","items":{"type":"string"}},"inProgress":{"type":"array","items":{"type":"string"}},"pending":{"type":"array","items":{"type":"string"}},"blockers":{"type":"array","items":{"type":"string"}},"failedApproaches":{"type":"array","items":{"type":"object","properties":{"attempt":{"type":"string"},"result":{"type":"string"},"lesson":{"type":"string"}},"required":["attempt","result","lesson"]}},"decisions":{"type":"array","items":{"type":"object","properties":{"decision":{"type":"string"},"reason":{"type":"string"}},"required":["decision","reason"]}},"priorities":{"type":"array","items":{"type":"string"}},"criticalContext":{"type":"object","properties":{"mustKnow":{"type":"array","items":{"type":"string"}},"mustNotDo":{"type":"array","items":{"type":"string"}},"biggestRisk":{"type":"string"},"successMetric":{"type":"string"}},"required":["mustKnow","mustNotDo","biggestRisk","successMetric"]},"startHere":{"type":"string"},"agentNotes":{"type":"array","items":{"type":"string"}}},"required":["project","completed","inProgress","pending","blockers","failedApproaches","decisions","priorities","criticalContext","startHere","agentNotes"]}}}},"401":{"description":"Invalid API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"x402 payment required or verification failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/extract-profile":{"post":{"summary":"Extract user profile","description":"Requires Bearer API key with context:write scope and x402 payment of $0.04.","security":[{"ApiKeyAuth":[],"X402Payment":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["role","content"]},"minItems":1,"maxItems":200},"contextId":{"type":"string","pattern":"^ctx_[a-f0-9]{24}$"},"mode":{"type":"string","enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]},"metadata":{"type":"object","additionalProperties":{}},"webhookUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Successful context operation.","content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["micro","compact","full"]},"micro":{"type":"object","properties":{"identity":{"type":"object","properties":{"profession":{"type":"string"},"location":{"type":"string"},"age":{"type":["number","null"]}}},"preferences":{"type":"array","items":{"type":"string"}},"goals":{"type":"array","items":{"type":"string"}}},"required":["identity","preferences","goals"]},"compact":{"type":"object","properties":{"identity":{"type":"object","properties":{"profession":{"type":"string"},"location":{"type":"string"},"age":{"type":["number","null"]}}},"skills":{"type":"array","items":{"type":"string"}},"interests":{"type":"array","items":{"type":"string"}},"preferences":{"type":"array","items":{"type":"string"}},"goals":{"type":"array","items":{"type":"string"}},"traits":{"type":"array","items":{"type":"string"}}},"required":["identity","skills","interests","preferences","goals","traits"]},"full":{"type":"object","properties":{"identity":{"type":"object","properties":{"profession":{"type":"string"},"location":{"type":"string"},"age":{"type":["number","null"]}}},"skills":{"type":"array","items":{"type":"string"}},"interests":{"type":"array","items":{"type":"string"}},"stablePreferences":{"type":"array","items":{"type":"string"}},"currentGoals":{"type":"array","items":{"type":"string"}},"futurePlans":{"type":"array","items":{"type":"string"}},"inferredTraits":{"type":"array","items":{"type":"string"}},"stableMemories":{"type":"array","items":{"type":"string"}},"evolvingMemories":{"type":"array","items":{"type":"string"}}},"required":["identity","skills","interests","stablePreferences","currentGoals","futurePlans","inferredTraits","stableMemories","evolvingMemories"]},"memoryFacts":{"type":"array","items":{"type":"object","properties":{"fact":{"type":"string"},"category":{"type":"string"},"stability":{"type":"string","enum":["stable","evolving"]},"confidence":{"type":"number"}},"required":["fact","category","stability","confidence"]}},"interests":{"type":"array","items":{"type":"string"}},"riskTolerance":{"type":"string"},"communicationStyle":{"type":"string"},"preferences":{"type":"array","items":{"type":"string"}},"importantContext":{"type":"array","items":{"type":"string"}},"identity":{"type":"object","properties":{"profession":{"type":"string"},"location":{"type":"string"},"age":{"type":["number","null"]}}},"skills":{"type":"array","items":{"type":"string"}},"goals":{"type":"array","items":{"type":"string"}},"futurePlans":{"type":"array","items":{"type":"string"}},"behaviorPatterns":{"type":"array","items":{"type":"string"}},"dislikes":{"type":"array","items":{"type":"string"}},"careerStage":{"type":"string"},"managementIntent":{"type":"boolean"},"entrepreneurial":{"type":"boolean"},"inferredTraits":{"type":"array","items":{"type":"string"}},"stableMemories":{"type":"array","items":{"type":"string"}},"evolvingMemories":{"type":"array","items":{"type":"string"}},"deprecatedMemories":{"type":"array","items":{"type":"string"}},"memoryImportance":{"type":"number"},"confidence":{"type":"number"}},"required":["mode","micro","compact","full","memoryFacts","interests","riskTolerance","communicationStyle","preferences","importantContext","identity","skills","goals","futurePlans","behaviorPatterns","dislikes","careerStage","managementIntent","entrepreneurial","inferredTraits","stableMemories","evolvingMemories","deprecatedMemories","memoryImportance","confidence"]}}}},"401":{"description":"Invalid API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"x402 payment required or verification failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/memory-enrichment":{"post":{"summary":"Enrich long-term memory","description":"Requires Bearer API key with context:write scope and x402 payment of $0.04.","security":[{"ApiKeyAuth":[],"X402Payment":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["role","content"]},"minItems":1,"maxItems":200},"contextId":{"type":"string","pattern":"^ctx_[a-f0-9]{24}$"},"mode":{"type":"string","enum":["micro","compact","extended","debug","extract-profile","memory-enrichment"]},"metadata":{"type":"object","additionalProperties":{}},"webhookUrl":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"Successful context operation.","content":{"application/json":{"schema":{"type":"object","properties":{"activeMemories":{"type":"array","items":{"type":"object","properties":{"fact":{"type":"string"},"category":{"type":"string"},"stability":{"type":"string","enum":["stable"]},"confidence":{"type":"number"}},"required":["fact","category","stability","confidence"]}},"evolvingMemories":{"type":"array","items":{"type":"object","properties":{"fact":{"type":"string"},"category":{"type":"string"},"stability":{"type":"string","enum":["evolving"]},"confidence":{"type":"number"}},"required":["fact","category","stability","confidence"]}},"conflicts":{"type":"array","items":{"type":"object","properties":{"old":{"type":"string"},"new":{"type":"string"},"reason":{"type":"string"}},"required":["old","new","reason"]}},"stablePreferences":{"type":"array","items":{"type":"string"}},"evolvingPreferences":{"type":"array","items":{"type":"string"}},"longTermGoals":{"type":"array","items":{"type":"string"}},"supersededMemories":{"type":"array","items":{"type":"string"}},"memoryConflicts":{"type":"array","items":{"type":"object","properties":{"current":{"type":"string"},"superseded":{"type":"array","items":{"type":"string"}}},"required":["current","superseded"]}},"stableMemories":{"type":"array","items":{"type":"string"}},"legacyEvolvingMemories":{"type":"array","items":{"type":"string"}},"deprecatedMemories":{"type":"array","items":{"type":"string"}},"confidence":{"type":"number"}},"required":["activeMemories","evolvingMemories","conflicts","stablePreferences","evolvingPreferences","longTermGoals","supersededMemories","memoryConflicts","stableMemories","deprecatedMemories","confidence"]}}}},"401":{"description":"Invalid API key.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"x402 payment required or verification failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Validation failed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/auth/create-key":{"post":{"summary":"Create an API key","description":"Requires admin bearer token. Returns the full key once only.","security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"environment":{"type":"string","enum":["test","live"],"default":"test"},"scopes":{"type":"array","items":{"type":"string","enum":["context:write","analytics:read","webhooks:write","keys:read"]},"default":["context:write"]}},"required":["name"]}}}},"responses":{"201":{"description":"API key created.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"apiKey":{"type":"object","additionalProperties":{}}},"required":["key","apiKey"]}}}},"401":{"description":"Unauthorized.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/dashboard/signup":{"post":{"summary":"Create a self-serve dashboard account","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":12,"maxLength":128},"name":{"type":"string","minLength":1,"maxLength":80},"company":{"type":"string","minLength":1,"maxLength":120}},"required":["email","password","name"]}}}},"responses":{"201":{"description":"Account and first API key created.","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"type":"object","additionalProperties":{}},"key":{"type":"string"},"apiKey":{"type":"object","additionalProperties":{}}},"required":["account","key","apiKey"]}}}},"409":{"description":"Account already exists.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/dashboard/login":{"post":{"summary":"Login to dashboard","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1,"maxLength":128}},"required":["email","password"]}}}},"responses":{"200":{"description":"Dashboard session created.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"account":{"type":"object","additionalProperties":{}}},"required":["ok","account"]}}}},"401":{"description":"Invalid login.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/dashboard/create-key":{"post":{"summary":"Create an API key for the current dashboard account","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"environment":{"type":"string","enum":["test","live"],"default":"test"},"scopes":{"type":"array","items":{"type":"string","enum":["context:write","analytics:read","webhooks:write","keys:read"]},"default":["context:write"]}},"required":["name"]}}}},"responses":{"201":{"description":"API key created.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"apiKey":{"type":"object","additionalProperties":{}}},"required":["key","apiKey"]}}}},"401":{"description":"Dashboard session required.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/auth/revoke-key":{"post":{"summary":"Revoke an API key","security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"keyId":{"type":"string","minLength":1}},"required":["keyId"]}}}},"responses":{"200":{"description":"Revocation result.","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean"}},"required":["revoked"]}}}}}}},"/api/analytics/overview":{"get":{"summary":"Get real aggregated analytics","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Analytics overview.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}}}}},"/api/tokens/estimate":{"post":{"summary":"Estimate token counts and reduction","security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["system","user","assistant","tool"]},"content":{"type":"string","minLength":1,"maxLength":50000}},"required":["role","content"]}}]},"compressed":{"type":"string"},"modelFamily":{"type":"string","enum":["openai","claude","gemini"],"default":"openai"}},"required":["input"]}}}},"responses":{"200":{"description":"Token estimate.","content":{"application/json":{"schema":{"type":"object","properties":{"inputTokens":{"type":"number"},"compressedTokens":{"type":"number"},"reductionPercent":{"type":"number"}},"required":["inputTokens","compressedTokens","reductionPercent"]}}}}}}},"/api/webhooks/register":{"post":{"summary":"Register webhook endpoint","security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"},"minItems":1},"secret":{"type":"string","minLength":16}},"required":["url","events"]}}}},"responses":{"201":{"description":"Webhook registered.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"secret":{"type":"string"},"status":{"type":"string"}},"required":["id","secret","status"]}}}}}}},"/api/webhooks/replay":{"post":{"summary":"Replay a webhook event","security":[{"ApiKeyAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"eventId":{"type":"string","minLength":1},"url":{"type":"string","format":"uri"}},"required":["eventId"]}}}},"responses":{"200":{"description":"Webhook replay queued.","content":{"application/json":{"schema":{"type":"object","properties":{"replayed":{"type":"boolean"},"eventId":{"type":"string"}},"required":["replayed","eventId"]}}}}}}}},"webhooks":{}}