{"openapi":"3.1.0","info":{"title":"AgentPrizm V2 platform administration API","version":"1.0.0","description":"Browser-session-only platform governance. A universal MCP key and its project permissions confer no platform authority. Account summaries expose aggregate memory counts, never memory content. Administrator role and manual entitlement changes are owner-only."},"servers":[{"url":"/"}],"paths":{"/api/platform/identity":{"get":{"operationId":"getPlatformIdentity","summary":"Read the current platform actor identity","security":[{"BrowserSession":[]}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformIdentity"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/accounts":{"get":{"operationId":"listPlatformAccounts","summary":"Search bounded account summaries","description":"Returns aggregate memory counts only; memory content and raw credentials are never returned.","security":[{"BrowserSession":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"type":"string","maxLength":254,"default":""}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":100000,"default":0}}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformAccounts"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/audit":{"get":{"operationId":"listPlatformAudit","summary":"Read a bounded platform audit page","description":"before and beforeId form one seek cursor and must be supplied together.","security":[{"BrowserSession":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"before","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"beforeId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformAuditPage"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/analytics":{"get":{"operationId":"getPlatformAnalytics","summary":"Read bounded platform aggregate analytics","description":"Returns platform-wide aggregate counts and UTC daily totals only. It never returns account identities, credentials, or memory content.","security":[{"BrowserSession":[]}],"parameters":[{"name":"range","in":"query","required":false,"description":"UTC reporting period.","schema":{"enum":["7d","30d","90d"],"default":"7d"}}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformAnalytics"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/accounts/{accountId}":{"get":{"operationId":"getPlatformAccount","summary":"Read account plan and entitlement detail","description":"basePlan is the stored account plan. Grants and subscription state are reported separately; this response does not label either as an effective plan.","security":[{"BrowserSession":[]}],"parameters":[{"name":"accountId","in":"path","required":true,"description":"Canonical account identifier.","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformAccountDetail"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/accounts/{accountId}/status":{"post":{"operationId":"setPlatformAccountStatus","summary":"Enable or disable a customer account","description":"Delegated platform administrators may govern customers; protected owner and administrator accounts cannot be disabled here.","security":[{"BrowserSession":[]}],"parameters":[{"name":"Origin","in":"header","required":true,"description":"Must exactly match the configured public origin for cookie-authenticated mutations.","schema":{"type":"string","format":"uri"}},{"name":"accountId","in":"path","required":true,"description":"Canonical account identifier.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateMutation"}}}},"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Updated"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/accounts/{accountId}/administrator":{"post":{"operationId":"setPlatformAdministrator","summary":"Grant or revoke platform-administrator authority","description":"Owner-only. Platform authority is independent of MCP project permissions.","security":[{"BrowserSession":[]}],"parameters":[{"name":"Origin","in":"header","required":true,"description":"Must exactly match the configured public origin for cookie-authenticated mutations.","schema":{"type":"string","format":"uri"}},{"name":"accountId","in":"path","required":true,"description":"Canonical account identifier.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateMutation"}}}},"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Updated"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/accounts/{accountId}/entitlements":{"post":{"operationId":"grantPlatformEntitlement","summary":"Grant a bounded manual commercial entitlement","description":"Owner-only. operationId is caller-generated replay identity. Validity begins no earlier than 1970, ends after startsAt, and spans at most five years.","security":[{"BrowserSession":[]}],"parameters":[{"name":"Origin","in":"header","required":true,"description":"Must exactly match the configured public origin for cookie-authenticated mutations.","schema":{"type":"string","format":"uri"}},{"name":"accountId","in":"path","required":true,"description":"Canonical account identifier.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntitlementGrantInput"}}}},"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntitlementGrantResult"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/platform/accounts/{accountId}/entitlements/{grantId}/revoke":{"post":{"operationId":"revokePlatformEntitlement","summary":"Revoke a manual commercial entitlement","description":"Owner-only. Referral grants cannot be revoked through this operation.","security":[{"BrowserSession":[]}],"parameters":[{"name":"Origin","in":"header","required":true,"description":"Must exactly match the configured public origin for cookie-authenticated mutations.","schema":{"type":"string","format":"uri"}},{"name":"accountId","in":"path","required":true,"description":"Canonical account identifier.","schema":{"type":"string","format":"uuid"}},{"name":"grantId","in":"path","required":true,"description":"Canonical manual entitlement-grant identifier.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReasonInput"}}}},"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Updated"}}}},"400":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"A bounded platform-administration error; never credentials or memory content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"BrowserSession":{"type":"apiKey","in":"cookie","name":"__Host-agentprizm_v2_session","description":"Secure HttpOnly same-site browser session established by sign-in. The raw session value is never an API parameter. Mutations additionally require an exact Origin header."}},"schemas":{"Error":{"type":"object","required":["error"],"additionalProperties":false,"properties":{"error":{"type":"string"}}},"Updated":{"type":"object","required":["updated"],"additionalProperties":false,"properties":{"updated":{"const":true}}},"StateMutation":{"type":"object","required":["enabled","reason"],"additionalProperties":false,"properties":{"enabled":{"type":"boolean"},"reason":{"type":"string","minLength":1,"maxLength":500,"pattern":".*\\S.*","description":"Trimmed audit reason."}}},"ReasonInput":{"type":"object","required":["reason"],"additionalProperties":false,"properties":{"reason":{"type":"string","minLength":1,"maxLength":500,"pattern":".*\\S.*","description":"Trimmed audit reason."}}},"PlatformIdentity":{"type":"object","required":["id","email","name","role"],"additionalProperties":false,"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email","maxLength":254},"name":{"type":"string","minLength":1,"maxLength":200},"role":{"enum":["owner","platform_administrator"]}}},"PlatformAccount":{"type":"object","required":["id","tenantId","email","name","role","disabledAt","createdAt","emailVerified","totalMemories"],"additionalProperties":false,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email","maxLength":254},"name":{"type":"string","minLength":1,"maxLength":200},"role":{"enum":["owner","platform_administrator","customer"]},"disabledAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"emailVerified":{"type":"boolean"},"totalMemories":{"type":"integer","minimum":0,"description":"Aggregate non-forgotten memory count; no memory content."}}},"PlatformAccounts":{"type":"object","required":["users","total","limit","offset"],"additionalProperties":false,"properties":{"users":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/PlatformAccount"}},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1,"maximum":100},"offset":{"type":"integer","minimum":0,"maximum":100000}}},"Subscription":{"type":"object","required":["plan","status","periodEnd"],"additionalProperties":false,"properties":{"plan":{"enum":["hobby","starter","builder","scale"]},"status":{"enum":["active","trialing","past_due","canceled","unpaid","paused","incomplete","incomplete_expired"]},"periodEnd":{"type":"string","format":"date-time"}}},"Entitlement":{"type":"object","required":["id","plan","source","startsAt","expiresAt","revokedAt"],"additionalProperties":false,"properties":{"id":{"type":"string","format":"uuid"},"plan":{"enum":["starter","builder","scale"]},"source":{"enum":["manual","referral"]},"startsAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"revokedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}},"PlatformAccountDetail":{"type":"object","required":["id","tenantId","email","name","disabledAt","createdAt","emailVerified","basePlan","subscription","grants"],"additionalProperties":false,"properties":{"id":{"type":"string","format":"uuid"},"tenantId":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email","maxLength":254},"name":{"type":"string","minLength":1,"maxLength":200},"disabledAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"emailVerified":{"type":"boolean"},"basePlan":{"enum":["hobby","starter","builder","scale"]},"subscription":{"anyOf":[{"$ref":"#/components/schemas/Subscription"},{"type":"null"}]},"grants":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/Entitlement"}}}},"EntitlementGrantInput":{"type":"object","required":["operationId","plan","startsAt","expiresAt","reason"],"additionalProperties":false,"properties":{"operationId":{"type":"string","format":"uuid","description":"Caller-generated replay identity."},"plan":{"enum":["starter","builder","scale"]},"startsAt":{"type":"string","format":"date-time","description":"Must be at or after 1970-01-01."},"expiresAt":{"type":"string","format":"date-time","description":"Must be after startsAt and no more than five years later."},"reason":{"type":"string","minLength":1,"maxLength":500,"pattern":".*\\S.*","description":"Trimmed audit reason."}}},"EntitlementGrantResult":{"type":"object","required":["grantId"],"additionalProperties":false,"properties":{"grantId":{"type":"string","format":"uuid"}}},"AuditItem":{"type":"object","required":["id","actorAccountId","targetAccountId","action","reason","details","createdAt"],"additionalProperties":false,"properties":{"id":{"type":"string","format":"uuid"},"actorAccountId":{"type":"string","format":"uuid"},"targetAccountId":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}]},"action":{"enum":["administrator_granted","administrator_revoked","account_disabled","account_enabled","entitlement_granted","entitlement_revoked"]},"reason":{"type":"string","minLength":1,"maxLength":500},"details":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"}}},"AuditCursor":{"type":"object","required":["createdAt","id"],"additionalProperties":false,"properties":{"createdAt":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"}}},"PlatformAuditPage":{"type":"object","required":["items","nextCursor"],"additionalProperties":false,"properties":{"items":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/AuditItem"}},"nextCursor":{"anyOf":[{"$ref":"#/components/schemas/AuditCursor"},{"type":"null"}]}}},"PlatformAnalyticsTotals":{"type":"object","required":["accounts","activeAccounts","projects","memories","apiKeys"],"additionalProperties":false,"properties":{"accounts":{"type":"integer","minimum":0},"activeAccounts":{"type":"integer","minimum":0},"projects":{"type":"integer","minimum":0},"memories":{"type":"integer","minimum":0},"apiKeys":{"type":"integer","minimum":0}}},"PlatformAnalyticsDay":{"type":"object","required":["date","accounts","projects","memories"],"additionalProperties":false,"properties":{"date":{"type":"string","format":"date","description":"UTC calendar date."},"accounts":{"type":"integer","minimum":0},"projects":{"type":"integer","minimum":0},"memories":{"type":"integer","minimum":0}}},"PlatformAnalytics":{"type":"object","required":["range","generatedAt","totals","daily"],"additionalProperties":false,"properties":{"range":{"enum":["7d","30d","90d"]},"generatedAt":{"type":"string","format":"date-time"},"totals":{"$ref":"#/components/schemas/PlatformAnalyticsTotals"},"daily":{"type":"array","minItems":7,"maxItems":90,"items":{"$ref":"#/components/schemas/PlatformAnalyticsDay"}}}}}}}