{"openapi":"3.1.0","info":{"title":"connect0 control-plane API","version":"1.0.0","description":"The connect0 public REST API. Authenticate with an OAuth 2.1 bearer token (see https://connect0.ai/auth.md).\n\nVersioning: the surface is URL-versioned under /v1. Breaking changes ship under a new version prefix; deprecated operations are announced in the change log and marked `deprecated` in this document before removal.\n\nRate limits: /v1 responses carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers; a 429 additionally carries Retry-After. Clients should self-throttle from these headers.\n\nErrors: every 4xx/5xx returns the JSON ErrorResponse envelope — never HTML."},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"AdminAgentAuditNode":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"occurredAt":{"type":"string"},"parentAuditId":{"type":["string","null"]},"summary":{"type":"object","properties":{"toolName":{"type":["string","null"]},"source":{"type":["string","null"]},"outcome":{"type":["string","null"]},"errorCode":{"type":["string","null"]},"durationMs":{"type":["number","null"]},"modelSlug":{"type":["string","null"]},"status":{"type":["string","null"]},"action":{"type":["string","null"]}},"required":["toolName","source","outcome","errorCode","durationMs","modelSlug","status","action"]},"payload":{"anyOf":[{"type":"object","properties":{"revealed":{"type":"boolean","enum":[true]},"value":{}},"required":["revealed"]},{"type":"object","properties":{"revealed":{"type":"boolean","enum":[false]},"chars":{"type":"number"}},"required":["revealed","chars"]}]},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]},"children":{"type":"array","description":"Child audit rows (`parent_audit_id` = this node), same shape, recursively.","items":{"$ref":"#/components/schemas/AdminAgentAuditNode"}}},"required":["id","kind","occurredAt","parentAuditId","summary","payload","failureKind","children"]},"UsageForecast":{"type":"object","properties":{"period":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"},"days_elapsed":{"type":"number"},"days_remaining":{"type":"number"},"today":{"type":"string"}},"required":["start","end","days_elapsed","days_remaining","today"]},"current":{"type":"object","properties":{"total_credits":{"type":"number"},"pending_burn_credits":{"type":"number"},"storage_debt_credits":{"type":"number"},"by_product":{"type":"array","items":{"type":"object","properties":{"product":{"type":"string"},"label":{"type":"string"},"block":{"type":["string","null"]},"mtd_credits":{"type":"number"},"quantity":{"type":"number"},"daily_rate_credits":{"type":"number"},"projected_credits":{"type":"number"},"kind":{"type":"string","enum":["usage","storage"]}},"required":["product","label","block","mtd_credits","quantity","daily_rate_credits","projected_credits","kind"]}}},"required":["total_credits","pending_burn_credits","storage_debt_credits","by_product"]},"committed":{"type":"object","properties":{"storage_credits_to_period_end":{"type":"number"},"reservations_credits":{"type":"number"},"plan_renewal_credits":{"type":["number","null"]},"total_credits":{"type":"number"}},"required":["storage_credits_to_period_end","reservations_credits","plan_renewal_credits","total_credits"]},"projected":{"type":"object","properties":{"method":{"type":"string","enum":["trailing7d"]},"daily_rate_credits":{"type":"number"},"period_end_total_credits":{"type":"number"},"low_credits":{"type":"number"},"high_credits":{"type":"number"}},"required":["method","daily_rate_credits","period_end_total_credits","low_credits","high_credits"]},"runway":{"type":"object","properties":{"balance_credits":{"type":"number"},"daily_rate_credits":{"type":"number"},"days_to_zero":{"type":["number","null"]},"zero_at":{"type":["string","null"]},"days_to_hard_stop":{"type":["number","null"]},"hard_stop_at":{"type":["string","null"]}},"required":["balance_credits","daily_rate_credits","days_to_zero","zero_at","days_to_hard_stop","hard_stop_at"]},"upcoming":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["grant_expiry","reservation_renewal","plan_renewal","balance_zero","hard_stop"]},"at":{"type":"string"},"label":{"type":"string"},"credits":{"type":["number","null"]}},"required":["kind","at","label","credits"]}},"series":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"actual_credits":{"type":["number","null"]},"projected_credits":{"type":["number","null"]},"low_credits":{"type":["number","null"]},"high_credits":{"type":["number","null"]}},"required":["day","actual_credits","projected_credits","low_credits","high_credits"]}}},"required":["period","current","committed","projected","runway","upcoming","series"]},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","description":"Machine-readable error code, e.g. 'not_found', 'invalid_input', 'rate_limited'."},"message":{"type":"string","description":"Human-readable explanation of what went wrong."},"request_id":{"type":"string","description":"Correlation id — include it when reporting an issue."},"issues":{"type":"array","items":{},"description":"Zod validation issues, present when code is 'invalid_input'."}}}}}},"parameters":{}},"paths":{"/health":{"get":{"tags":["Health"],"summary":"Liveness + DB ping.","responses":{"200":{"description":"healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["healthy","unhealthy"]},"database":{"type":"string","enum":["ok","fail"]}},"required":["status","database"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"unhealthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["healthy","unhealthy"]},"database":{"type":"string","enum":["ok","fail"]}},"required":["status","database"]}}}}},"operationId":"getHealth","description":"Liveness + DB ping."}},"/v1/me":{"get":{"tags":["Me"],"summary":"Resolve the caller; enrich with Identity Platform profile (email + displayName + photoURL).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"ip_local_id":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"email":{"type":["string","null"]},"display_name":{"type":["string","null"]},"photo_url":{"type":["string","null"]}},"required":["ip_local_id","scopes","email","display_name","photo_url"]}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1Me","description":"Resolve the caller; enrich with Identity Platform profile (email + displayName + photoURL)."}},"/v1/accounts":{"get":{"tags":["Accounts"],"summary":"List accounts the caller is a member of.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"settings":{"type":"object","additionalProperties":{}},"logo_url":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","slug","name","settings","created_at","updated_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1Accounts","description":"List accounts the caller is a member of."},"post":{"tags":["Accounts"],"summary":"Create an account; caller becomes the owner.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":3,"maxLength":30},"settings":{"type":"object","additionalProperties":{},"default":{}},"inviteCode":{"type":"string","minLength":1,"maxLength":64},"ipHash":{"type":"string","maxLength":128},"userAgent":{"type":"string","maxLength":512}},"required":["slug","name"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"settings":{"type":"object","additionalProperties":{}},"logo_url":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","slug","name","settings","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1Accounts","description":"Create an account; caller becomes the owner."}},"/v1/accounts/{slug}":{"get":{"tags":["Accounts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"settings":{"type":"object","additionalProperties":{}},"logo_url":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","slug","name","settings","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsBySlug"},"patch":{"tags":["Accounts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":3,"maxLength":30},"settings":{"type":"object","additionalProperties":{},"default":{}},"logo_url":{"anyOf":[{"type":"string","maxLength":2000,"format":"uri"},{"type":"string","maxLength":2000,"pattern":"^\\/brand\\/[A-Za-z0-9._/-]+\\.(png|jpe?g|webp|svg)$"},{"type":"null"}]}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":3,"maxLength":30,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"settings":{"type":"object","additionalProperties":{}},"logo_url":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","slug","name","settings","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AccountsBySlug"},"delete":{"tags":["Accounts"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"204":{"description":"soft-deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsBySlug"}},"/v1/accounts/{slug}/billing/checkout/pack":{"post":{"tags":["Billing"],"summary":"Start a Stripe Checkout for a one-time credit pack (spec 78 §11.1).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"pack_id":{"type":"string","minLength":1}},"required":["pack_id"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsBySlugBillingCheckoutPack","description":"Start a Stripe Checkout for a one-time credit pack (spec 78 §11.1)."}},"/v1/accounts/{slug}/billing/checkout/custom":{"post":{"tags":["Billing"],"summary":"Start a Stripe Checkout for a custom one-time credit top-up (spec 116 §2.5).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount_usd_cents":{"type":"integer","exclusiveMinimum":0}},"required":["amount_usd_cents"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsBySlugBillingCheckoutCustom","description":"Start a Stripe Checkout for a custom one-time credit top-up (spec 116 §2.5)."}},"/v1/accounts/{slug}/billing/checkout/subscription":{"post":{"tags":["Billing"],"summary":"Start a subscription Checkout, or the billing portal for active subs (spec 12 §5.4).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string","minLength":1},"period":{"type":"string","enum":["month","year"]}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsBySlugBillingCheckoutSubscription","description":"Start a subscription Checkout, or the billing portal for active subs (spec 12 §5.4)."}},"/v1/accounts/{accountSlug}/projects":{"get":{"tags":["Projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"description":{"type":["string","null"]},"settings":{"type":"object","additionalProperties":{}},"is_default":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","slug","name","description","settings","is_default","created_at","updated_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugProjects"},"post":{"tags":["Projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":["string","null"],"maxLength":500},"settings":{"type":"object","additionalProperties":{},"default":{}}},"required":["slug","name"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"description":{"type":["string","null"]},"settings":{"type":"object","additionalProperties":{}},"is_default":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","slug","name","description","settings","is_default","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugProjects"}},"/v1/accounts/{accountSlug}/projects/{projectSlug}":{"get":{"tags":["Projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"description":{"type":["string","null"]},"settings":{"type":"object","additionalProperties":{}},"is_default":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","slug","name","description","settings","is_default","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugProjectsByProjectSlug"},"patch":{"tags":["Projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":["string","null"],"maxLength":500},"settings":{"type":"object","additionalProperties":{},"default":{}}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string"},"description":{"type":["string","null"]},"settings":{"type":"object","additionalProperties":{}},"is_default":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","account_id","slug","name","description","settings","is_default","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AccountsByAccountSlugProjectsByProjectSlug"},"delete":{"tags":["Projects"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"204":{"description":"soft-deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugProjectsByProjectSlug"}},"/v1/accounts/{accountSlug}/blocks":{"get":{"tags":["Blocks"],"summary":"List feature blocks with enablement state and effective unit prices","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"summary":{"type":"string"},"rest_base_path":{"type":"string"},"mcp_tool_prefix":{"type":"string"},"entitlement_feature":{"type":"string"},"entitlement":{"type":"string","enum":["wallet","plan"]},"suspended":{"type":"boolean"},"in_plan":{"type":"boolean"},"enabled":{"type":"boolean"},"enabled_at":{"type":["string","null"],"format":"date-time"},"disabled_at":{"type":["string","null"],"format":"date-time"},"prices":{"type":"array","items":{"type":"object","properties":{"product":{"type":"string","enum":["block_call","block_storage"]},"variant":{"type":["string","null"]},"unit":{"type":"string"},"rate_microusd":{"type":"integer","minimum":0},"included_quota":{"type":"integer","minimum":0}},"required":["product","variant","unit","rate_microusd","included_quota"]}},"version":{"type":["string","null"]},"description":{"type":["string","null"]},"docs_url":{"type":["string","null"]},"dashboard_path":{"type":["string","null"]},"enabled_by":{"type":["string","null"],"format":"uuid"},"plan_remedy":{"type":["string","null"]},"usage_30d":{"type":"object","properties":{"calls":{"type":"integer","minimum":0},"credits":{"type":"integer","minimum":0},"storage_bytes":{"type":"integer","minimum":0}},"required":["calls","credits","storage_bytes"]},"operations":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","pattern":"^[a-z][a-z0-9_]*$"},"weightClass":{"type":"string","enum":["light","heavy","batch"]},"mode":{"type":"string","enum":["read","write","commit"]}},"required":["name","weightClass","mode"]}}},"required":["name","summary","rest_base_path","mcp_tool_prefix","entitlement_feature","entitlement","suspended","in_plan","enabled","enabled_at","disabled_at","prices","version","description","docs_url","dashboard_path","enabled_by","plan_remedy","usage_30d","operations"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugBlocks","description":"List feature blocks with enablement state and effective unit prices"}},"/v1/accounts/{accountSlug}/blocks/{blockName}/enable":{"post":{"tags":["Blocks"],"summary":"Enable a feature block for the account (owner/admin; plan-gated)","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"blockName","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500,"description":"Optional reason, recorded on the audit event."}}}}}},"responses":{"200":{"description":"enabled","content":{"application/json":{"schema":{"type":"object","properties":{"block_name":{"type":"string"},"account_id":{"type":"string","format":"uuid"},"enabled":{"type":"boolean"},"enabled_at":{"type":["string","null"],"format":"date-time"},"enabled_by":{"type":["string","null"],"format":"uuid"},"disabled_at":{"type":["string","null"],"format":"date-time"},"data_retained":{"type":"boolean","enum":[true]}},"required":["block_name","account_id","enabled","enabled_at","enabled_by","disabled_at","data_retained"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugBlocksByBlockNameEnable","description":"Enable a feature block for the account (owner/admin; plan-gated)"}},"/v1/accounts/{accountSlug}/blocks/{blockName}/disable":{"post":{"tags":["Blocks"],"summary":"Disable a feature block (owner/admin). Data is retained; re-enable restores access unchanged.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"blockName","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500,"description":"Optional reason, recorded on the audit event."}}}}}},"responses":{"200":{"description":"disabled — data retained","content":{"application/json":{"schema":{"type":"object","properties":{"block_name":{"type":"string"},"account_id":{"type":"string","format":"uuid"},"enabled":{"type":"boolean"},"enabled_at":{"type":["string","null"],"format":"date-time"},"enabled_by":{"type":["string","null"],"format":"uuid"},"disabled_at":{"type":["string","null"],"format":"date-time"},"data_retained":{"type":"boolean","enum":[true]},"message":{"type":"string"}},"required":["block_name","account_id","enabled","enabled_at","enabled_by","disabled_at","data_retained","message"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugBlocksByBlockNameDisable","description":"Disable a feature block (owner/admin). Data is retained; re-enable restores access unchanged."}},"/v1/accounts/{accountSlug}/ledger/entities":{"post":{"tags":["Blocks: Ledger"],"summary":"Spin up an entity (books, chart, periods, opening balances) in one call","description":"Creates the entity, its leading book, the chart of accounts from the named template (with semantic roles attached), the fiscal-year period calendar, and — when opening balances are given — a balanced opening journal. Requires an Idempotency-Key header.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"legalName":{"type":"string","minLength":1,"maxLength":500},"jurisdiction":{"type":"string","minLength":1,"maxLength":50},"functionalCurrency":{"type":"string","minLength":1},"fiscalYearEnd":{"type":"string","pattern":"^\\d{2}-\\d{2}$"},"framework":{"type":"string","minLength":1,"maxLength":50},"chartTemplate":{"type":"string","minLength":1},"openingBalances":{"type":"array","items":{"type":"object","properties":{"accountCode":{"type":"string","minLength":1},"amount":{"type":"string","minLength":1},"unit":{"type":"string","minLength":1}},"required":["accountCode","amount"]}},"effectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"test":{"type":"boolean"}},"required":["legalName","functionalCurrency","fiscalYearEnd","framework","chartTemplate"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The entity summary: books, periods, accounts (with roles), dimensions, opening transaction id."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerEntities"},"get":{"tags":["Blocks: Ledger"],"summary":"List entities of the tenant, searchable by legal name (resolve-before-act); cursor-paginated","description":"Find an entity id structurally (q= is a case-insensitive legal-name substring) before acting on it. Ordered by creation time.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Case-insensitive legal-name substring search."},"required":false,"description":"Case-insensitive legal-name substring search.","name":"q","in":"query"},{"schema":{"type":"string","enum":["true","false"],"description":"Include practice-space (is_test) entities; default true."},"required":false,"description":"Include practice-space (is_test) entities; default true.","name":"include_test","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Entity: id, legal_name, jurisdiction, framework, fiscal_year_end, is_test, created_at."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerEntities"}},"/v1/accounts/{accountSlug}/ledger/events":{"post":{"tags":["Blocks: Ledger"],"summary":"Post a business event (the default, template-expanded write path)","description":"The recommended write path for agents: submit a business event (type + payload) and the tenant's posting template expands it into a balanced journal — you never name an account. Set dryRun:true (or ?dry_run=true) to get the exact journal, balance deltas and a confirmation_token without committing. The server-side auto-post policy decides whether a commit posts (outcome:\"posted\") or parks the entry as a proposal for review (outcome:\"proposed\"). Commit calls require an Idempotency-Key header.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"When \"true\", validate and return the exact result without committing any write."},"required":false,"description":"When \"true\", validate and return the exact result without committing any write.","name":"dry_run","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entityId":{"type":"string","format":"uuid"},"bookId":{"type":"string","format":"uuid"},"type":{"type":"string","minLength":1},"payload":{"type":"object","properties":{"amount":{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"},"unit":{"type":"string","minLength":1},"quantities":{"type":"object","additionalProperties":{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}},"dimensions":{"type":"object","additionalProperties":{"type":"string"}},"refs":{"type":"object","additionalProperties":{"type":"string"}}}},"occurredAt":{"type":"string","format":"date-time"},"effectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"templateVersion":{"type":"integer","minimum":1},"description":{"type":"string","maxLength":2000},"externalRef":{"type":"string","maxLength":500},"provenance":{"type":"object","properties":{"onBehalfOf":{"type":"string","minLength":1},"modelId":{"type":"string","minLength":1},"modelVersion":{"type":"string","minLength":1},"toolCallId":{"type":"string","minLength":1},"evidence":{"type":"array","items":{"type":"object","properties":{"uri":{"type":"string","minLength":1},"hash":{"type":"string","minLength":1}},"required":["uri","hash"]}},"rule":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"approvedBy":{"type":"string","minLength":1}},"description":"Provenance audit fields (model, tool call, evidence, rule, confidence). The actor is always your authenticated identity; actorType/actorId in the body are ignored."},"dryRun":{"type":"boolean"},"confirmationToken":{"type":"string"}},"required":["entityId","bookId","type","payload","occurredAt","effectiveDate"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Commit: {kind:\"posted\", outcome:\"posted\", transaction} or {kind:\"proposed\", outcome:\"proposed\", proposal}; dry-run: {kind:\"dry_run\", dry_run}."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerEvents"}},"/v1/accounts/{accountSlug}/ledger/posting-templates":{"get":{"tags":["Blocks: Ledger"],"summary":"List posting templates (latest version per code)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Template list item: code, latest_version, name, versions."}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerPostingTemplates","description":"List posting templates (latest version per code)"},"post":{"tags":["Blocks: Ledger"],"summary":"Create a posting template version (immutable; new version = new row)","description":"Template versions are immutable and deterministic; an event posting records the version that expanded it so /explain can answer \"which rule produced this entry\". Requires an Idempotency-Key header.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":500},"definition":{},"createdBy":{"type":"string","minLength":1,"maxLength":500}},"required":["name"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The created template version (code, version, definition)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerPostingTemplates"}},"/v1/accounts/{accountSlug}/ledger/posting-templates/{code}":{"get":{"tags":["Blocks: Ledger"],"summary":"Get a posting template (latest version, or ?version=N)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"The template code — it IS the business-event type it expands."},"required":true,"description":"The template code — it IS the business-event type it expands.","name":"code","in":"path"},{"schema":{"type":"integer","minimum":1},"required":false,"name":"version","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The template version plus its version history."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerPostingTemplatesByCode","description":"Get a posting template (latest version, or ?version=N)"}},"/v1/accounts/{accountSlug}/ledger/posting-templates/{code}/versions":{"get":{"tags":["Blocks: Ledger"],"summary":"List the versions of a posting template","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"The template code — it IS the business-event type it expands."},"required":true,"description":"The template code — it IS the business-event type it expands.","name":"code","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Version row: version, name, created_by, created_at."}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerPostingTemplatesByCodeVersions","description":"List the versions of a posting template"}},"/v1/accounts/{accountSlug}/ledger/posting-templates/{code}/test":{"post":{"tags":["Blocks: Ledger"],"summary":"Expand a sample event against a template version (the author's dry-run; no writes)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"The template code — it IS the business-event type it expands."},"required":true,"description":"The template code — it IS the business-event type it expands.","name":"code","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer","minimum":1,"description":"Pin a version; latest when omitted."},"event":{"type":"object","properties":{"type":{"type":"string","pattern":"^[a-z][a-z0-9_]*$"},"amount":{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"},"unit":{"type":"string","minLength":1},"quantities":{"type":"object","additionalProperties":{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$"}},"dimensions":{"type":"object","additionalProperties":{"type":"string"}},"refs":{"type":"object","additionalProperties":{"type":"string"}}},"required":["type"],"description":"The sample business event to expand."}},"required":["event"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The expanded journal for the sample event (template_code, template_version, journal)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerPostingTemplatesByCodeTest","description":"Expand a sample event against a template version (the author's dry-run; no writes)"}},"/v1/accounts/{accountSlug}/ledger/transactions":{"post":{"tags":["Blocks: Ledger"],"summary":"Post a raw transaction (escape hatch; policy may park it as a proposal)","description":"Explicit postings for adjustments and migrations — the event API is the recommended path. The server-side auto-post policy decides per (role, amount, actor type, confidence) whether the entry posts or becomes a pending proposal. Provenance is mandatory. Dry-run first: dryRun:true returns the exact journal and a confirmation_token; commit with that token. Commit calls require an Idempotency-Key header.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"When \"true\", validate and return the exact result without committing any write."},"required":false,"description":"When \"true\", validate and return the exact result without committing any write.","name":"dry_run","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entityId":{"type":"string","format":"uuid"},"bookId":{"type":"string","format":"uuid"},"transactionType":{"type":"string","minLength":1},"occurredAt":{"type":"string","format":"date-time"},"effectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"description":{"type":"string","maxLength":2000},"externalRef":{"type":"string","maxLength":500},"reverses":{"type":"string","format":"uuid"},"corrects":{"type":"string","format":"uuid"},"postings":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string","format":"uuid"},"bookId":{"type":"string","format":"uuid"},"unit":{"type":"string","minLength":1},"quantity":{"type":"string"},"functionalAmount":{"type":"string"},"rate":{"type":"string"},"rateType":{"type":"string","enum":["spot","daily","average","closing","historical"]},"rateSource":{"type":"string"},"dimensions":{"type":"object","additionalProperties":{"type":"string"}},"memo":{"type":"string"}},"required":["accountId","unit"]},"minItems":1},"provenance":{"type":"object","properties":{"onBehalfOf":{"type":"string","minLength":1},"modelId":{"type":"string","minLength":1},"modelVersion":{"type":"string","minLength":1},"toolCallId":{"type":"string","minLength":1},"evidence":{"type":"array","items":{"type":"object","properties":{"uri":{"type":"string","minLength":1},"hash":{"type":"string","minLength":1}},"required":["uri","hash"]}},"rule":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"approvedBy":{"type":"string","minLength":1}},"description":"Provenance audit fields (model, tool call, evidence, rule, confidence). The actor is always your authenticated identity; actorType/actorId in the body are ignored."},"confirmationToken":{"type":"string"},"dryRun":{"type":"boolean","description":"Dry-run mode: return the exact journal + confirmation_token without committing."}},"required":["entityId","bookId","occurredAt","effectiveDate","postings"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Dry-run: journal + balances + validations + confirmation_token. Commit: {outcome:\"posted\", transaction} or {outcome:\"proposed\", proposal}."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerTransactions"},"get":{"tags":["Blocks: Ledger"],"summary":"List/search transactions (cursor-paginated)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Filter by book."},"required":false,"description":"Filter by book.","name":"book_id","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Filter by account (any posting leg)."},"required":false,"description":"Filter by account (any posting leg).","name":"account_id","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Filter by period."},"required":false,"description":"Filter by period.","name":"period_id","in":"query"},{"schema":{"type":"string","description":"Filter by transaction class (standard, write_off, …)."},"required":false,"description":"Filter by transaction class (standard, write_off, …).","name":"transaction_type","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Transaction list item."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerTransactions","description":"List/search transactions (cursor-paginated)"}},"/v1/accounts/{accountSlug}/ledger/transactions/{id}":{"get":{"tags":["Blocks: Ledger"],"summary":"Get one transaction with its postings","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The transaction id."},"required":true,"description":"The transaction id.","name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The transaction header plus its posting legs."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerTransactionsById","description":"Get one transaction with its postings"}},"/v1/accounts/{accountSlug}/ledger/transactions/{id}/provenance":{"get":{"tags":["Blocks: Ledger"],"summary":"Get the provenance record of a transaction (who/what authored it)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The transaction id."},"required":true,"description":"The transaction id.","name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Provenance: actor type/id, model, tool call, evidence, rule, confidence, approver."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerTransactionsByIdProvenance","description":"Get the provenance record of a transaction (who/what authored it)"}},"/v1/accounts/{accountSlug}/ledger/transactions/{id}/reversals":{"get":{"tags":["Blocks: Ledger"],"summary":"List the transactions that reverse or correct this one","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The transaction id."},"required":true,"description":"The transaction id.","name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Reversing/correcting transaction header."}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerTransactionsByIdReversals","description":"List the transactions that reverse or correct this one"}},"/v1/accounts/{accountSlug}/ledger/transactions/{id}/reverse":{"post":{"tags":["Blocks: Ledger"],"summary":"Reverse a transaction (corrections are reversal + re-post, never mutation)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The transaction id."},"required":true,"description":"The transaction id.","name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"effectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Accounting date of the reversal — must fall in an open period."},"occurredAt":{"type":"string","format":"date-time"},"description":{"type":"string","maxLength":2000},"provenance":{"type":"object","properties":{"onBehalfOf":{"type":"string","minLength":1},"modelId":{"type":"string","minLength":1},"modelVersion":{"type":"string","minLength":1},"toolCallId":{"type":"string","minLength":1},"evidence":{"type":"array","items":{"type":"object","properties":{"uri":{"type":"string","minLength":1},"hash":{"type":"string","minLength":1}},"required":["uri","hash"]}},"rule":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"approvedBy":{"type":"string","minLength":1}},"description":"Provenance audit fields (model, tool call, evidence, rule, confidence). The actor is always your authenticated identity; actorType/actorId in the body are ignored."}},"required":["effectiveDate"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The reversal transaction, linked to the original via reverses_transaction_id."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerTransactionsByIdReverse","description":"Reverse a transaction (corrections are reversal + re-post, never mutation)"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/trial-balance":{"get":{"tags":["Blocks: Ledger"],"summary":"Trial balance (materialised for closed periods, computed for open reads)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The book id."},"required":true,"description":"The book id.","name":"bookId","in":"path"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Compute as-of this date over open periods (defaults to today)."},"required":false,"description":"Compute as-of this date over open periods (defaults to today).","name":"as_of","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Read the materialised close of this period (must be closed)."},"required":false,"description":"Read the materialised close of this period (must be closed).","name":"period","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Trial balance lines with roles; functional_total is 0 when it ties."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdTrialBalance","description":"Trial balance (materialised for closed periods, computed for open reads)"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/balances/{accountId}":{"get":{"tags":["Blocks: Ledger"],"summary":"Account balance as-of a date, per unit, with optional dimension filter","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The book id."},"required":true,"description":"The book id.","name":"bookId","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The account id."},"required":true,"description":"The account id.","name":"accountId","in":"path"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"as_of","in":"query"},{"schema":{"type":"string","description":"Filter to one unit code."},"required":false,"description":"Filter to one unit code.","name":"unit","in":"query"},{"schema":{"type":"string","description":"JSON object {dimensionId: dimensionValueId} — containment filter on posting dimensions."},"required":false,"description":"JSON object {dimensionId: dimensionValueId} — containment filter on posting dimensions.","name":"dimensions","in":"query"},{"schema":{"type":"string","format":"date-time","description":"\"As known on\": only postings recorded at or before this instant."},"required":false,"description":"\"As known on\": only postings recorded at or before this instant.","name":"recorded_at_max","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Per-unit balances (quantity + functional amount) for the account."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdBalancesByAccountId","description":"Account balance as-of a date, per unit, with optional dimension filter"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/balances/{accountId}/explain":{"get":{"tags":["Blocks: Ledger"],"summary":"Explain a balance: the postings, rules and FX effects composing the number","description":"The agent's grounding mechanism and the auditor's evidence trail: any figure decomposes into contributing entries, template expansions, reversal links and FX translation sections.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The book id."},"required":true,"description":"The book id.","name":"bookId","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The account id."},"required":true,"description":"The account id.","name":"accountId","in":"path"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"as_of","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Contributions, rules fired, and contributor sections (FX translation, …)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdBalancesByAccountIdExplain"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/reports/{report}":{"get":{"tags":["Blocks: Ledger"],"summary":"Run a role-keyed report (P&L, balance sheet, cash-flow summary, aged AR/AP)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The book id."},"required":true,"description":"The book id.","name":"bookId","in":"path"},{"schema":{"type":"string","enum":["profit-and-loss","balance-sheet","cash-flow","aged-receivables","aged-payables"],"description":"The role-keyed report to run."},"required":true,"description":"The role-keyed report to run.","name":"report","in":"path"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Report date (defaults to today)."},"required":false,"description":"Report date (defaults to today).","name":"as_of","in":"query"},{"schema":{"type":"string","format":"uuid","description":"P&L/BS: read the materialised close of this period."},"required":false,"description":"P&L/BS: read the materialised close of this period.","name":"period","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The report, grouped by §5.4 semantic role."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdReportsByReport","description":"Run a role-keyed report (P&L, balance sheet, cash-flow summary, aged AR/AP)"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/periods":{"get":{"tags":["Blocks: Ledger"],"summary":"List a book's period calendar (cursor-paginated, ordered by starts_on)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Period: id, code, starts_on, ends_on, status."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdPeriods","description":"List a book's period calendar (cursor-paginated, ordered by starts_on)"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/periods/{periodId}/close":{"post":{"tags":["Blocks: Ledger"],"summary":"Close a period (one-way; materialises balances; blockers apply)","description":"Close is one-way: periods never reopen — corrections land in the open period via reversal + re-post or as a single-book adjustment. Uncertified reconciliations above materiality block the close. Dry-run mode (dryRun:true / ?dry_run=true) computes the full close result and rolls it back. Commit calls require an Idempotency-Key header.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"periodId","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"When \"true\", validate and return the exact result without committing any write."},"required":false,"description":"When \"true\", validate and return the exact result without committing any write.","name":"dry_run","in":"query"},{"schema":{"type":"string","description":"Required except in dry-run mode (?dry_run=true / dryRun:true), which performs no write."},"required":false,"description":"Required except in dry-run mode (?dry_run=true / dryRun:true), which performs no write.","name":"idempotency-key","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"dryRun":{"type":"boolean","description":"Compute the close, persist nothing."}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The close result: period, closed_at, materialised closing balances."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerBooksByBookIdPeriodsByPeriodIdClose"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/revaluation-runs":{"post":{"tags":["Blocks: Ledger"],"summary":"Run period-end FX revaluation of monetary balances (generated, reversible transaction)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookId","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"When \"true\", validate and return the exact result without committing any write."},"required":false,"description":"When \"true\", validate and return the exact result without committing any write.","name":"dry_run","in":"query"},{"schema":{"type":"string","description":"Required except in dry-run mode (?dry_run=true / dryRun:true), which performs no write."},"required":false,"description":"Required except in dry-run mode (?dry_run=true / dryRun:true), which performs no write.","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"periodId":{"type":"string","format":"uuid","description":"The period the revaluation belongs to."},"asOf":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Revaluation date (closing rates as of this date)."},"dryRun":{"type":"boolean","description":"Compute the run, persist nothing."}},"required":["periodId","asOf"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The revaluation run: per-account unrealized amounts + the generated transaction id."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerBooksByBookIdRevaluationRuns","description":"Run period-end FX revaluation of monetary balances (generated, reversible transaction)"}},"/v1/accounts/{accountSlug}/ledger/proposals":{"get":{"tags":["Blocks: Ledger"],"summary":"List proposals (an approver subscribes to proposal.pending feed records rather than polling)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"},{"schema":{"type":"string","enum":["draft","proposed","pending","approved","posted","rejected"],"description":"Filter by proposal state. status=proposed is the pending approval queue; \"pending\" is accepted as an alias."},"required":false,"description":"Filter by proposal state. status=proposed is the pending approval queue; \"pending\" is accepted as an alias.","name":"status","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"entity_id","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Proposal list item."}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerProposals","description":"List proposals (an approver subscribes to proposal.pending feed records rather than polling)"}},"/v1/accounts/{accountSlug}/ledger/proposals/{id}":{"get":{"tags":["Blocks: Ledger"],"summary":"Get a proposal (same shape as a transaction, plus the policy evaluation that parked it)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The proposal id."},"required":true,"description":"The proposal id.","name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The proposal: payload, resolved journal, policy evaluation, state."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerProposalsById","description":"Get a proposal (same shape as a transaction, plus the policy evaluation that parked it)"}},"/v1/accounts/{accountSlug}/ledger/proposals/{id}/approve":{"post":{"tags":["Blocks: Ledger"],"summary":"Approve and post a proposal (SoD-checked: the proposer cannot approve)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The proposal id."},"required":true,"description":"The proposal id.","name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","maxLength":2000}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The approved proposal and the posted transaction."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerProposalsByIdApprove","description":"Approve and post a proposal (SoD-checked: the proposer cannot approve)"}},"/v1/accounts/{accountSlug}/ledger/proposals/{id}/reject":{"post":{"tags":["Blocks: Ledger"],"summary":"Reject a proposal (with a reason)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The proposal id."},"required":true,"description":"The proposal id.","name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":2000}},"required":["reason"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The rejected proposal."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerProposalsByIdReject","description":"Reject a proposal (with a reason)"}},"/v1/accounts/{accountSlug}/ledger/open-items":{"post":{"tags":["Blocks: Ledger"],"summary":"Create an open item (aging cannot be derived from postings)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"bookId":{"type":"string","format":"uuid"},"accountId":{"type":"string","format":"uuid"},"counterparty":{"type":"string","minLength":1,"maxLength":500},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"amount":{"type":"string","minLength":1},"unit":{"type":"string","minLength":1},"sourceDocument":{"type":"string","maxLength":500},"sourcePostingId":{"type":"string","format":"uuid"},"sourcePostingEffectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["bookId","accountId","counterparty","amount","unit"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The open item with settled/remaining amounts."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerOpenItems","description":"Create an open item (aging cannot be derived from postings)"},"get":{"tags":["Blocks: Ledger"],"summary":"List open items (cursor-paginated)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"book_id","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"account_id","in":"query"},{"schema":{"type":"string"},"required":false,"name":"counterparty","in":"query"},{"schema":{"type":"string","enum":["open","closed"]},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Open item."}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerOpenItems","description":"List open items (cursor-paginated)"}},"/v1/accounts/{accountSlug}/ledger/open-items/{id}":{"get":{"tags":["Blocks: Ledger"],"summary":"Get one open item","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The open item."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerOpenItemsById","description":"Get one open item"}},"/v1/accounts/{accountSlug}/ledger/settlements":{"post":{"tags":["Blocks: Ledger"],"summary":"Apply a payment to open items (partial, many-to-many; over-payment becomes a credit)","description":"Settling a foreign-currency monetary item automatically posts the realized FX gain/loss against the historical carrying from the source posting. Requires an Idempotency-Key header.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"paymentTransactionId":{"type":"string","format":"uuid"},"applications":{"type":"array","items":{"type":"object","properties":{"openItemId":{"type":"string","format":"uuid"},"amount":{"type":"string","minLength":1}},"required":["openItemId","amount"]},"minItems":1},"paymentAmount":{"type":"string","minLength":1},"credit":{"type":"object","properties":{"counterparty":{"type":"string","minLength":1,"maxLength":500},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"sourceDocument":{"type":"string","maxLength":500}}}},"required":["applications"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Settlements, updated open items, any auto-created credit, realized FX entries."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerSettlements"}},"/v1/accounts/{accountSlug}/ledger/open-items/{id}/write-off":{"post":{"tags":["Blocks: Ledger"],"summary":"Write off an open item (the named write_off transaction class)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expenseAccountId":{"type":"string","format":"uuid"},"effectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"occurredAt":{"type":"string","format":"date-time"},"description":{"type":"string","maxLength":2000},"provenance":{"type":"object","properties":{"actorType":{"type":"string","enum":["human","agent","system"]},"actorId":{"type":"string","minLength":1},"onBehalfOf":{"type":"string","minLength":1},"modelId":{"type":"string","minLength":1},"modelVersion":{"type":"string","minLength":1},"toolCallId":{"type":"string","minLength":1},"evidence":{"type":"array","items":{"type":"object","properties":{"uri":{"type":"string","minLength":1},"hash":{"type":"string","minLength":1}},"required":["uri","hash"]}},"rule":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"approvedBy":{"type":"string","minLength":1}},"required":["actorType","actorId"]}},"required":["expenseAccountId","effectiveDate","provenance"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The write_off transaction, the closing settlement, and the closed item."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerOpenItemsByIdWriteOff","description":"Write off an open item (the named write_off transaction class)"}},"/v1/accounts/{accountSlug}/ledger/open-items/net":{"post":{"tags":["Blocks: Ledger"],"summary":"Net an AR open item against an AP open item of the same counterparty","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"receivableOpenItemId":{"type":"string","format":"uuid"},"payableOpenItemId":{"type":"string","format":"uuid"},"effectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"occurredAt":{"type":"string","format":"date-time"},"description":{"type":"string","maxLength":2000},"amount":{"type":"string","minLength":1},"provenance":{"type":"object","properties":{"actorType":{"type":"string","enum":["human","agent","system"]},"actorId":{"type":"string","minLength":1},"onBehalfOf":{"type":"string","minLength":1},"modelId":{"type":"string","minLength":1},"modelVersion":{"type":"string","minLength":1},"toolCallId":{"type":"string","minLength":1},"evidence":{"type":"array","items":{"type":"object","properties":{"uri":{"type":"string","minLength":1},"hash":{"type":"string","minLength":1}},"required":["uri","hash"]}},"rule":{"type":"string","minLength":1},"confidence":{"type":"number","minimum":0,"maximum":1},"approvedBy":{"type":"string","minLength":1}},"required":["actorType","actorId"]}},"required":["receivableOpenItemId","payableOpenItemId","effectiveDate","provenance"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The netting transaction and both updated open items."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerOpenItemsNet","description":"Net an AR open item against an AP open item of the same counterparty"}},"/v1/accounts/{accountSlug}/ledger/reconciliations":{"post":{"tags":["Blocks: Ledger"],"summary":"Create a reconciliation (bank, ar, ap, intercompany, …)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"entityId":{"type":"string","format":"uuid"},"bookId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["bank","ar","ap","inventory","fixed_assets","prepaid","accrual","clearing","intercompany","custom"],"description":"The reconciliation type (§8.1)."},"glAccountId":{"type":"string","format":"uuid","description":"The GL control account being reconciled."},"periodId":{"type":"string","format":"uuid"},"unit":{"type":"string","minLength":1,"description":"Unit code; tenant-first, then platform-global."},"materiality":{"type":"string","minLength":1,"description":"Decimal string — certification/close materiality threshold."}},"required":["entityId","bookId","type","glAccountId"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The reconciliation object."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerReconciliations","description":"Create a reconciliation (bank, ar, ap, intercompany, …)"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}":{"get":{"tags":["Blocks: Ledger"],"summary":"Get a reconciliation with its items","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The reconciliation plus its statement lines and reconciling items."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerReconciliationsById","description":"Get a reconciliation with its items"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/candidates":{"get":{"tags":["Blocks: Ledger"],"summary":"List match candidates (scored, with the rule or score that proposed each); cursor-paginated","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Match candidate with confidence and rationale."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerReconciliationsByIdCandidates","description":"List match candidates (scored, with the rule or score that proposed each); cursor-paginated"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/matches":{"get":{"tags":["Blocks: Ledger"],"summary":"List durable matches (each records WHY it was proposed); cursor-paginated","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Match record."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerReconciliationsByIdMatches","description":"List durable matches (each records WHY it was proposed); cursor-paginated"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/matching-runs":{"post":{"tags":["Blocks: Ledger"],"summary":"Run the matching cascade (exact → 1:N → M:N → fuzzy → scored candidates)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The cascade result: matches made per layer + candidates queued."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerReconciliationsByIdMatchingRuns","description":"Run the matching cascade (exact → 1:N → M:N → fuzzy → scored candidates)"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/items":{"post":{"tags":["Blocks: Ledger"],"summary":"Add a reconciling item (explains part of the GL-vs-supporting gap)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"string","minLength":1,"description":"Signed decimal explaining part of the GL-vs-supporting gap."},"unit":{"type":"string","minLength":1},"description":{"type":"string","maxLength":2000},"itemDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"externalRef":{"type":"string","maxLength":500},"detail":{"type":"object","additionalProperties":{}}},"required":["amount","unit"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The reconciling item."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerReconciliationsByIdItems","description":"Add a reconciling item (explains part of the GL-vs-supporting gap)"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/transitions":{"post":{"tags":["Blocks: Ledger"],"summary":"Transition the reconciliation workflow (open→prepared→in_review→approved/certified→reopened)","description":"Every transition is immutable, HMAC-signed and attributed (§8.1).","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","enum":["prepared","in_review","approved","certified","reopened"]},"note":{"type":"string","maxLength":2000}},"required":["to"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The transition: updated reconciliation, signed payload, signature."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerReconciliationsByIdTransitions"}},"/v1/accounts/{accountSlug}/ledger/match-candidates/{id}/accept":{"post":{"tags":["Blocks: Ledger"],"summary":"Accept a scored match candidate into a durable match","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The durable match record."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerMatchCandidatesByIdAccept","description":"Accept a scored match candidate into a durable match"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/statements":{"post":{"tags":["Blocks: Ledger"],"summary":"Ingest a camt.053/052/054 document as statement lines (053 confirms provisional 054/052 lines)","description":"Re-ingesting a document is safe: entries already present under the same statement are skipped. A mixed-currency document is refused whole. Requires an Idempotency-Key header.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"xml":{"type":"string","minLength":1,"maxLength":20000000,"description":"The camt document (ISO 20022 XML) as a string."},"kind":{"type":"string","enum":["camt.053","camt.052","camt.054","053","052","054"],"description":"Expected document type: 053 (end-of-day statement, confirms), 052 (intraday) or 054 (notification; both pre-stage provisional lines). When given it is checked against the document itself."}},"required":["xml"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"{ doc_type, statement_id, inserted, confirmed, skipped }."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerReconciliationsByIdStatements"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/balances":{"post":{"tags":["Blocks: Ledger"],"summary":"Compute and persist the GL balance and the supporting balance of the reconciliation","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"asOf":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Balance date; defaults to the reconciliation's period end, else today."}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The reconciliation with gl_balance, supporting_balance and difference refreshed."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerReconciliationsByIdBalances","description":"Compute and persist the GL balance and the supporting balance of the reconciliation"}},"/v1/accounts/{accountSlug}/ledger/reconciliations/{id}/evidence":{"post":{"tags":["Blocks: Ledger"],"summary":"Attach evidence (uri + content hash) to the reconciliation","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"uri":{"type":"string","minLength":1,"maxLength":2000,"description":"Where the evidence document lives."},"hash":{"type":"string","minLength":1,"maxLength":200,"description":"Content hash of the evidence document (e.g. sha256 hex)."}},"required":["uri","hash"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The reconciliation with the attachment appended to evidence."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerReconciliationsByIdEvidence","description":"Attach evidence (uri + content hash) to the reconciliation"}},"/v1/accounts/{accountSlug}/ledger/matches/{id}/unmatch":{"post":{"tags":["Blocks: Ledger"],"summary":"Reverse a durable match (audit-preserving; the sides become matchable again)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The durable match id."},"required":true,"description":"The durable match id.","name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The reversed match record (reversed_at/reversed_by set)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerMatchesByIdUnmatch","description":"Reverse a durable match (audit-preserving; the sides become matchable again)"}},"/v1/accounts/{accountSlug}/ledger/entity-relationships":{"post":{"tags":["Blocks: Ledger"],"summary":"Create an effective-dated ownership/control relationship between entities","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"parentEntityId":{"type":"string","format":"uuid"},"childEntityId":{"type":"string","format":"uuid"},"ownershipPct":{"anyOf":[{"type":"string"},{"type":"number"}]},"controlClassification":{"type":"string","enum":["control","joint_control","significant_influence"]},"consolidationMethod":{"type":"string","enum":["full","equity","proportional"]},"validFrom":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"validTo":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["parentEntityId","childEntityId","ownershipPct","controlClassification","consolidationMethod","validFrom"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The relationship (ownership %, control classification, validity interval)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerEntityRelationships","description":"Create an effective-dated ownership/control relationship between entities"},"get":{"tags":["Blocks: Ledger"],"summary":"List entity relationships (cursor-paginated, ordered by valid_from)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Filter to relationships touching this entity."},"required":false,"description":"Filter to relationships touching this entity.","name":"entity_id","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Only relationships valid on this date."},"required":false,"description":"Only relationships valid on this date.","name":"as_of","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Relationship."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerEntityRelationships","description":"List entity relationships (cursor-paginated, ordered by valid_from)"}},"/v1/accounts/{accountSlug}/ledger/consolidation-groups":{"post":{"tags":["Blocks: Ledger"],"summary":"Create a consolidation group (its consolidation book is just another book)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":500},"parentEntityId":{"type":"string","format":"uuid"},"presentationCurrency":{"type":"string","minLength":1},"chartTemplate":{"type":"string","minLength":1,"default":"us-gaap/smb-v1"},"framework":{"type":"string","minLength":1,"default":"us-gaap"},"effectiveDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"fiscalYearEnd":{"type":"string","pattern":"^\\d{2}-\\d{2}$","default":"12-31"},"residualAccountCode":{"type":"string","minLength":1,"default":"4500"},"residualTolerance":{"type":"string","pattern":"^-?\\d+(\\.\\d+)?$","default":"0"}},"required":["name","parentEntityId","presentationCurrency"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The group: consolidation book, elimination entity, presentation unit."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerConsolidationGroups","description":"Create a consolidation group (its consolidation book is just another book)"},"get":{"tags":["Blocks: Ledger"],"summary":"List consolidation groups (cursor-paginated)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Group: id, name, parent_entity_id."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerConsolidationGroups","description":"List consolidation groups (cursor-paginated)"}},"/v1/accounts/{accountSlug}/ledger/consolidation-groups/{id}":{"get":{"tags":["Blocks: Ledger"],"summary":"Get a consolidation group","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The group record."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerConsolidationGroupsById","description":"Get a consolidation group"}},"/v1/accounts/{accountSlug}/ledger/consolidation-groups/{id}/elimination-rules":{"post":{"tags":["Blocks: Ledger"],"summary":"Create an elimination rule (stateful; carries forward across periods)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["intercompany_balance","unrealised_profit_inventory","fixed_asset_transfer","step_acquisition","dividend","custom"]},"name":{"type":"string","minLength":1,"maxLength":500},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["kind","name"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The elimination rule."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerConsolidationGroupsByIdEliminationRules","description":"Create an elimination rule (stateful; carries forward across periods)"},"get":{"tags":["Blocks: Ledger"],"summary":"List a group's elimination rules (cursor-paginated)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Elimination rule."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerConsolidationGroupsByIdEliminationRules","description":"List a group's elimination rules (cursor-paginated)"}},"/v1/accounts/{accountSlug}/ledger/consolidation-groups/{id}/runs":{"post":{"tags":["Blocks: Ledger"],"summary":"Run a consolidation for a period (aggregation, NCI, eliminations, carryforwards)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"When \"true\", validate and return the exact result without committing any write."},"required":false,"description":"When \"true\", validate and return the exact result without committing any write.","name":"dry_run","in":"query"},{"schema":{"type":"string","description":"Required except in dry-run mode (?dry_run=true / dryRun:true), which performs no write."},"required":false,"description":"Required except in dry-run mode (?dry_run=true / dryRun:true), which performs no write.","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"periodId":{"type":"string","format":"uuid","description":"The consolidation-book period to run for."},"dryRun":{"type":"boolean","description":"Compute the full run, persist nothing."}},"required":["periodId"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The run summary: member results, eliminations, residuals, carryforwards."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerConsolidationGroupsByIdRuns","description":"Run a consolidation for a period (aggregation, NCI, eliminations, carryforwards)"}},"/v1/accounts/{accountSlug}/ledger/entities/{entityId}/consolidation-runs/{runId}":{"get":{"tags":["Blocks: Ledger"],"summary":"Get a consolidation run of a parent entity (§9.3 read)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"entityId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The stored run row: status, timings, result payload."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerEntitiesByEntityIdConsolidationRunsByRunId","description":"Get a consolidation run of a parent entity (§9.3 read)"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/periods/{periodId}/exports/jet":{"get":{"tags":["Blocks: Ledger"],"summary":"JET extract — every journal entry of the period, tie-asserted to the trial balance","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"periodId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Entries + totals + the tie assertion against the trial balance."}}}},"413":{"description":"export_too_large — the period holds more journal lines than one export serialises.","content":{"application/json":{"schema":{"description":"{ error: { code, message, remedy, retryable } }"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdPeriodsByPeriodIdExportsJet","description":"JET extract — every journal entry of the period, tie-asserted to the trial balance"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/periods/{periodId}/exports/saf-t":{"get":{"tags":["Blocks: Ledger"],"summary":"SAF-T export (header, master files, GL entries) as an XML document","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"periodId","in":"path"},{"schema":{"type":"string","enum":["json","file"],"description":"file (default): the native document as an attachment. json: the JSON-wrapped form."},"required":false,"description":"file (default): the native document as an attachment. json: the JSON-wrapped form.","name":"format","in":"query"}],"responses":{"200":{"description":"The SAF-T AuditFile (attachment), or its JSON wrapper with ?format=json.","content":{"application/xml":{"schema":{"type":"string","description":"The serialized <AuditFile> document."}},"application/json":{"schema":{"description":"{ book_id, period_id, period_code, xml }."}}}},"413":{"description":"export_too_large — the period holds more journal lines than one export serialises.","content":{"application/json":{"schema":{"description":"{ error: { code, message, remedy, retryable } }"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdPeriodsByPeriodIdExportsSafT","description":"SAF-T export (header, master files, GL entries) as an XML document"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/periods/{periodId}/exports/fec":{"get":{"tags":["Blocks: Ledger"],"summary":"France FEC export — 18 mandatory columns in fixed order, as a text file","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookId","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"periodId","in":"path"},{"schema":{"type":"string","enum":["json","file"],"description":"file (default): the native document as an attachment. json: the JSON-wrapped form."},"required":false,"description":"file (default): the native document as an attachment. json: the JSON-wrapped form.","name":"format","in":"query"}],"responses":{"200":{"description":"The pipe-separated FEC file (attachment), or its JSON wrapper with ?format=json.","content":{"text/plain":{"schema":{"type":"string","description":"Pipe-separated, CRLF-terminated FEC content."}},"application/json":{"schema":{"description":"{ book_id, period_id, period_code, content, line_count }."}}}},"413":{"description":"export_too_large — the period holds more journal lines than one export serialises.","content":{"application/json":{"schema":{"description":"{ error: { code, message, remedy, retryable } }"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdPeriodsByPeriodIdExportsFec","description":"France FEC export — 18 mandatory columns in fixed order, as a text file"}},"/v1/accounts/{accountSlug}/ledger/feed/subscriptions":{"post":{"tags":["Blocks: Ledger"],"summary":"Create a feed subscription (its own cursor; a stalled consumer blocks nobody)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"transport":{"type":"object","additionalProperties":{},"description":"Optional webhook push config — a convenience over the pull feed, never the only path."}},"required":["name"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The subscription (id, name, cursor_seq, status)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerFeedSubscriptions","description":"Create a feed subscription (its own cursor; a stalled consumer blocks nobody)"},"get":{"tags":["Blocks: Ledger"],"summary":"List feed subscriptions (cursor-paginated)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Subscription."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerFeedSubscriptions","description":"List feed subscriptions (cursor-paginated)"}},"/v1/accounts/{accountSlug}/ledger/feed/subscriptions/{id}":{"delete":{"tags":["Blocks: Ledger"],"summary":"Delete a feed subscription (the outbox itself is never truncated)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The subscription id."},"required":true,"description":"The subscription id.","name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"responses":{"204":{"description":"deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugLedgerFeedSubscriptionsById","description":"Delete a feed subscription (the outbox itself is never truncated)"}},"/v1/accounts/{accountSlug}/ledger/feed/subscriptions/{id}/records":{"get":{"tags":["Blocks: Ledger"],"summary":"Read change records after the acknowledged cursor (replayable from any point)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The subscription id."},"required":true,"description":"The subscription id.","name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":1000},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","pattern":"^\\d+$","description":"Replay override: read after this cursor instead of the acknowledged position."},"required":false,"description":"Replay override: read after this cursor instead of the acknowledged position.","name":"from_cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"Change records + next_cursor (pass to ack after processing)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerFeedSubscriptionsByIdRecords","description":"Read change records after the acknowledged cursor (replayable from any point)"}},"/v1/accounts/{accountSlug}/ledger/feed/subscriptions/{id}/ack":{"post":{"tags":["Blocks: Ledger"],"summary":"Acknowledge a cursor (the ONLY thing that advances the subscription's position)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid","description":"The subscription id."},"required":true,"description":"The subscription id.","name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"cursor":{"type":"string","pattern":"^\\d+$","description":"The next_cursor from a read."}},"required":["cursor"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The subscription with its advanced cursor."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerFeedSubscriptionsByIdAck","description":"Acknowledge a cursor (the ONLY thing that advances the subscription's position)"}},"/v1/accounts/{accountSlug}/ledger/limits":{"get":{"tags":["Blocks: Ledger"],"summary":"Read the caller's remaining per-period value budget and bulk-size ceiling","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"actor_id":{"type":"string"},"period":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}},"required":["from","to"]},"period_value_cap":{"type":"string","description":"Max total posted functional value per actor per period."},"posted_value":{"type":"string"},"remaining_value_budget":{"type":"string","description":"Self-pace against this before posting more value."},"max_bulk_operation_size":{"type":"integer"},"request_rate_limits":{"type":"string","enum":["reported-by-transport"],"description":"See the RateLimit-* response headers."}},"required":["actor_id","period","period_value_cap","posted_value","remaining_value_budget","max_bulk_operation_size","request_rate_limits"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerLimits","description":"Read the caller's remaining per-period value budget and bulk-size ceiling"}},"/v1/accounts/{accountSlug}/ledger/books/{bookId}/accounts":{"get":{"tags":["Blocks: Ledger"],"summary":"List accounts of a book, filterable by semantic role (exact or prefix); cursor-paginated","description":"Resolve-before-act: filter by role (e.g. role=liability.tax.vat_payable, or a prefix like role=asset.cash) to find account ids structurally instead of synthesising them. Ordered by code.","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookId","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"},{"schema":{"type":"string","description":"Semantic role filter — exact match or prefix (asset.cash matches asset.cash.bank)."},"required":false,"description":"Semantic role filter — exact match or prefix (asset.cash matches asset.cash.bank).","name":"role","in":"query"},{"schema":{"type":"string","description":"Case-insensitive name/code substring search (candidate resolution)."},"required":false,"description":"Case-insensitive name/code substring search (candidate resolution).","name":"q","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Account: id, code, name, role, booking_method."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerBooksByBookIdAccounts"}},"/v1/accounts/{accountSlug}/ledger/units":{"post":{"tags":["Blocks: Ledger"],"summary":"Register a unit (fiat, crypto, virtual, commodity, quantity)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":32},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["fiat","crypto","virtual","commodity","quantity"]},"scale":{"type":"integer","minimum":0},"minIncrement":{"type":"string","minLength":1},"monetary":{"type":"boolean"}},"required":["code","name","kind","scale","minIncrement"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The registered unit (id, code, kind, scale, min_increment, monetary)."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerUnits","description":"Register a unit (fiat, crypto, virtual, commodity, quantity)"},"get":{"tags":["Blocks: Ledger"],"summary":"List units visible to this tenant (tenant-registered + platform-global)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"Unit."}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerUnits","description":"List units visible to this tenant (tenant-registered + platform-global)"}},"/v1/accounts/{accountSlug}/ledger/fx-rates":{"post":{"tags":["Blocks: Ledger"],"summary":"Record a typed FX rate (spot/daily/average/closing/historical)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"unitFrom":{"type":"string","minLength":1},"unitTo":{"type":"string","minLength":1},"rate":{"type":"string","minLength":1},"rateType":{"type":"string","enum":["spot","daily","average","closing","historical"]},"effectiveAt":{"type":"string","format":"date-time"},"source":{"type":"string","minLength":1},"direction":{"type":"string","enum":["from_to","to_from"]}},"required":["unitFrom","unitTo","rate","rateType","effectiveAt","source"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"description":"The stored fx rate."}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugLedgerFxRates","description":"Record a typed FX rate (spot/daily/average/closing/historical)"},"get":{"tags":["Blocks: Ledger"],"summary":"List FX rates (cursor-paginated; newest effective_at first)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue."},"required":false,"description":"Page size (bounded; default 25). Use next_cursor from the previous page to continue.","name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque cursor from a previous page (next_cursor)."},"required":false,"description":"Opaque cursor from a previous page (next_cursor).","name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"unit_from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"unit_to","in":"query"},{"schema":{"type":"string","enum":["spot","daily","average","closing","historical"]},"required":false,"name":"rate_type","in":"query"},{"schema":{"type":"string"},"required":false,"name":"source","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"description":"FX rate record."}},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null at the end."}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugLedgerFxRates","description":"List FX rates (cursor-paginated; newest effective_at first)"}},"/v1/accounts/{accountSlug}/ledger/fx-rates/{id}":{"delete":{"tags":["Blocks: Ledger"],"summary":"Delete an FX rate (rates are inputs, not postings — deletable)","parameters":[{"schema":{"type":"string","description":"The account (tenant) slug — all ledger data is scoped to it."},"required":true,"description":"The account (tenant) slug — all ledger data is scoped to it.","name":"accountSlug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Required on every commit-mode call (unique per logical operation; replays return the original response)."},"required":false,"description":"Required on every commit-mode call (unique per logical operation; replays return the original response).","name":"idempotency-key","in":"header"}],"responses":{"204":{"description":"deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugLedgerFxRatesById","description":"Delete an FX rate (rates are inputs, not postings — deletable)"}},"/v1/accounts/{slug}/members":{"get":{"tags":["Members"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"joined_at":{"type":"string","format":"date-time"}},"required":["account_id","user_id","role","joined_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsBySlugMembers"}},"/v1/accounts/{slug}/members/{userId}/role":{"post":{"tags":["Members"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member","viewer"]}},"required":["role"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string","format":"uuid"},"user_id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"joined_at":{"type":"string","format":"date-time"}},"required":["account_id","user_id","role","joined_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsBySlugMembersByUserIdRole"}},"/v1/accounts/{slug}/members/{userId}":{"delete":{"tags":["Members"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsBySlugMembersByUserId"}},"/v1/accounts/{account_slug}/invitations":{"get":{"tags":["Invitations"],"summary":"List invitations on this account (pending + recent).","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["admin","member","viewer"]},"invited_by_user_id":{"type":"string"},"expires_at":{"type":"string"},"accepted_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"created_at":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]}},"required":["id","account_id","email","role","invited_by_user_id","expires_at","accepted_at","revoked_at","created_at","status"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugInvitations","description":"List invitations on this account (pending + recent)."},"post":{"tags":["Invitations"],"summary":"Create an invitation. Returns the raw token exactly once — caller is responsible for sending the invite email.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","maxLength":254,"format":"email"},"role":{"type":"string","enum":["admin","member","viewer"]},"expires_in_days":{"type":"integer","minimum":1,"maximum":30}},"required":["email","role"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["admin","member","viewer"]},"invited_by_user_id":{"type":"string"},"expires_at":{"type":"string"},"accepted_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"created_at":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"token":{"type":"string"}},"required":["id","account_id","email","role","invited_by_user_id","expires_at","accepted_at","revoked_at","created_at","status","token"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugInvitations","description":"Create an invitation. Returns the raw token exactly once — caller is responsible for sending the invite email."}},"/v1/accounts/{account_slug}/invitations/{id}":{"delete":{"tags":["Invitations"],"summary":"Revoke a pending invitation.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"revoked"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugInvitationsById","description":"Revoke a pending invitation."}},"/v1/admin/me":{"get":{"tags":["Admin"],"summary":"Identify the calling operator. 403 if platformAdmin claim missing.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"admin","content":{"application/json":{"schema":{"type":"object","properties":{"admin":{"type":"boolean","enum":[true]},"localId":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"displayName":{"type":["string","null"]}},"required":["admin","localId","email","displayName"]}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"not an admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminMe","description":"Identify the calling operator. 403 if platformAdmin claim missing."}},"/v1/admin/accounts":{"get":{"tags":["Admin"],"summary":"List every account in the platform.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":["boolean","null"],"default":false},"required":false,"name":"include_deleted","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"is_deleted":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","slug","name","is_deleted","created_at","updated_at"]}},"next_cursor":{"type":["string","null"]}},"required":["accounts","next_cursor"]}}}},"403":{"description":"not an admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccounts","description":"List every account in the platform."}},"/v1/admin/accounts/{slug}":{"get":{"tags":["Admin"],"summary":"Fetch account + members + projects in one call.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"is_deleted":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","slug","name","is_deleted","created_at","updated_at"]},"members":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string"},"role":{"type":"string"},"joined_at":{"type":"string","format":"date-time"}},"required":["user_id","role","joined_at"]}},"projects":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"is_deleted":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"sandbox_egress":{"type":"string","enum":["restricted","open"]},"settings":{"type":"object","additionalProperties":{}}},"required":["id","slug","name","is_deleted","created_at","sandbox_egress","settings"]}}},"required":["account","members","projects"]}}}},"403":{"description":"not an admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsBySlug","description":"Fetch account + members + projects in one call."},"delete":{"tags":["Admin"],"summary":"Force soft-delete an account. Bypasses the no-projects guard.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"204":{"description":"soft-deleted"},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminAccountsBySlug","description":"Force soft-delete an account. Bypasses the no-projects guard."}},"/v1/admin/accounts/{slug}/members/{userId}/role":{"post":{"tags":["Admin"],"summary":"Force-set a member role. Bypasses caller membership; last-owner guard preserved. Optional {reason} lands in the audit_event (admin.member.role).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member","viewer"]},"reason":{"type":"string","maxLength":2000}},"required":["role"]}}}},"responses":{"200":{"description":"updated"},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"last-owner guard","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccountsBySlugMembersByUserIdRole","description":"Force-set a member role. Bypasses caller membership; last-owner guard preserved. Optional {reason} lands in the audit_event (admin.member.role)."}},"/v1/admin/accounts/{slug}/members/{userId}":{"delete":{"tags":["Admin"],"summary":"Force-remove a member. Last-owner guard preserved. Optional ?reason= (or {reason} body) lands in the audit_event (admin.member.remove).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"},{"schema":{"type":"string","maxLength":2000},"required":false,"name":"reason","in":"query"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"204":{"description":"removed"},"409":{"description":"last-owner guard","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminAccountsBySlugMembersByUserId","description":"Force-remove a member. Last-owner guard preserved. Optional ?reason= (or {reason} body) lands in the audit_event (admin.member.remove)."},"put":{"tags":["Admin"],"summary":"Add a user (app_user.id) to an account with a role. 409 already_member when a row exists.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member","viewer"]},"reason":{"type":"string","maxLength":2000}},"required":["role"]}}}},"responses":{"201":{"description":"added","content":{"application/json":{"schema":{"type":"object","properties":{"member":{"type":"object","properties":{"user_id":{"type":"string"},"role":{"type":"string"},"joined_at":{"type":"string"}},"required":["user_id","role","joined_at"]}},"required":["member"]}}}},"404":{"description":"account or user not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"already a member","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"putV1AdminAccountsBySlugMembersByUserId","description":"Add a user (app_user.id) to an account with a role. 409 already_member when a row exists."}},"/v1/admin/billing-plans":{"get":{"tags":["Admin"],"summary":"List every billing plan (active and inactive).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":120},"stripe_price_id":{"type":"string","minLength":1},"base_cents":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"trial_days":{"type":["integer","null"],"minimum":0},"features":{"type":"object","additionalProperties":{}},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"annual_stripe_price_id":{"type":["string","null"]},"annual_base_cents":{"type":["integer","null"],"minimum":0}},"required":["id","slug","name","stripe_price_id","base_cents","currency","trial_days","features","is_active","created_at","annual_stripe_price_id","annual_base_cents"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminBillingPlans","description":"List every billing plan (active and inactive)."},"post":{"tags":["Admin"],"summary":"Create a billing plan. Omit stripe_price_id to auto-create the Stripe product + monthly price; give annual_base_cents (yearly cents) to add a yearly price on the same product (CON-294).","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":120},"stripe_price_id":{"type":"string","minLength":1,"description":"Existing Stripe price id (price_xxx). Omit to auto-create one in Stripe from base_cents."},"base_cents":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"interval":{"type":"string","enum":["month","year"],"default":"month"},"trial_days":{"type":["integer","null"],"minimum":0},"features":{"type":"object","additionalProperties":{},"default":{}},"annual_base_cents":{"type":["integer","null"],"exclusiveMinimum":0,"description":"Yearly amount in cents (e.g. 18000 for $15/mo billed yearly). Omit for a monthly-only plan."},"annual_stripe_price_id":{"type":["string","null"],"minLength":1,"description":"Existing yearly Stripe price id. Omit to auto-create one from annual_base_cents."}},"required":["slug","name"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":120},"stripe_price_id":{"type":"string","minLength":1},"base_cents":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"trial_days":{"type":["integer","null"],"minimum":0},"features":{"type":"object","additionalProperties":{}},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"annual_stripe_price_id":{"type":["string","null"]},"annual_base_cents":{"type":["integer","null"],"minimum":0}},"required":["id","slug","name","stripe_price_id","base_cents","currency","trial_days","features","is_active","created_at","annual_stripe_price_id","annual_base_cents"]}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminBillingPlans","description":"Create a billing plan. Omit stripe_price_id to auto-create the Stripe product + monthly price; give annual_base_cents (yearly cents) to add a yearly price on the same product (CON-294)."}},"/v1/admin/billing-plans/{slug}":{"get":{"tags":["Admin"],"summary":"Get a single billing plan by slug.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":120},"stripe_price_id":{"type":"string","minLength":1},"base_cents":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"trial_days":{"type":["integer","null"],"minimum":0},"features":{"type":"object","additionalProperties":{}},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"annual_stripe_price_id":{"type":["string","null"]},"annual_base_cents":{"type":["integer","null"],"minimum":0}},"required":["id","slug","name","stripe_price_id","base_cents","currency","trial_days","features","is_active","created_at","annual_stripe_price_id","annual_base_cents"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminBillingPlansBySlug","description":"Get a single billing plan by slug."},"patch":{"tags":["Admin"],"summary":"Update a billing plan (everything except slug and stripe_price_id). annual_base_cents on a monthly-only plan auto-creates its yearly Stripe price (CON-294).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"base_cents":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"trial_days":{"type":["integer","null"],"minimum":0},"features":{"type":"object","additionalProperties":{}},"is_active":{"type":"boolean"},"annual_base_cents":{"type":["integer","null"],"exclusiveMinimum":0},"annual_stripe_price_id":{"type":["string","null"],"minLength":1}}}}}},"responses":{"200":{"description":"updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":120},"stripe_price_id":{"type":"string","minLength":1},"base_cents":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"trial_days":{"type":["integer","null"],"minimum":0},"features":{"type":"object","additionalProperties":{}},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"annual_stripe_price_id":{"type":["string","null"]},"annual_base_cents":{"type":["integer","null"],"minimum":0}},"required":["id","slug","name","stripe_price_id","base_cents","currency","trial_days","features","is_active","created_at","annual_stripe_price_id","annual_base_cents"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminBillingPlansBySlug","description":"Update a billing plan (everything except slug and stripe_price_id). annual_base_cents on a monthly-only plan auto-creates its yearly Stripe price (CON-294)."},"delete":{"tags":["Admin"],"summary":"Deactivate a billing plan (is_active=false). Soft — never hard-deletes.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"deactivated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":120},"stripe_price_id":{"type":"string","minLength":1},"base_cents":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"trial_days":{"type":["integer","null"],"minimum":0},"features":{"type":"object","additionalProperties":{}},"is_active":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"annual_stripe_price_id":{"type":["string","null"]},"annual_base_cents":{"type":["integer","null"],"minimum":0}},"required":["id","slug","name","stripe_price_id","base_cents","currency","trial_days","features","is_active","created_at","annual_stripe_price_id","annual_base_cents"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminBillingPlansBySlug","description":"Deactivate a billing plan (is_active=false). Soft — never hard-deletes."}},"/v1/admin/accounts/{slug}/billing":{"get":{"tags":["Admin"],"summary":"Stripe customer + subscriptions + recent invoices for an account.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"customer_id":{"type":["string","null"]},"subscriptions":{"type":"array","items":{"type":"object","properties":{"stripe_subscription_id":{"type":"string"},"status":{"type":"string"},"plan_slug":{"type":["string","null"]},"billing_interval":{"type":["string","null"],"enum":["month","year"]},"current_period_start":{"type":["string","null"],"format":"date-time"},"current_period_end":{"type":["string","null"],"format":"date-time"},"trial_end":{"type":["string","null"],"format":"date-time"},"cancel_at":{"type":["string","null"],"format":"date-time"},"canceled_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["stripe_subscription_id","status","plan_slug","billing_interval","current_period_start","current_period_end","trial_end","cancel_at","canceled_at","updated_at"]}},"invoices":{"type":"array","items":{"type":"object","properties":{"stripe_invoice_id":{"type":"string"},"amount_cents":{"type":"integer"},"currency":{"type":"string"},"status":{"type":"string"},"hosted_invoice_url":{"type":["string","null"]},"pdf_url":{"type":["string","null"]},"period_start":{"type":["string","null"],"format":"date-time"},"period_end":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"}},"required":["stripe_invoice_id","amount_cents","currency","status","hosted_invoice_url","pdf_url","period_start","period_end","created_at"]}}},"required":["customer_id","subscriptions","invoices"]}}}},"404":{"description":"account not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsBySlugBilling","description":"Stripe customer + subscriptions + recent invoices for an account."}},"/v1/admin/sandbox/reset":{"post":{"tags":["Admin"],"summary":"Hard-reset a project sandbox. Destroys the DO; next /exec boots fresh.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_slug":{"type":"string"},"project_slug":{"type":"string"},"project_id":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"reset","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"project_id":{"type":"string"},"project_slug":{"type":"string"},"account_slug":{"type":"string"},"steps":{"type":"array","items":{"type":"string"}}},"required":["ok","project_id","project_slug","account_slug","steps"]}}}},"400":{"description":"invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"cf-sandbox reset failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminSandboxReset","description":"Hard-reset a project sandbox. Destroys the DO; next /exec boots fresh."}},"/v1/admin/sandbox/probe":{"post":{"tags":["Admin"],"summary":"Run a non-destructive health probe against a project sandbox.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_slug":{"type":"string"},"project_slug":{"type":"string"},"project_id":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"probe result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"project_id":{"type":"string"},"project_slug":{"type":"string"},"account_slug":{"type":"string"},"mount":{"type":"string","enum":["healthy","recovered","stuck"]},"exec":{"type":"string","enum":["healthy","failed","skipped"]},"recovery":{"type":["string","null"],"enum":["unmount-remount","destroy-rebuild"]},"duration_ms":{"type":"number"},"detail":{"type":["string","null"]}},"required":["ok","project_id","project_slug","account_slug","mount","exec","recovery","duration_ms","detail"]}}}},"400":{"description":"invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"cf-sandbox unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminSandboxProbe","description":"Run a non-destructive health probe against a project sandbox."}},"/v1/admin/sandbox/probes":{"get":{"tags":["Admin"],"summary":"Recent health probes for a project (most recent first).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"project_id","in":"query"},{"schema":{"type":"string"},"required":false,"name":"account_slug","in":"query"},{"schema":{"type":"string"},"required":false,"name":"project_slug","in":"query"},{"schema":{"type":"integer","exclusiveMinimum":0,"maximum":200},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"recent probes","content":{"application/json":{"schema":{"type":"object","properties":{"probes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"ok":{"type":"boolean"},"mount":{"type":"string","enum":["healthy","recovered","stuck"]},"exec":{"type":"string","enum":["healthy","failed","skipped"]},"recovery":{"type":["string","null"],"enum":["unmount-remount","destroy-rebuild"]},"duration_ms":{"type":["number","null"]},"detail":{"type":["string","null"]},"probed_at":{"type":"string","format":"date-time"}},"required":["id","ok","mount","exec","recovery","duration_ms","detail","probed_at"]}}},"required":["probes"]}}}},"400":{"description":"invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminSandboxProbes","description":"Recent health probes for a project (most recent first)."}},"/v1/admin/connector-partners":{"get":{"tags":["Admin"],"summary":"List registered connector partners.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"list","content":{"application/json":{"schema":{"type":"object","properties":{"partners":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string"},"hmac_secret_ref":{"type":"string"},"accounts_allowed":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","key","manifest","materialise_url","hmac_secret_ref","accounts_allowed","is_active","created_by","created_at","updated_at"]}}},"required":["partners"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminConnectorPartners","description":"List registered connector partners."},"post":{"tags":["Admin"],"summary":"Register a new connector partner.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string","format":"uri"},"hmac_secret_ref":{"type":"string","minLength":1},"accounts_allowed":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["key","manifest","materialise_url","hmac_secret_ref"]}}}},"responses":{"200":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string"},"hmac_secret_ref":{"type":"string"},"accounts_allowed":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","key","manifest","materialise_url","hmac_secret_ref","accounts_allowed","is_active","created_by","created_at","updated_at"]}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"partner key already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminConnectorPartners","description":"Register a new connector partner."}},"/v1/admin/connector-partners/{key}":{"patch":{"tags":["Admin"],"summary":"Update a connector partner.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string","format":"uri"},"hmac_secret_ref":{"type":"string","minLength":1},"is_active":{"type":"boolean"}}}}}},"responses":{"200":{"description":"updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string"},"hmac_secret_ref":{"type":"string"},"accounts_allowed":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","key","manifest","materialise_url","hmac_secret_ref","accounts_allowed","is_active","created_by","created_at","updated_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminConnectorPartnersByKey","description":"Update a connector partner."},"delete":{"tags":["Admin"],"summary":"Delete a connector partner (existing connector instances using it stop working).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"204":{"description":"deleted"},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminConnectorPartnersByKey","description":"Delete a connector partner (existing connector instances using it stop working)."}},"/v1/admin/connector-partners/{key}/allowlist":{"put":{"tags":["Admin"],"summary":"Replace the per-account allowlist for a partner.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"accounts_allowed":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["accounts_allowed"]}}}},"responses":{"200":{"description":"updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string"},"hmac_secret_ref":{"type":"string"},"accounts_allowed":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","key","manifest","materialise_url","hmac_secret_ref","accounts_allowed","is_active","created_by","created_at","updated_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"putV1AdminConnectorPartnersByKeyAllowlist","description":"Replace the per-account allowlist for a partner."}},"/v1/admin/oauth-clients":{"get":{"tags":["Admin"],"summary":"List every registered OAuth client (DCR + CIMD) from connect0_auth.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":["boolean","null"],"default":false},"required":false,"name":"include_revoked","in":"query"}],"responses":{"200":{"description":"client list","content":{"application/json":{"schema":{"type":"object","properties":{"clients":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"client_id":{"type":"string"},"client_name":{"type":["string","null"]},"redirect_uris":{"type":"array","items":{"type":"string"}},"grant_types":{"type":"array","items":{"type":"string"}},"response_types":{"type":"array","items":{"type":"string"}},"token_endpoint_auth_method":{"type":"string"},"scope":{"type":["string","null"]},"client_id_issued_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"revoked_at":{"type":["string","null"]}},"required":["id","client_id","client_name","redirect_uris","grant_types","response_types","token_endpoint_auth_method","scope","client_id_issued_at","created_at","updated_at","revoked_at"]}}},"required":["clients"]}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"not an admin","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminOauthClients","description":"List every registered OAuth client (DCR + CIMD) from connect0_auth."}},"/v1/admin/users":{"get":{"tags":["Admin"],"summary":"List Identity Platform users (paginated, opaque cursor).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":1000,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"users":{"type":"array","items":{"type":"object","properties":{"localId":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"displayName":{"type":["string","null"]},"emailVerified":{"type":"boolean"},"disabled":{"type":"boolean"},"providerIds":{"type":"array","items":{"type":"string"}},"lastSignInAt":{"type":["string","null"]},"createdAt":{"type":["string","null"]}},"required":["localId","email","displayName","emailVerified","disabled","providerIds","lastSignInAt","createdAt"]}},"next_cursor":{"type":["string","null"]}},"required":["users","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsers","description":"List Identity Platform users (paginated, opaque cursor)."}},"/v1/admin/users/{localId}":{"get":{"tags":["Admin"],"summary":"Fetch a user: identity, memberships, app_user, security posture, access state, counts. `user` is null when only the app_user half exists (spec 103 §3).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":["object","null"],"properties":{"localId":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"displayName":{"type":["string","null"]},"emailVerified":{"type":"boolean"},"disabled":{"type":"boolean"},"providerIds":{"type":"array","items":{"type":"string"}},"lastSignInAt":{"type":["string","null"]},"createdAt":{"type":["string","null"]},"photoURL":{"type":["string","null"]},"customClaims":{"type":["object","null"],"additionalProperties":{}},"mfaEnrolled":{"type":"boolean"},"mfaFactors":{"type":"array","items":{"type":"object","properties":{"factorId":{"type":"string"},"displayName":{"type":["string","null"]},"enrolledAt":{"type":["string","null"]},"kind":{"type":"string"}},"required":["factorId","displayName","enrolledAt","kind"]}},"tokensValidAfterTime":{"type":["string","null"]},"lastRefreshAt":{"type":["string","null"]}},"required":["localId","email","displayName","emailVerified","disabled","providerIds","lastSignInAt","createdAt","photoURL","customClaims","mfaEnrolled","mfaFactors","tokensValidAfterTime","lastRefreshAt"]},"accounts":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"},"joined_at":{"type":"string"},"plan":{"type":["string","null"]},"spend_cap":{"type":["number","null"]},"blocks_enabled":{"type":"number"},"member_count":{"type":"number"}},"required":["slug","name","role","joined_at","plan","spend_cap","blocks_enabled","member_count"]}},"appUser":{"type":["object","null"],"properties":{"id":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","createdAt"]},"security":{"type":"object","properties":{"mfaEnrolled":{"type":"boolean"},"mfaFactors":{"type":"array","items":{"type":"object","properties":{"factorId":{"type":"string"},"displayName":{"type":["string","null"]},"enrolledAt":{"type":["string","null"]},"kind":{"type":"string"}},"required":["factorId","displayName","enrolledAt","kind"]}},"tokensValidAfterTime":{"type":["string","null"]},"lastSignInAt":{"type":["string","null"]},"lastRefreshAt":{"type":["string","null"]}},"required":["mfaEnrolled","mfaFactors","tokensValidAfterTime","lastSignInAt","lastRefreshAt"]},"access":{"type":"object","properties":{"state":{"type":"string","enum":["none","waitlisted","invited","activated"]},"waitlistEntryId":{"type":["string","null"]},"inviteCodesRedeemed":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"kind":{"type":"string"},"campaign":{"type":["string","null"]},"createdAt":{"type":"string"},"redeemedAt":{"type":"string"},"disabledAt":{"type":["string","null"]}},"required":["id","code","kind","campaign","createdAt"]}},"inviteCodesIssued":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"kind":{"type":"string"},"campaign":{"type":["string","null"]},"createdAt":{"type":"string"},"redeemedAt":{"type":"string"},"disabledAt":{"type":["string","null"]}},"required":["id","code","kind","campaign","createdAt"]}},"allowance":{"type":["object","null"],"properties":{"totalGranted":{"type":"number"},"used":{"type":"number"},"available":{"type":"number"}},"required":["totalGranted","used","available"]},"fraudReview":{"type":["object","null"],"properties":{"status":{"type":"string","enum":["flagged","reviewed","clear"]},"id":{"type":"string"}},"required":["status","id"]}},"required":["state","waitlistEntryId","inviteCodesRedeemed","inviteCodesIssued","allowance","fraudReview"]},"counts":{"type":"object","properties":{"accounts":{"type":"number"},"agents":{"type":"number"},"tokens":{"type":"number"}},"required":["accounts","agents","tokens"]}},"required":["user","accounts","appUser","security","access","counts"]}}}},"404":{"description":"neither Identity Platform nor app_user knows the id","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalId","description":"Fetch a user: identity, memberships, app_user, security posture, access state, counts. `user` is null when only the app_user half exists (spec 103 §3)."},"delete":{"tags":["Admin"],"summary":"Delete an Identity Platform user. Does NOT cascade memberships / agents / credits — returns those counts.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"200":{"description":"deleted","content":{"application/json":{"schema":{"type":"object","properties":{"cascade":{"type":"object","properties":{"accounts":{"type":"number"},"agents":{"type":"number"},"credits":{"type":"number"}},"required":["accounts","agents","credits"]},"ok":{"type":"boolean","enum":[true]}},"required":["cascade","ok"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminUsersByLocalId","description":"Delete an Identity Platform user. Does NOT cascade memberships / agents / credits — returns those counts."}},"/v1/admin/users/{localId}/overview":{"get":{"tags":["Admin"],"summary":"KPI strip + 14-day sparklines (accounts, credit balance, credits burned, calls, runs) over owned accounts.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"kpis":{"type":"object","properties":{"accounts":{"type":"number"},"creditBalance":{"type":"number"},"credits30d":{"type":"number"},"calls30d":{"type":"number"},"agents":{"type":"number"}},"required":["accounts","creditBalance","credits30d","calls30d","agents"]},"sparklines":{"type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"value":{"type":"number"}},"required":["day","value"]}},"creditBalance":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"value":{"type":"number"}},"required":["day","value"]}},"creditsBurned":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"value":{"type":"number"}},"required":["day","value"]}},"calls":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"value":{"type":"number"}},"required":["day","value"]}},"runs":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"value":{"type":"number"}},"required":["day","value"]}}},"required":["accounts","creditBalance","creditsBurned","calls","runs"]}},"required":["kpis","sparklines"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdOverview","description":"KPI strip + 14-day sparklines (accounts, credit balance, credits burned, calls, runs) over owned accounts."}},"/v1/admin/users/{localId}/usage":{"get":{"tags":["Admin"],"summary":"Daily credits by product + calls by transport, per-product totals, storage per owned account.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"},{"schema":{"type":"string","enum":["30d","90d"],"default":"30d"},"required":false,"name":"window","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"string","enum":["30d","90d"]},"series":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"credits":{"type":"object","additionalProperties":{"type":"number"}},"calls":{"type":"object","properties":{"api":{"type":"number"},"mcp":{"type":"number"}},"required":["api","mcp"]},"storageBytes":{"type":"number"}},"required":["day","credits","calls","storageBytes"]}},"products":{"type":"array","items":{"type":"object","properties":{"product":{"type":"string"},"variant":{"type":["string","null"]},"count":{"type":"number"},"credits":{"type":"number"},"share":{"type":"number"}},"required":["product","variant","count","credits","share"]}},"storage":{"type":"array","items":{"type":"object","properties":{"accountSlug":{"type":"string"},"ledgerBytes":{"type":"number"},"objectBytes":{"type":"number"}},"required":["accountSlug","ledgerBytes","objectBytes"]}},"spendCapCredits":{"type":["number","null"]}},"required":["window","series","products","storage","spendCapCredits"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdUsage","description":"Daily credits by product + calls by transport, per-product totals, storage per owned account."}},"/v1/admin/users/{localId}/credits":{"get":{"tags":["Admin"],"summary":"Credit balance per owned account + the grant / burn / expiry ledger (cursor-paginated).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"balances":{"type":"array","items":{"type":"object","properties":{"accountSlug":{"type":"string"},"accountName":{"type":"string"},"balanceCredits":{"type":"number"}},"required":["accountSlug","accountName","balanceCredits"]}},"ledger":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"at":{"type":"string"},"kind":{"type":"string","enum":["grant","burn","expiry"]},"accountSlug":{"type":"string"},"credits":{"type":"number"},"source":{"type":"string"}},"required":["id","at","kind","accountSlug","credits","source"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}},"required":["balances","ledger"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdCredits","description":"Credit balance per owned account + the grant / burn / expiry ledger (cursor-paginated)."}},"/v1/admin/users/{localId}/agents":{"get":{"tags":["Admin"],"summary":"Agents the user installed + per-day run outcomes (30d).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"accountSlug":{"type":"string"},"status":{"type":"string"},"lastRunAt":{"type":["string","null"]},"tokens":{"type":"number"}},"required":["id","name","accountSlug","status","lastRunAt","tokens"]}},"runsByDay":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"succeeded":{"type":"number"},"failed":{"type":"number"},"cancelled":{"type":"number"}},"required":["day","succeeded","failed","cancelled"]}}},"required":["agents","runsByDay"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdAgents","description":"Agents the user installed + per-day run outcomes (30d)."}},"/v1/admin/users/{localId}/runs":{"get":{"tags":["Admin"],"summary":"Recent agent runs across the agents the user installed (cursor-paginated).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"agentId":{"type":"string"},"agentName":{"type":"string"},"status":{"type":"string"},"startedAt":{"type":"string"},"durationMs":{"type":["number","null"]},"costCredits":{"type":"number"}},"required":["id","agentId","agentName","status","startedAt","durationMs","costCredits"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdRuns","description":"Recent agent runs across the agents the user installed (cursor-paginated)."}},"/v1/admin/users/{localId}/sessions":{"get":{"tags":["Admin"],"summary":"API tokens, OAuth grants and browser sessions (dashboard + operator) of the user — metadata only, never token values.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"tokens":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["api_token","oauth_grant","web_session","admin_session"]},"label":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"lastUsedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"ip":{"type":["string","null"]}},"required":["id","kind","label","scopes","createdAt","lastUsedAt","expiresAt","revokedAt"]}}},"required":["tokens"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdSessions","description":"API tokens, OAuth grants and browser sessions (dashboard + operator) of the user — metadata only, never token values."}},"/v1/admin/users/{localId}/audit":{"get":{"tags":["Admin"],"summary":"audit_event rows where the user is the object OR the actor, newest first.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"action","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"at":{"type":"string"},"action":{"type":"string"},"actorEmail":{"type":["string","null"]},"reason":{"type":["string","null"]},"payload":{}},"required":["id","at","action","actorEmail","reason"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdAudit","description":"audit_event rows where the user is the object OR the actor, newest first."}},"/v1/admin/users/{localId}/delete-preview":{"get":{"tags":["Admin"],"summary":"What deleting the Identity Platform user does NOT cascade: memberships, agents, credits.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"cascade":{"type":"object","properties":{"accounts":{"type":"number"},"agents":{"type":"number"},"credits":{"type":"number"}},"required":["accounts","agents","credits"]}},"required":["cascade"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsersByLocalIdDeletePreview","description":"What deleting the Identity Platform user does NOT cascade: memberships, agents, credits."}},"/v1/admin/users/{localId}/platform-admin":{"patch":{"tags":["Admin"],"summary":"Grant or revoke the platformAdmin claim. Guards: cannot_revoke_self, last_platform_admin, user_disabled.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"reason":{"type":"string","minLength":10,"maxLength":2000}},"required":["enabled","reason"]}}}},"responses":{"200":{"description":"updated user","content":{"application/json":{"schema":{"type":"object","properties":{"localId":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"displayName":{"type":["string","null"]},"emailVerified":{"type":"boolean"},"disabled":{"type":"boolean"},"providerIds":{"type":"array","items":{"type":"string"}},"lastSignInAt":{"type":["string","null"]},"createdAt":{"type":["string","null"]},"photoURL":{"type":["string","null"]},"customClaims":{"type":["object","null"],"additionalProperties":{}},"mfaEnrolled":{"type":"boolean"},"mfaFactors":{"type":"array","items":{"type":"object","properties":{"factorId":{"type":"string"},"displayName":{"type":["string","null"]},"enrolledAt":{"type":["string","null"]},"kind":{"type":"string"}},"required":["factorId","displayName","enrolledAt","kind"]}},"tokensValidAfterTime":{"type":["string","null"]},"lastRefreshAt":{"type":["string","null"]}},"required":["localId","email","displayName","emailVerified","disabled","providerIds","lastSignInAt","createdAt","photoURL","customClaims","mfaEnrolled","mfaFactors","tokensValidAfterTime","lastRefreshAt"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"409":{"description":"guard refused","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminUsersByLocalIdPlatformAdmin","description":"Grant or revoke the platformAdmin claim. Guards: cannot_revoke_self, last_platform_admin, user_disabled."}},"/v1/admin/users/{localId}/sessions/revoke":{"post":{"tags":["Admin"],"summary":"Force sign-out: revoke Identity Platform refresh tokens + every live api token / OAuth grant / browser session. With `audience`, revoke only that surface's browser sessions.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000},"audience":{"type":"string","enum":["web","admin"]}}}}}},"responses":{"200":{"description":"revoked","content":{"application/json":{"schema":{"type":"object","properties":{"revokedTokens":{"type":"number"},"revokedSessions":{"type":"number"},"revokedSessionsByAudience":{"type":"object","properties":{"web":{"type":"number"},"admin":{"type":"number"}},"required":["web","admin"]},"tokensValidAfterTime":{"type":["string","null"]}},"required":["revokedTokens","revokedSessions","revokedSessionsByAudience","tokensValidAfterTime"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminUsersByLocalIdSessionsRevoke","description":"Force sign-out: revoke Identity Platform refresh tokens + every live api token / OAuth grant / browser session. With `audience`, revoke only that surface's browser sessions."}},"/v1/admin/users/{localId}/sessions/{tokenId}/revoke":{"post":{"tags":["Admin"],"summary":"Revoke one api token, OAuth grant or browser session of the user. Idempotent.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"tokenId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"204":{"description":"revoked"},"400":{"description":"bad token id","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminUsersByLocalIdSessionsByTokenIdRevoke","description":"Revoke one api token, OAuth grant or browser session of the user. Idempotent."}},"/v1/admin/users/{localId}/actions/password-reset":{"post":{"tags":["Admin"],"summary":"Send a password-reset email (password provider only). 3/user/hour. Optional {reason} lands in the audit row.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"202":{"description":"sent","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","enum":[true]}},"required":["sent"]}}}},"409":{"description":"not applicable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"email not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}}},"operationId":"postV1AdminUsersByLocalIdActionsPasswordReset","description":"Send a password-reset email (password provider only). 3/user/hour. Optional {reason} lands in the audit row."}},"/v1/admin/users/{localId}/actions/verify-email":{"post":{"tags":["Admin"],"summary":"Send an email-verification email (unverified users only). 3/user/hour. Optional {reason} lands in the audit row.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"202":{"description":"sent","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","enum":[true]}},"required":["sent"]}}}},"409":{"description":"not applicable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"email not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}}},"operationId":"postV1AdminUsersByLocalIdActionsVerifyEmail","description":"Send an email-verification email (unverified users only). 3/user/hour. Optional {reason} lands in the audit row."}},"/v1/admin/users/{localId}/disable":{"post":{"tags":["Admin"],"summary":"Disable an Identity Platform user and revoke their refresh tokens.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"200":{"description":"disabled","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"user":{"type":"object","properties":{"localId":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"displayName":{"type":["string","null"]},"emailVerified":{"type":"boolean"},"disabled":{"type":"boolean"},"providerIds":{"type":"array","items":{"type":"string"}},"lastSignInAt":{"type":["string","null"]},"createdAt":{"type":["string","null"]},"photoURL":{"type":["string","null"]},"customClaims":{"type":["object","null"],"additionalProperties":{}},"mfaEnrolled":{"type":"boolean"},"mfaFactors":{"type":"array","items":{"type":"object","properties":{"factorId":{"type":"string"},"displayName":{"type":["string","null"]},"enrolledAt":{"type":["string","null"]},"kind":{"type":"string"}},"required":["factorId","displayName","enrolledAt","kind"]}},"tokensValidAfterTime":{"type":["string","null"]},"lastRefreshAt":{"type":["string","null"]}},"required":["localId","email","displayName","emailVerified","disabled","providerIds","lastSignInAt","createdAt","photoURL","customClaims","mfaEnrolled","mfaFactors","tokensValidAfterTime","lastRefreshAt"]}},"required":["ok","user"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminUsersByLocalIdDisable","description":"Disable an Identity Platform user and revoke their refresh tokens."}},"/v1/admin/users/{localId}/enable":{"post":{"tags":["Admin"],"summary":"Enable an Identity Platform user.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"localId","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":2000}}}}}},"responses":{"200":{"description":"enabled","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"user":{"type":"object","properties":{"localId":{"type":"string"},"email":{"type":["string","null"],"format":"email"},"displayName":{"type":["string","null"]},"emailVerified":{"type":"boolean"},"disabled":{"type":"boolean"},"providerIds":{"type":"array","items":{"type":"string"}},"lastSignInAt":{"type":["string","null"]},"createdAt":{"type":["string","null"]},"photoURL":{"type":["string","null"]},"customClaims":{"type":["object","null"],"additionalProperties":{}},"mfaEnrolled":{"type":"boolean"},"mfaFactors":{"type":"array","items":{"type":"object","properties":{"factorId":{"type":"string"},"displayName":{"type":["string","null"]},"enrolledAt":{"type":["string","null"]},"kind":{"type":"string"}},"required":["factorId","displayName","enrolledAt","kind"]}},"tokensValidAfterTime":{"type":["string","null"]},"lastRefreshAt":{"type":["string","null"]}},"required":["localId","email","displayName","emailVerified","disabled","providerIds","lastSignInAt","createdAt","photoURL","customClaims","mfaEnrolled","mfaFactors","tokensValidAfterTime","lastRefreshAt"]}},"required":["ok","user"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminUsersByLocalIdEnable","description":"Enable an Identity Platform user."}},"/v1/admin/pricebooks":{"get":{"tags":["Admin"],"summary":"List pricebooks (all versions).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"version":{"type":"number"},"effective_from":{"type":"string"},"description":{"type":["string","null"]},"show_to_customer":{"type":"boolean"},"created_at":{"type":"string"}},"required":["id","slug","version","effective_from","description","show_to_customer","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPricebooks","description":"List pricebooks (all versions)."}},"/v1/admin/pricebooks/{slug}":{"get":{"tags":["Admin"],"summary":"Get pricebook detail (latest version unless ?version=N).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"anyOf":[{"type":"string"},{"type":"number"}]},"required":false,"name":"version","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"version":{"type":"number"},"effective_from":{"type":"string"},"description":{"type":["string","null"]},"show_to_customer":{"type":"boolean"},"created_at":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"pricebook_id":{"type":"string"},"product":{"type":"string"},"variant":{"type":["string","null"]},"unit":{"type":"string"},"rate_microusd":{"type":"number"},"included_quota":{"type":"number"},"notes":{"type":["string","null"]}},"required":["id","pricebook_id","product","variant","unit","rate_microusd","included_quota","notes"]}}},"required":["id","slug","version","effective_from","description","show_to_customer","created_at","items"]}}}},"404":{"description":"not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPricebooksBySlug","description":"Get pricebook detail (latest version unless ?version=N)."}},"/v1/admin/pricebooks/{id}":{"patch":{"tags":["Admin"],"summary":"Update pricebook metadata (description / show_to_customer).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":["string","null"],"maxLength":500},"show_to_customer":{"type":"boolean"}}}}}},"responses":{"204":{"description":"updated"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminPricebooksById","description":"Update pricebook metadata (description / show_to_customer)."}},"/v1/admin/pricebook-items/{id}":{"patch":{"tags":["Admin"],"summary":"Update a pricebook_item (rate / included_quota / notes).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"rate_microusd":{"type":"integer","minimum":0},"included_quota":{"type":"integer","minimum":0},"notes":{"type":["string","null"],"maxLength":500}}}}}},"responses":{"204":{"description":"updated"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminPricebookItemsById","description":"Update a pricebook_item (rate / included_quota / notes)."},"delete":{"tags":["Admin"],"summary":"Delete a pricebook_item.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminPricebookItemsById","description":"Delete a pricebook_item."}},"/v1/admin/pricebook-items":{"post":{"tags":["Admin"],"summary":"Add a pricebook_item.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"pricebook_id":{"type":"string"},"product":{"type":"string","minLength":1,"maxLength":80},"variant":{"type":["string","null"],"maxLength":80},"unit":{"type":"string","minLength":1,"maxLength":40},"rate_microusd":{"type":"integer","minimum":0},"included_quota":{"type":"integer","minimum":0},"notes":{"type":["string","null"],"maxLength":500}},"required":["pricebook_id","product","unit","rate_microusd"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPricebookItems","description":"Add a pricebook_item."}},"/v1/admin/cogs-rates":{"get":{"tags":["Admin"],"summary":"List cost_rate rows.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"env":{"type":"string"},"effective_from":{"type":"string"},"effective_to":{"type":["string","null"]},"cpu_ms_microusd":{"type":"number"},"memory_ms_microusd":{"type":"number"},"egress_byte_microusd":{"type":"number"},"ingress_byte_microusd":{"type":"number"},"r2_storage_byte_month_microusd":{"type":"number"},"r2_class_a_op_microusd":{"type":"number"},"r2_class_b_op_microusd":{"type":"number"},"cf_worker_request_microusd":{"type":"number"},"notes":{"type":["string","null"]}},"required":["id","env","effective_from","effective_to","cpu_ms_microusd","memory_ms_microusd","egress_byte_microusd","ingress_byte_microusd","r2_storage_byte_month_microusd","r2_class_a_op_microusd","r2_class_b_op_microusd","cf_worker_request_microusd","notes"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminCogsRates","description":"List cost_rate rows."}},"/v1/admin/accounts/{slug}/spend-cap":{"get":{"tags":["Admin"],"summary":"Get the account's spend cap.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"account_slug":{"type":"string"},"notify_at_microusd":{"type":["number","null"]},"hard_cap_microusd":{"type":["number","null"]},"cap_dimension":{"type":"string"},"notify_at_last_fired_month":{"type":["string","null"]},"hard_cap_last_fired_month":{"type":["string","null"]},"updated_at":{"type":"string"}},"required":["account_id","account_slug","notify_at_microusd","hard_cap_microusd","cap_dimension","notify_at_last_fired_month","hard_cap_last_fired_month","updated_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsBySlugSpendCap","description":"Get the account's spend cap."},"post":{"tags":["Admin"],"summary":"Override the account spend cap (operator).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_at_microusd":{"type":["integer","null"],"exclusiveMinimum":0},"hard_cap_microusd":{"type":["integer","null"],"exclusiveMinimum":0}},"required":["notify_at_microusd","hard_cap_microusd"]}}}},"responses":{"200":{"description":"updated","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"account_slug":{"type":"string"},"notify_at_microusd":{"type":["number","null"]},"hard_cap_microusd":{"type":["number","null"]},"cap_dimension":{"type":"string"},"notify_at_last_fired_month":{"type":["string","null"]},"hard_cap_last_fired_month":{"type":["string","null"]},"updated_at":{"type":"string"}},"required":["account_id","account_slug","notify_at_microusd","hard_cap_microusd","cap_dimension","notify_at_last_fired_month","hard_cap_last_fired_month","updated_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccountsBySlugSpendCap","description":"Override the account spend cap (operator)."}},"/v1/admin/usage/margin-leaderboard":{"get":{"tags":["Admin"],"summary":"Top-N by COGS / revenue / bottom-N by margin %.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"topByCogs":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"account_slug":{"type":"string"},"account_name":{"type":"string"},"cogs_microusd":{"type":"number"},"revenue_microusd":{"type":"number"},"margin_pct":{"type":["number","null"]}},"required":["account_id","account_slug","account_name","cogs_microusd","revenue_microusd","margin_pct"]}},"topByRevenue":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"account_slug":{"type":"string"},"account_name":{"type":"string"},"cogs_microusd":{"type":"number"},"revenue_microusd":{"type":"number"},"margin_pct":{"type":["number","null"]}},"required":["account_id","account_slug","account_name","cogs_microusd","revenue_microusd","margin_pct"]}},"bottomByMargin":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"account_slug":{"type":"string"},"account_name":{"type":"string"},"cogs_microusd":{"type":"number"},"revenue_microusd":{"type":"number"},"margin_pct":{"type":["number","null"]}},"required":["account_id","account_slug","account_name","cogs_microusd","revenue_microusd","margin_pct"]}}},"required":["topByCogs","topByRevenue","bottomByMargin"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsageMarginLeaderboard","description":"Top-N by COGS / revenue / bottom-N by margin %."}},"/v1/admin/usage/anomalies":{"get":{"tags":["Admin"],"summary":"Recent anomaly events (acked + unacked).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"detected_at":{"type":"string"},"account_id":{"type":"string"},"account_slug":{"type":"string"},"product":{"type":"string"},"variant":{"type":["string","null"]},"hour_bucket":{"type":"string"},"detection_kind":{"type":"string"},"z_score":{"type":["number","null"]},"observed_microusd":{"type":"number"},"expected_microusd":{"type":["number","null"]},"acked_at":{"type":["string","null"]}},"required":["id","detected_at","account_id","account_slug","product","variant","hour_bucket","detection_kind","z_score","observed_microusd","expected_microusd","acked_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminUsageAnomalies","description":"Recent anomaly events (acked + unacked)."}},"/v1/admin/usage/anomalies/{id}/ack":{"post":{"tags":["Admin"],"summary":"Ack an anomaly so it stops paging.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":["string","null"],"maxLength":500}}}}}},"responses":{"204":{"description":"acked"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminUsageAnomaliesByIdAck","description":"Ack an anomaly so it stops paging."}},"/v1/admin/partners":{"get":{"tags":["Admin"],"summary":"List connector partners.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string"},"hmac_secret_ref":{"type":"string"},"accounts_allowed":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"operator_note":{"type":["string","null"]}},"required":["id","key","manifest","materialise_url","hmac_secret_ref","accounts_allowed","is_active","created_by","created_at","updated_at","operator_note"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPartners","description":"List connector partners."}},"/v1/admin/partners/{key}":{"get":{"tags":["Admin"],"summary":"Get a single connector partner by key.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"manifest":{"type":"object","additionalProperties":{}},"materialise_url":{"type":"string"},"hmac_secret_ref":{"type":"string"},"accounts_allowed":{"type":"array","items":{"type":"string"}},"is_active":{"type":"boolean"},"created_by":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"operator_note":{"type":["string","null"]}},"required":["id","key","manifest","materialise_url","hmac_secret_ref","accounts_allowed","is_active","created_by","created_at","updated_at","operator_note"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPartnersByKey","description":"Get a single connector partner by key."}},"/v1/admin/partners/{key}/test":{"post":{"tags":["Admin"],"summary":"Partner readiness probe (derived from stored config; live materialise lands in §4.3).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"probe":{"type":"string","enum":["derived"]},"partner_key":{"type":"string"},"is_active":{"type":"boolean"},"materialise_url":{"type":"string"},"has_hmac_secret":{"type":"boolean"},"accounts_allowed_count":{"type":"number"},"last_revenue_month":{"type":["string","null"]},"ready":{"type":"boolean"},"checked_at":{"type":"string"}},"required":["probe","partner_key","is_active","materialise_url","has_hmac_secret","accounts_allowed_count","last_revenue_month","ready","checked_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPartnersByKeyTest","description":"Partner readiness probe (derived from stored config; live materialise lands in §4.3)."}},"/v1/admin/partners/{key}/revenue-shares":{"get":{"tags":["Admin"],"summary":"List partner revenue share windows (newest first).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"partner_id":{"type":"string"},"partner_key":{"type":"string"},"effective_from":{"type":"string"},"effective_to":{"type":["string","null"]},"share_basis_points":{"type":"number"},"applies_to":{"type":"string"},"notes":{"type":["string","null"]},"created_by_user_id":{"type":"string"},"created_at":{"type":"string"}},"required":["partner_id","partner_key","effective_from","effective_to","share_basis_points","applies_to","notes","created_by_user_id","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPartnersByKeyRevenueShares","description":"List partner revenue share windows (newest first)."},"post":{"tags":["Admin"],"summary":"Open a new partner revenue share window (closes any open prior window).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"effective_from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"share_basis_points":{"type":"integer","minimum":0,"maximum":10000},"applies_to":{"type":"string","minLength":1,"maxLength":100,"default":"all"},"notes":{"type":["string","null"],"maxLength":500}},"required":["effective_from","share_basis_points"]}}}},"responses":{"200":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"partner_id":{"type":"string"},"partner_key":{"type":"string"},"effective_from":{"type":"string"},"effective_to":{"type":["string","null"]},"share_basis_points":{"type":"number"},"applies_to":{"type":"string"},"notes":{"type":["string","null"]},"created_by_user_id":{"type":"string"},"created_at":{"type":"string"}},"required":["partner_id","partner_key","effective_from","effective_to","share_basis_points","applies_to","notes","created_by_user_id","created_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPartnersByKeyRevenueShares","description":"Open a new partner revenue share window (closes any open prior window)."}},"/v1/admin/partners/{key}/revenue":{"get":{"tags":["Admin"],"summary":"Monthly revenue + share history (last 24 months).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"partner_key":{"type":"string"},"bucket_month":{"type":"string"},"event_count":{"type":"number"},"revenue_microusd":{"type":"number"},"partner_share_microusd":{"type":"number"}},"required":["partner_key","bucket_month","event_count","revenue_microusd","partner_share_microusd"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPartnersByKeyRevenue","description":"Monthly revenue + share history (last 24 months)."}},"/v1/admin/agents/overview":{"get":{"tags":["Admin"],"summary":"Platform-wide agent overview: KPI strip, runs by outcome, failure rate by origin, top failing tools.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"},"required":false,"name":"window","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"string","enum":["24h","7d","30d","90d"]},"granularity":{"type":"string","enum":["hour","day"]},"kpis":{"type":"object","properties":{"runs":{"type":"object","properties":{"value":{"type":"number"},"series":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"]}}},"required":["value","series"]},"failureRate":{"type":"object","properties":{"value":{"type":"number"},"series":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"]}}},"required":["value","series"]},"p95DurationMs":{"type":"object","properties":{"value":{"type":"number"},"series":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"]}}},"required":["value","series"]},"creditsSpent":{"type":"object","properties":{"value":{"type":"number"},"series":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"]}}},"required":["value","series"]},"accountsWithRun":{"type":"object","properties":{"value":{"type":"number"},"series":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"]}}},"required":["value","series"]},"proposalsAwaitingConfirmation":{"type":"object","properties":{"value":{"type":"number"},"series":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"]}}},"required":["value","series"]}},"required":["runs","failureRate","p95DurationMs","creditsSpent","accountsWithRun","proposalsAwaitingConfirmation"]},"runsByOutcome":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"succeeded":{"type":"number"},"failed":{"type":"number"},"cancelled":{"type":"number"},"running":{"type":"number"}},"required":["bucket","succeeded","failed","cancelled","running"]}},"failureRateByOrigin":{"type":"array","items":{"type":"object","properties":{"origin":{"type":"string","enum":["user","first_party"]},"runs":{"type":"number"},"failures":{"type":"number"},"rate":{"type":"number"}},"required":["origin","runs","failures","rate"]}},"topFailingTools":{"type":"object","properties":{"toolCallDataAvailable":{"type":"boolean"},"source":{"type":"string","enum":["tool.call","skill.invoke"]},"items":{"type":"array","items":{"type":"object","properties":{"toolName":{"type":"string"},"source":{"type":["string","null"]},"invocations":{"type":"number"},"failures":{"type":"number"},"failureRate":{"type":"number"},"lastFailure":{"type":["string","null"]},"topErrorCode":{"type":["string","null"]}},"required":["toolName","source","invocations","failures","failureRate","lastFailure","topErrorCode"]}}},"required":["toolCallDataAvailable","source","items"]},"proposalFunnel":{"type":"object","properties":{"window":{"type":"string","enum":["24h","7d","30d","90d"]},"total":{"type":"object","properties":{"action":{"type":"string"},"proposed":{"type":"number"},"applied":{"type":"number"},"failed":{"type":"number"},"dismissed":{"type":"number"},"unconfirmed":{"type":"number"},"oldestUnconfirmedMs":{"type":["number","null"]}},"required":["action","proposed","applied","failed","dismissed","unconfirmed","oldestUnconfirmedMs"]},"byAction":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"proposed":{"type":"number"},"applied":{"type":"number"},"failed":{"type":"number"},"dismissed":{"type":"number"},"unconfirmed":{"type":"number"},"oldestUnconfirmedMs":{"type":["number","null"]}},"required":["action","proposed","applied","failed","dismissed","unconfirmed","oldestUnconfirmedMs"]}}},"required":["window","total","byAction"]}},"required":["window","granularity","kpis","runsByOutcome","failureRateByOrigin","topFailingTools","proposalFunnel"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentsOverview","description":"Platform-wide agent overview: KPI strip, runs by outcome, failure rate by origin, top failing tools."}},"/v1/admin/agents/runs":{"get":{"tags":["Admin"],"summary":"Run explorer: cursor-paginated agent_run list with every §4.3 filter. Content is never returned here.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"},"required":false,"name":"window","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"accountId","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"agentId","in":"query"},{"schema":{"type":"string","enum":["user","first_party"]},"required":false,"name":"origin","in":"query"},{"schema":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["manual","rest","cron","webhook","a2a","mcp","agent","telegram","email","slack"]},"required":false,"name":"triggerKind","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"hasError","in":"query"},{"schema":{"type":"string","enum":["free","low","medium","high"]},"required":false,"name":"costBand","in":"query"},{"schema":{"type":"string","enum":["started","cost"]},"required":false,"name":"sort","in":"query"},{"schema":{"type":"string","enum":["asc","desc"]},"required":false,"name":"direction","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"started":{"type":"string"},"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}},"required":["id","slug"]},"agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]}},"required":["id","name","origin"]},"trigger":{"type":"object","properties":{"kind":{"type":"string","enum":["manual","rest","cron","webhook","a2a","mcp","agent","telegram","email","slack"]},"byKind":{"type":"string"},"byId":{"type":"string"}},"required":["kind","byKind","byId"]},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"durationMs":{"type":["number","null"]},"costMicrousd":{"type":"number"},"costCredits":{"type":"number"},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]}},"required":["id","started","account","agent","trigger","status","durationMs","costMicrousd","costCredits","failureKind"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentsRuns","description":"Run explorer: cursor-paginated agent_run list with every §4.3 filter. Content is never returned here."}},"/v1/admin/agents/runs/{runId}":{"get":{"tags":["Admin"],"summary":"One run: header, nested agent_audit timeline, error and thread messages. Customer content is REDACTED unless this operator has an audited reveal grant for this run — POST /reveal to get one.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string","enum":["true","1"]},"required":false,"name":"reveal","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"started":{"type":"string"},"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}},"required":["id","slug"]},"agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]}},"required":["id","name","origin"]},"trigger":{"type":"object","properties":{"kind":{"type":"string","enum":["manual","rest","cron","webhook","a2a","mcp","agent","telegram","email","slack"]},"byKind":{"type":"string"},"byId":{"type":"string"}},"required":["kind","byKind","byId"]},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"durationMs":{"type":["number","null"]},"costMicrousd":{"type":"number"},"costCredits":{"type":"number"},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]}},"required":["id","started","account","agent","trigger","status","durationMs","costMicrousd","costCredits","failureKind"]},"threadId":{"type":"string"},"error":{"anyOf":[{"type":"object","properties":{"revealed":{"type":"boolean","enum":[true]},"value":{}},"required":["revealed"]},{"type":"object","properties":{"revealed":{"type":"boolean","enum":[false]},"chars":{"type":"number"}},"required":["revealed","chars"]},{"type":"null"}]},"errorCode":{"type":["string","null"]},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]},"audits":{"type":"array","items":{"$ref":"#/components/schemas/AdminAgentAuditNode"}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"authorKind":{"type":"string"},"position":{"type":"number"},"createdAt":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"revealed":{"type":"boolean","enum":[true]},"text":{"type":"string"}},"required":["revealed","text"]},{"type":"object","properties":{"revealed":{"type":"boolean","enum":[false]},"chars":{"type":"number"}},"required":["revealed","chars"]}]}},"required":["id","role","authorKind","position","createdAt","content"]}}},"required":["run","threadId","error","errorCode","failureKind","audits","messages"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"run_not_found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentsRunsByRunId","description":"One run: header, nested agent_audit timeline, error and thread messages. Customer content is REDACTED unless this operator has an audited reveal grant for this run — POST /reveal to get one."}},"/v1/admin/agents/runs/{runId}/reveal":{"post":{"tags":["Admin"],"summary":"Reveal a run's customer content. Writes an `admin.agent.content_reveal` audit row (operator, run, account, reason) FIRST, then returns the un-redacted run detail. `reason` is required (min 10 chars after trim).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"runId","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accountId":{"type":"string","minLength":1},"reason":{"type":"string","maxLength":2000}},"required":["accountId","reason"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"auditEventId":{"type":"string"},"reason":{"type":"string"},"detail":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"started":{"type":"string"},"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}},"required":["id","slug"]},"agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]}},"required":["id","name","origin"]},"trigger":{"type":"object","properties":{"kind":{"type":"string","enum":["manual","rest","cron","webhook","a2a","mcp","agent","telegram","email","slack"]},"byKind":{"type":"string"},"byId":{"type":"string"}},"required":["kind","byKind","byId"]},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"durationMs":{"type":["number","null"]},"costMicrousd":{"type":"number"},"costCredits":{"type":"number"},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]}},"required":["id","started","account","agent","trigger","status","durationMs","costMicrousd","costCredits","failureKind"]},"threadId":{"type":"string"},"error":{"anyOf":[{"type":"object","properties":{"revealed":{"type":"boolean","enum":[true]},"value":{}},"required":["revealed"]},{"type":"object","properties":{"revealed":{"type":"boolean","enum":[false]},"chars":{"type":"number"}},"required":["revealed","chars"]},{"type":"null"}]},"errorCode":{"type":["string","null"]},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]},"audits":{"type":"array","items":{"$ref":"#/components/schemas/AdminAgentAuditNode"}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"authorKind":{"type":"string"},"position":{"type":"number"},"createdAt":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"revealed":{"type":"boolean","enum":[true]},"text":{"type":"string"}},"required":["revealed","text"]},{"type":"object","properties":{"revealed":{"type":"boolean","enum":[false]},"chars":{"type":"number"}},"required":["revealed","chars"]}]}},"required":["id","role","authorKind","position","createdAt","content"]}}},"required":["run","threadId","error","errorCode","failureKind","audits","messages"]}},"required":["auditEventId","reason","detail"]}}}},"400":{"description":"reason_too_short | invalid_runid","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"run not found, or it does not belong to accountId","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAgentsRunsByRunIdReveal","description":"Reveal a run's customer content. Writes an `admin.agent.content_reveal` audit row (operator, run, account, reason) FIRST, then returns the un-redacted run detail. `reason` is required (min 10 chars after trim)."}},"/v1/admin/agents/errors":{"get":{"tags":["Admin"],"summary":"Error catalogue: every failure in the window grouped by failure kind, with the measured `unclassified` ratio (AC4) and the per-account retention horizon (AC5).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"},"required":false,"name":"window","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"accountId","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"agentId","in":"query"},{"schema":{"type":"string","enum":["user","first_party"]},"required":false,"name":"origin","in":"query"},{"schema":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["manual","rest","cron","webhook","a2a","mcp","agent","telegram","email","slack"]},"required":false,"name":"triggerKind","in":"query"},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"hasError","in":"query"},{"schema":{"type":"string","enum":["free","low","medium","high"]},"required":false,"name":"costBand","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"string","enum":["24h","7d","30d","90d"]},"granularity":{"type":"string","enum":["hour","day"]},"groups":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]},"count":{"type":"number"},"firstSeen":{"type":"string"},"lastSeen":{"type":"string"},"series":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"]}},"members":{"type":"array","items":{"type":"object","properties":{"runId":{"type":["string","null"]},"auditId":{"type":["string","null"]},"accountId":{"type":"string"},"agentId":{"type":"string"},"at":{"type":"string"},"detail":{"type":["string","null"]}},"required":["runId","auditId","accountId","agentId","at","detail"]}},"truncated":{"type":"boolean"}},"required":["kind","count","firstSeen","lastSeen","series","members","truncated"]}},"totalFailures":{"type":"number"},"unclassified":{"type":"object","properties":{"count":{"type":"number"},"ratio":{"type":"number"}},"required":["count","ratio"]},"retention":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"accountSlug":{"type":"string"},"tier":{"type":"string","enum":["free","pro","enterprise"]},"retentionDays":{"type":"number"},"horizon":{"type":"string"}},"required":["accountId","accountSlug","tier","retentionDays","horizon"]}}},"required":["window","granularity","groups","totalFailures","unclassified","retention"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentsErrors","description":"Error catalogue: every failure in the window grouped by failure kind, with the measured `unclassified` ratio (AC4) and the per-account retention horizon (AC5)."}},"/v1/admin/agents/proposals":{"get":{"tags":["Admin"],"summary":"Zero proposal funnel: proposed / applied / failed / dismissed / unconfirmed, rolled up and by action.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"},"required":false,"name":"window","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"accountId","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"agentId","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"string","enum":["24h","7d","30d","90d"]},"total":{"type":"object","properties":{"action":{"type":"string"},"proposed":{"type":"number"},"applied":{"type":"number"},"failed":{"type":"number"},"dismissed":{"type":"number"},"unconfirmed":{"type":"number"},"oldestUnconfirmedMs":{"type":["number","null"]}},"required":["action","proposed","applied","failed","dismissed","unconfirmed","oldestUnconfirmedMs"]},"byAction":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"proposed":{"type":"number"},"applied":{"type":"number"},"failed":{"type":"number"},"dismissed":{"type":"number"},"unconfirmed":{"type":"number"},"oldestUnconfirmedMs":{"type":["number","null"]}},"required":["action","proposed","applied","failed","dismissed","unconfirmed","oldestUnconfirmedMs"]}}},"required":["window","total","byAction"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentsProposals","description":"Zero proposal funnel: proposed / applied / failed / dismissed / unconfirmed, rolled up and by action."}},"/v1/admin/agents/analysis":{"get":{"tags":["Admin"],"summary":"Cross-run analysis: top failing tools, unserved-intent clusters, retries / abandonment, cost outliers, regression watch. Cluster member text is REDACTED.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"},"required":false,"name":"window","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"string","enum":["24h","7d","30d","90d"]},"topFailingTools":{"type":"array","items":{"type":"object","properties":{"toolName":{"type":"string"},"source":{"type":["string","null"]},"invocations":{"type":"number"},"failures":{"type":"number"},"failureRate":{"type":"number"},"lastFailure":{"type":["string","null"]},"topErrorCode":{"type":["string","null"]}},"required":["toolName","source","invocations","failures","failureRate","lastFailure","topErrorCode"]}},"unservedIntents":{"type":"object","properties":{"enabled":{"type":"boolean"},"candidateRuns":{"type":"number"},"clusters":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"size":{"type":"number"},"members":{"type":"array","items":{"type":"object","properties":{"runId":{"type":"string"},"accountId":{"type":"string"},"agentId":{"type":"string"},"at":{"type":"string"},"normalized":{"anyOf":[{"type":"object","properties":{"revealed":{"type":"boolean","enum":[true]},"text":{"type":"string"}},"required":["revealed","text"]},{"type":"object","properties":{"revealed":{"type":"boolean","enum":[false]},"chars":{"type":"number"}},"required":["revealed","chars"]}]}},"required":["runId","accountId","agentId","at","normalized"]}}},"required":["label","size","members"]}}},"required":["enabled","candidateRuns","clusters"]},"retryAndAbandonment":{"type":"object","properties":{"retries":{"type":"array","items":{"type":"object","properties":{"threadId":{"type":"string"},"accountId":{"type":"string"},"agentId":{"type":"string"},"at":{"type":"string"},"gapMs":{"type":"number"},"similarity":{"type":"number"}},"required":["threadId","accountId","agentId","at","gapMs","similarity"]}},"abandonedAfterFailure":{"type":"array","items":{"type":"object","properties":{"threadId":{"type":"string"},"accountId":{"type":"string"},"agentId":{"type":"string"},"runId":{"type":"string"},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]},"at":{"type":"string"}},"required":["threadId","accountId","agentId","runId","failureKind","at"]}}},"required":["retries","abandonedAfterFailure"]},"costOutliers":{"type":"object","properties":{"p99Microusd":{"type":"number"},"items":{"type":"array","items":{"type":"object","properties":{"runId":{"type":"string"},"accountId":{"type":"string"},"agentId":{"type":"string"},"at":{"type":"string"},"costMicrousd":{"type":"number"},"costCredits":{"type":"number"},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]}},"required":["runId","accountId","agentId","at","costMicrousd","costCredits","status"]}}},"required":["p99Microusd","items"]},"regressionWatch":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string"},"agentName":{"type":"string"},"accountId":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]},"currentRuns":{"type":"number"},"currentFailureRate":{"type":"number"},"previousRuns":{"type":"number"},"previousFailureRate":{"type":"number"},"delta":{"type":"number"}},"required":["agentId","agentName","accountId","origin","currentRuns","currentFailureRate","previousRuns","previousFailureRate","delta"]}}},"required":["window","topFailingTools","unservedIntents","retryAndAbandonment","costOutliers","regressionWatch"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentsAnalysis","description":"Cross-run analysis: top failing tools, unserved-intent clusters, retries / abandonment, cost outliers, regression watch. Cluster member text is REDACTED."}},"/v1/admin/agents":{"get":{"tags":["Admin"],"summary":"Agent roster: cursor-paginated account_agent list with window-scoped run / failure / credit counts.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"},"required":false,"name":"window","in":"query"},{"schema":{"type":"string","minLength":1},"required":false,"name":"accountId","in":"query"},{"schema":{"type":"string","enum":["user","first_party"]},"required":false,"name":"origin","in":"query"},{"schema":{"type":"string","enum":["human","zero","template","api"]},"required":false,"name":"createdVia","in":"query"},{"schema":{"type":"string"},"required":false,"name":"search","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]},"createdVia":{"type":"string","enum":["human","zero","template","api"]},"createdViaAuditId":{"type":["string","null"]},"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}},"required":["id","slug"]},"status":{"type":"string"},"runs":{"type":"number"},"failures":{"type":"number"},"failureRate":{"type":"number"},"creditsSpent":{"type":"number"},"lastRunAt":{"type":["string","null"]}},"required":["id","name","slug","origin","createdVia","createdViaAuditId","account","status","runs","failures","failureRate","creditsSpent","lastRunAt"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgents","description":"Agent roster: cursor-paginated account_agent list with window-scoped run / failure / credit counts."}},"/v1/admin/agents/{agentId}":{"get":{"tags":["Admin"],"summary":"One agent: summary, model + fallbacks, failure profile, tool inventory, recent runs, and (first_party only) the account proposal funnel + the agents Zero spawned.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"agentId","in":"path"},{"schema":{"type":"string","enum":["24h","7d","30d","90d"],"default":"7d"},"required":false,"name":"window","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]},"createdVia":{"type":"string","enum":["human","zero","template","api"]},"createdViaAuditId":{"type":["string","null"]},"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}},"required":["id","slug"]},"status":{"type":"string"},"runs":{"type":"number"},"failures":{"type":"number"},"failureRate":{"type":"number"},"creditsSpent":{"type":"number"},"lastRunAt":{"type":["string","null"]}},"required":["id","name","slug","origin","createdVia","createdViaAuditId","account","status","runs","failures","failureRate","creditsSpent","lastRunAt"]},"model":{"type":"object","properties":{"slug":{"type":["string","null"]},"fallbacks":{"type":"array","items":{"type":"string"}}},"required":["slug","fallbacks"]},"failureProfile":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]},"count":{"type":"number"}},"required":["kind","count"]}},"tools":{"type":"array","items":{"type":"object","properties":{"toolName":{"type":"string"},"source":{"type":["string","null"]},"invocations":{"type":"number"},"failures":{"type":"number"},"successRate":{"type":"number"},"lastUsedAt":{"type":["string","null"]}},"required":["toolName","source","invocations","failures","successRate","lastUsedAt"]}},"runs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"started":{"type":"string"},"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}},"required":["id","slug"]},"agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]}},"required":["id","name","origin"]},"trigger":{"type":"object","properties":{"kind":{"type":"string","enum":["manual","rest","cron","webhook","a2a","mcp","agent","telegram","email","slack"]},"byKind":{"type":"string"},"byId":{"type":"string"}},"required":["kind","byKind","byId"]},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"durationMs":{"type":["number","null"]},"costMicrousd":{"type":"number"},"costCredits":{"type":"number"},"failureKind":{"type":["string","null"],"enum":["model_call_failed","model_finished_in_error","run_timeout","budget_blocked","hop_budget_exceeded","payment_required","permission_denied","skill_invoke_failed","integration_call_failed","tool_call_failed","zero_action_failed","zero_action_unconfirmed","unclassified"]}},"required":["id","started","account","agent","trigger","status","durationMs","costMicrousd","costCredits","failureKind"]}},"proposalFunnel":{"type":["object","null"],"properties":{"window":{"type":"string","enum":["24h","7d","30d","90d"]},"total":{"type":"object","properties":{"action":{"type":"string"},"proposed":{"type":"number"},"applied":{"type":"number"},"failed":{"type":"number"},"dismissed":{"type":"number"},"unconfirmed":{"type":"number"},"oldestUnconfirmedMs":{"type":["number","null"]}},"required":["action","proposed","applied","failed","dismissed","unconfirmed","oldestUnconfirmedMs"]},"byAction":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"proposed":{"type":"number"},"applied":{"type":"number"},"failed":{"type":"number"},"dismissed":{"type":"number"},"unconfirmed":{"type":"number"},"oldestUnconfirmedMs":{"type":["number","null"]}},"required":["action","proposed","applied","failed","dismissed","unconfirmed","oldestUnconfirmedMs"]}}},"required":["window","total","byAction"]},"spawnedAgents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"origin":{"type":"string","enum":["user","first_party"]},"createdVia":{"type":"string","enum":["human","zero","template","api"]},"createdViaAuditId":{"type":["string","null"]},"account":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"}},"required":["id","slug"]},"status":{"type":"string"},"runs":{"type":"number"},"failures":{"type":"number"},"failureRate":{"type":"number"},"creditsSpent":{"type":"number"},"lastRunAt":{"type":["string","null"]}},"required":["id","name","slug","origin","createdVia","createdViaAuditId","account","status","runs","failures","failureRate","creditsSpent","lastRunAt"]}}},"required":["agent","model","failureProfile","tools","runs","proposalFunnel","spawnedAgents"]}}}},"400":{"description":"invalid query / body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"404":{"description":"agent_not_found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"429":{"description":"rate_limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"remedy":{"type":"string"},"retryable":{"type":"string","enum":["never","after","with_changes"]}},"required":["code","message"]}},"required":["error"]}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentsByAgentId","description":"One agent: summary, model + fallbacks, failure profile, tool inventory, recent runs, and (first_party only) the account proposal funnel + the agents Zero spawned."}},"/v1/admin/agent-templates":{"get":{"tags":["Admin"],"summary":"List agent templates (includes archived).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"is_proxy":{"type":"boolean"},"system_prompt":{"type":["string","null"]},"skill_fqns":{"type":"array","items":{"type":"string"}},"icon":{"type":["string","null"]},"invocation_channel":{"type":["string","null"],"enum":["manual","cron","webhook","mcp","email","slack","telegram"]},"required_connectors":{"type":"array","items":{"type":"string"}},"sample_input":{"type":["object","null"],"additionalProperties":{}},"sample_knowledge":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]}},"required":["id","slug","display_name","description","category","is_proxy","system_prompt","skill_fqns","icon","invocation_channel","required_connectors","sample_input","sample_knowledge","created_at","updated_at","archived_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAgentTemplates","description":"List agent templates (includes archived)."},"post":{"tags":["Admin"],"summary":"Create an agent template.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"is_proxy":{"type":"boolean"},"system_prompt":{"type":["string","null"]},"skill_fqns":{"type":"array","items":{"type":"string"}},"icon":{"type":["string","null"]},"invocation_channel":{"type":["string","null"],"enum":["manual","cron","webhook","mcp","email","slack","telegram"]},"required_connectors":{"type":"array","items":{"type":"string"}},"sample_input":{"type":["object","null"],"additionalProperties":{}},"sample_knowledge":{"type":["string","null"]}},"required":["slug","display_name"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"is_proxy":{"type":"boolean"},"system_prompt":{"type":["string","null"]},"skill_fqns":{"type":"array","items":{"type":"string"}},"icon":{"type":["string","null"]},"invocation_channel":{"type":["string","null"],"enum":["manual","cron","webhook","mcp","email","slack","telegram"]},"required_connectors":{"type":"array","items":{"type":"string"}},"sample_input":{"type":["object","null"],"additionalProperties":{}},"sample_knowledge":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]}},"required":["id","slug","display_name","description","category","is_proxy","system_prompt","skill_fqns","icon","invocation_channel","required_connectors","sample_input","sample_knowledge","created_at","updated_at","archived_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAgentTemplates","description":"Create an agent template."}},"/v1/admin/agent-templates/{slug}":{"patch":{"tags":["Admin"],"summary":"Update an agent template.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"is_proxy":{"type":"boolean"},"system_prompt":{"type":["string","null"]},"skill_fqns":{"type":"array","items":{"type":"string"}},"icon":{"type":["string","null"]},"invocation_channel":{"type":["string","null"],"enum":["manual","cron","webhook","mcp","email","slack","telegram"]},"required_connectors":{"type":"array","items":{"type":"string"}},"sample_input":{"type":["object","null"],"additionalProperties":{}},"sample_knowledge":{"type":["string","null"]}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"},"is_proxy":{"type":"boolean"},"system_prompt":{"type":["string","null"]},"skill_fqns":{"type":"array","items":{"type":"string"}},"icon":{"type":["string","null"]},"invocation_channel":{"type":["string","null"],"enum":["manual","cron","webhook","mcp","email","slack","telegram"]},"required_connectors":{"type":"array","items":{"type":"string"}},"sample_input":{"type":["object","null"],"additionalProperties":{}},"sample_knowledge":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]}},"required":["id","slug","display_name","description","category","is_proxy","system_prompt","skill_fqns","icon","invocation_channel","required_connectors","sample_input","sample_knowledge","created_at","updated_at","archived_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminAgentTemplatesBySlug","description":"Update an agent template."},"delete":{"tags":["Admin"],"summary":"Archive an agent template (soft-delete).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"204":{"description":"archived"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminAgentTemplatesBySlug","description":"Archive an agent template (soft-delete)."}},"/v1/admin/personas":{"get":{"tags":["Admin"],"summary":"List the platform-shipped built-in personas.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":["string","null"]},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"archetype":{"type":"string"},"warmth":{"type":"number"},"formality":{"type":"number"},"conciseness":{"type":"number"},"energy":{"type":"number"},"precision":{"type":"number"},"voice":{"type":"object","properties":{"register":{"type":"string","enum":["professional","casual","playful","clinical"]},"pronouns":{"type":"string","enum":["i","we","one","you-the-user"]},"signature_phrases":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":10},"taboo_phrases":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":10},"opening_patterns":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5},"closing_patterns":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5}},"additionalProperties":false},"rendered_blocks":{"type":"object","additionalProperties":{"type":"string"}},"is_featured":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","account_id","slug","display_name","description","archetype","warmth","formality","conciseness","energy","precision","voice","rendered_blocks","is_featured","created_at","updated_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPersonas","description":"List the platform-shipped built-in personas."}},"/v1/admin/personas/{id}":{"patch":{"tags":["Admin"],"summary":"Edit a built-in persona (dimensions / voice / copy).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","minLength":1,"maxLength":500},"warmth":{"type":"number","minimum":0,"maximum":1},"formality":{"type":"number","minimum":0,"maximum":1},"conciseness":{"type":"number","minimum":0,"maximum":1},"energy":{"type":"number","minimum":0,"maximum":1},"precision":{"type":"number","minimum":0,"maximum":1},"voice":{"type":"object","properties":{"register":{"type":"string","enum":["professional","casual","playful","clinical"]},"pronouns":{"type":"string","enum":["i","we","one","you-the-user"]},"signature_phrases":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":10},"taboo_phrases":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":10},"opening_patterns":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5},"closing_patterns":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5}},"additionalProperties":false},"is_featured":{"type":"boolean"}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":["string","null"]},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"archetype":{"type":"string"},"warmth":{"type":"number"},"formality":{"type":"number"},"conciseness":{"type":"number"},"energy":{"type":"number"},"precision":{"type":"number"},"voice":{"type":"object","properties":{"register":{"type":"string","enum":["professional","casual","playful","clinical"]},"pronouns":{"type":"string","enum":["i","we","one","you-the-user"]},"signature_phrases":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":10},"taboo_phrases":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":10},"opening_patterns":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5},"closing_patterns":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5}},"additionalProperties":false},"rendered_blocks":{"type":"object","additionalProperties":{"type":"string"}},"is_featured":{"type":"boolean"},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","account_id","slug","display_name","description","archetype","warmth","formality","conciseness","energy","precision","voice","rendered_blocks","is_featured","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminPersonasById","description":"Edit a built-in persona (dimensions / voice / copy)."}},"/v1/admin/accounts/{accountId}/memory/redact":{"post":{"tags":["Admin"],"summary":"Redact memories in an account by criteria (spec 57 §8.5 incident response).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"criteria":{"type":"object","properties":{"entity":{"type":"string","minLength":1,"maxLength":200},"text_match":{"type":"string","minLength":1,"maxLength":500},"kind":{"type":"string","enum":["fact","preference","skill","prompt","agent_config"]},"provenance_tier":{"type":"string","enum":["user_message","agent_assertion","tool_output"]}}}},"required":["criteria"],"additionalProperties":false}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"redacted_count":{"type":"number"},"memory_ids":{"type":"array","items":{"type":"string"}}},"required":["redacted_count","memory_ids"]}}}},"404":{"description":"account_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccountsByAccountIdMemoryRedact","description":"Redact memories in an account by criteria (spec 57 §8.5 incident response)."}},"/v1/admin/accounts/{accountId}/memory/suggestions":{"get":{"tags":["Admin"],"summary":"Pending memory suggestions for an account (spec 57 phase B admin view).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"proposed_scope_kind":{"type":"string","enum":["account","user","agent"]},"proposed_scope_id":{"type":["string","null"]},"proposed_kind":{"type":"string"},"proposed_content":{"type":"string"},"proposed_entities":{"type":"object","additionalProperties":{}},"status":{"type":"string"},"approved_memory_id":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["id","account_id","agent_id","proposed_scope_kind","proposed_scope_id","proposed_kind","proposed_content","proposed_entities","status","approved_memory_id","created_at"]}}},"required":["items"]}}}},"404":{"description":"account_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsByAccountIdMemorySuggestions","description":"Pending memory suggestions for an account (spec 57 phase B admin view)."}},"/v1/admin/accounts/{accountId}/memory/audit":{"get":{"tags":["Admin"],"summary":"Paged memory_audit browser for an account (spec 57 phase B admin view).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"},{"schema":{"type":"string","enum":["add","update","delete","noop","promoted_from_run","flushed_by_retention","redacted_by_admin","reverted"]},"required":false,"name":"action","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":["integer","null"],"minimum":0,"default":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"memory_id":{"type":["string","null"]},"account_id":{"type":"string"},"action":{"type":"string","enum":["add","update","delete","noop","promoted_from_run","flushed_by_retention","redacted_by_admin","reverted"]},"actor_kind":{"type":"string"},"actor_id":{"type":["string","null"]},"snapshot":{"type":"object","additionalProperties":{}},"occurred_at":{"type":"string"}},"required":["id","memory_id","account_id","action","actor_kind","actor_id","snapshot","occurred_at"]}}},"required":["items"]}}}},"404":{"description":"account_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsByAccountIdMemoryAudit","description":"Paged memory_audit browser for an account (spec 57 phase B admin view)."}},"/v1/admin/accounts/{accountId}/learning/suggestions":{"get":{"tags":["Admin"],"summary":"Pending learning suggestions for an account, all kinds (spec 61 phase D admin view).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"accountId","in":"path"},{"schema":{"type":"string","enum":["memory","skill","prompt","agent_config"]},"required":false,"name":"kind","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"kind":{"type":"string","enum":["memory","skill","prompt","agent_config"]},"payload":{"type":"object","additionalProperties":{}},"proposed_scope_kind":{"type":"string","enum":["account","user","agent"]},"proposed_scope_id":{"type":["string","null"]},"proposed_kind":{"type":"string"},"proposed_content":{"type":"string"},"proposed_entities":{"type":"object","additionalProperties":{}},"status":{"type":"string"},"approved_memory_id":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["id","account_id","agent_id","kind","payload","proposed_scope_kind","proposed_scope_id","proposed_kind","proposed_content","proposed_entities","status","approved_memory_id","created_at"]}}},"required":["items"]}}}},"404":{"description":"account_not_found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsByAccountIdLearningSuggestions","description":"Pending learning suggestions for an account, all kinds (spec 61 phase D admin view)."}},"/v1/admin/platform-keys":{"get":{"tags":["Admin"],"summary":"List platform keys (operator scope).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"label":{"type":"string"},"last_four":{"type":"string"},"key_fingerprint":{"type":["string","null"]},"active":{"type":"boolean"},"priority":{"type":"number"},"description":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"revoked_reason":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"spend_30d_microusd":{"type":"number"},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"},"rotated_from_key_id":{"type":["string","null"]}},"required":["id","provider","label","last_four","key_fingerprint","active","priority","description","revoked_at","revoked_reason","last_used_at","spend_30d_microusd","created_at","created_by_user_id","rotated_from_key_id"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPlatformKeys","description":"List platform keys (operator scope)."},"post":{"tags":["Admin"],"summary":"Create a platform key. KMS-wraps the secret before persist.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"secret":{"type":"string","minLength":8},"priority":{"type":"integer","minimum":0},"description":{"type":"string"},"active":{"type":"boolean"},"rotated_from_key_id":{"type":"string","format":"uuid"}},"required":["provider","label","secret"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"label":{"type":"string"},"last_four":{"type":"string"},"key_fingerprint":{"type":["string","null"]},"active":{"type":"boolean"},"priority":{"type":"number"},"description":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"revoked_reason":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"spend_30d_microusd":{"type":"number"},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"},"rotated_from_key_id":{"type":["string","null"]}},"required":["id","provider","label","last_four","key_fingerprint","active","priority","description","revoked_at","revoked_reason","last_used_at","spend_30d_microusd","created_at","created_by_user_id","rotated_from_key_id"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPlatformKeys","description":"Create a platform key. KMS-wraps the secret before persist."}},"/v1/admin/platform-keys/{id}":{"get":{"tags":["Admin"],"summary":"Get a single platform key.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"label":{"type":"string"},"last_four":{"type":"string"},"key_fingerprint":{"type":["string","null"]},"active":{"type":"boolean"},"priority":{"type":"number"},"description":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"revoked_reason":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"spend_30d_microusd":{"type":"number"},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"},"rotated_from_key_id":{"type":["string","null"]}},"required":["id","provider","label","last_four","key_fingerprint","active","priority","description","revoked_at","revoked_reason","last_used_at","spend_30d_microusd","created_at","created_by_user_id","rotated_from_key_id"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPlatformKeysById","description":"Get a single platform key."},"delete":{"tags":["Admin"],"summary":"Delete a revoked platform key. Audit history survives via ON DELETE SET NULL.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminPlatformKeysById","description":"Delete a revoked platform key. Audit history survives via ON DELETE SET NULL."}},"/v1/admin/platform-keys/{id}/activate":{"post":{"tags":["Admin"],"summary":"Mark this key active. Spec 54 §5.2 — atomic swap when deactivate_others.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"deactivate_others":{"type":"boolean"}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"label":{"type":"string"},"last_four":{"type":"string"},"key_fingerprint":{"type":["string","null"]},"active":{"type":"boolean"},"priority":{"type":"number"},"description":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"revoked_reason":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"spend_30d_microusd":{"type":"number"},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"},"rotated_from_key_id":{"type":["string","null"]}},"required":["id","provider","label","last_four","key_fingerprint","active","priority","description","revoked_at","revoked_reason","last_used_at","spend_30d_microusd","created_at","created_by_user_id","rotated_from_key_id"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPlatformKeysByIdActivate","description":"Mark this key active. Spec 54 §5.2 — atomic swap when deactivate_others."}},"/v1/admin/platform-keys/{id}/deactivate":{"post":{"tags":["Admin"],"summary":"Mark this key inactive (standby).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"label":{"type":"string"},"last_four":{"type":"string"},"key_fingerprint":{"type":["string","null"]},"active":{"type":"boolean"},"priority":{"type":"number"},"description":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"revoked_reason":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"spend_30d_microusd":{"type":"number"},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"},"rotated_from_key_id":{"type":["string","null"]}},"required":["id","provider","label","last_four","key_fingerprint","active","priority","description","revoked_at","revoked_reason","last_used_at","spend_30d_microusd","created_at","created_by_user_id","rotated_from_key_id"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPlatformKeysByIdDeactivate","description":"Mark this key inactive (standby)."}},"/v1/admin/platform-keys/{id}/revoke":{"post":{"tags":["Admin"],"summary":"Permanently revoke this key. Resolver filters it out.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1}},"required":["reason"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"label":{"type":"string"},"last_four":{"type":"string"},"key_fingerprint":{"type":["string","null"]},"active":{"type":"boolean"},"priority":{"type":"number"},"description":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"revoked_reason":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"spend_30d_microusd":{"type":"number"},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"},"rotated_from_key_id":{"type":["string","null"]}},"required":["id","provider","label","last_four","key_fingerprint","active","priority","description","revoked_at","revoked_reason","last_used_at","spend_30d_microusd","created_at","created_by_user_id","rotated_from_key_id"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPlatformKeysByIdRevoke","description":"Permanently revoke this key. Resolver filters it out."}},"/v1/admin/platform-keys/{id}/audit":{"get":{"tags":["Admin"],"summary":"List platform_key_audit rows for this key.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string"},"actor_kind":{"type":"string"},"actor_id":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{}},"occurred_at":{"type":"string"}},"required":["id","action","actor_kind","actor_id","metadata","occurred_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminPlatformKeysByIdAudit","description":"List platform_key_audit rows for this key."}},"/v1/admin/platform-keys/cache/flush":{"post":{"tags":["Admin"],"summary":"Spec 54 §5.1 — flush every L1 + L2 cached platform key.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"l1_cleared":{"type":"number"},"l2_deleted":{"type":"number"}},"required":["l1_cleared","l2_deleted"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminPlatformKeysCacheFlush","description":"Spec 54 §5.1 — flush every L1 + L2 cached platform key."}},"/v1/admin/provider-health":{"get":{"tags":["Admin"],"summary":"Provider health dashboard payload (spec 55 §7).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"keys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"last_four":{"type":"string"},"status":{"type":"string"},"active":{"type":"boolean"},"revoked_at":{"type":["string","null"]},"quota_exhausted_at":{"type":["string","null"]},"rate_limited_until":{"type":["string","null"]},"last_used_at":{"type":["string","null"]}},"required":["id","label","last_four","status","active","revoked_at","quota_exhausted_at","rate_limited_until","last_used_at"]}},"subscription":{"type":["object","null"],"properties":{"provider":{"type":"string"},"endpoint_url":{"type":"string"},"signing_scheme":{"type":"string"},"configured_at":{"type":"string"},"last_event_at":{"type":["string","null"]},"health_status":{"type":"string"},"hours_since_last_event":{"type":["number","null"]}},"required":["provider","endpoint_url","signing_scheme","configured_at","last_event_at","health_status","hours_since_last_event"]}},"required":["provider","keys","subscription"]}},"events_24h":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"key_id":{"type":["string","null"]},"key_last_four":{"type":["string","null"]},"source":{"type":"string"},"event_kind":{"type":"string"},"occurred_at":{"type":"string"}},"required":["id","provider","key_id","key_last_four","source","event_kind","occurred_at"]}}},"required":["providers","events_24h"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminProviderHealth","description":"Provider health dashboard payload (spec 55 §7)."}},"/v1/admin/access/dashboard":{"get":{"tags":["Admin"],"summary":"Access dashboard tiles + funnel + cohorts (spec 84 §9.1).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessDashboard","description":"Access dashboard tiles + funnel + cohorts (spec 84 §9.1)."}},"/v1/admin/access/policy":{"get":{"tags":["Admin"],"summary":"Read the signup policy (spec 84 §9.2).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessPolicy","description":"Read the signup policy (spec 84 §9.2)."},"patch":{"tags":["Admin"],"summary":"Update the signup policy knobs (audited) (spec 84 §9.2).","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["invite_required","waitlist_only","open"]},"daily_admission_cap":{"type":"integer","minimum":0},"fairness":{"type":"string","enum":["fifo","weighted_random"]},"default_user_allowance":{"type":"integer","minimum":0},"default_invitee_credits":{"type":"integer","minimum":0},"default_inviter_credits":{"type":"integer","minimum":0},"waitlist_boost_seconds":{"type":"integer","minimum":0},"daily_ip_redemption_limit":{"type":"integer","minimum":0}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AdminAccessPolicy","description":"Update the signup policy knobs (audited) (spec 84 §9.2)."}},"/v1/admin/access/codes":{"get":{"tags":["Admin"],"summary":"List/filter invite codes (spec 84 §9.3).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["user","operator","partner"]},"required":false,"name":"kind","in":"query"},{"schema":{"type":"string"},"required":false,"name":"campaign","in":"query"},{"schema":{"type":"string","enum":["live","disabled","expired"]},"required":false,"name":"state","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessCodes","description":"List/filter invite codes (spec 84 §9.3)."},"post":{"tags":["Admin"],"summary":"Mint a batch of operator/partner codes (spec 84 §9.3).","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","minimum":1,"maximum":1000},"kind":{"type":"string","enum":["operator","partner"]},"max_uses":{"type":"integer","minimum":1},"invitee_credits":{"type":"integer","minimum":0},"inviter_credits":{"type":"integer","minimum":0},"campaign":{"type":["string","null"],"maxLength":120},"expires_at":{"type":["string","null"],"format":"date-time"},"note":{"type":["string","null"],"maxLength":500}},"required":["count"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessCodes","description":"Mint a batch of operator/partner codes (spec 84 §9.3)."}},"/v1/admin/access/codes/{id}":{"get":{"tags":["Admin"],"summary":"Invite code detail + redemptions (spec 84 §9.3).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessCodesById","description":"Invite code detail + redemptions (spec 84 §9.3)."}},"/v1/admin/access/codes/{id}/disable":{"post":{"tags":["Admin"],"summary":"Soft-revoke an invite code (spec 84 §9.3).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessCodesByIdDisable","description":"Soft-revoke an invite code (spec 84 §9.3)."}},"/v1/admin/access/waitlist":{"get":{"tags":["Admin"],"summary":"List waitlist entries (spec 84 §9.4).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["waiting","invited","converted","suppressed"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessWaitlist","description":"List waitlist entries (spec 84 §9.4)."}},"/v1/admin/access/waitlist/admit":{"post":{"tags":["Admin"],"summary":"Admit the next N waiting entries honouring cap + fairness (spec 84 §9.4).","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"integer","minimum":1,"maximum":500}},"required":["n"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessWaitlistAdmit","description":"Admit the next N waiting entries honouring cap + fairness (spec 84 §9.4)."}},"/v1/admin/access/waitlist/{id}/boost":{"post":{"tags":["Admin"],"summary":"Boost an entry up the queue (spec 84 §9.4).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"units":{"type":"integer","minimum":1,"maximum":365}},"required":["units"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessWaitlistByIdBoost","description":"Boost an entry up the queue (spec 84 §9.4)."}},"/v1/admin/access/waitlist/{id}/suppress":{"post":{"tags":["Admin"],"summary":"Suppress an entry (spec 84 §9.4).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":200,"default":"operator"}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessWaitlistByIdSuppress","description":"Suppress an entry (spec 84 §9.4)."}},"/v1/admin/access/allowances":{"get":{"tags":["Admin"],"summary":"Per-user invite allowances (spec 84 §9.5).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessAllowances","description":"Per-user invite allowances (spec 84 §9.5)."}},"/v1/admin/access/allowances/wave":{"post":{"tags":["Admin"],"summary":"Invite wave: bump every member allowance by delta (spec 84 §9.5).","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"delta":{"type":"integer"},"note":{"type":["string","null"],"maxLength":500}},"required":["delta"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessAllowancesWave","description":"Invite wave: bump every member allowance by delta (spec 84 §9.5)."}},"/v1/admin/access/allowances/{userId}":{"post":{"tags":["Admin"],"summary":"Set one user’s lifetime allowance (spec 84 §9.5).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"total_granted":{"type":"integer","minimum":0},"note":{"type":["string","null"],"maxLength":500}},"required":["total_granted"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessAllowancesByUserId","description":"Set one user’s lifetime allowance (spec 84 §9.5)."}},"/v1/admin/access/fraud":{"get":{"tags":["Admin"],"summary":"Fraud review queue + star-graph report (spec 84 §9.6).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessFraud","description":"Fraud review queue + star-graph report (spec 84 §9.6)."}},"/v1/admin/access/fraud/{redemptionId}/approve":{"post":{"tags":["Admin"],"summary":"Approve a flagged redemption; release held inviter reward (spec 84 §9.6).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"redemptionId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessFraudByRedemptionIdApprove","description":"Approve a flagged redemption; release held inviter reward (spec 84 §9.6)."}},"/v1/admin/access/fraud/{redemptionId}/reject":{"post":{"tags":["Admin"],"summary":"Reject a flagged redemption; void grants + disable issuer codes (spec 84 §9.6).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"redemptionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccessFraudByRedemptionIdReject","description":"Reject a flagged redemption; void grants + disable issuer codes (spec 84 §9.6)."}},"/v1/admin/access/cohorts":{"get":{"tags":["Admin"],"summary":"Channel cohorts + K-factor (spec 84 §9.7).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccessCohorts","description":"Channel cohorts + K-factor (spec 84 §9.7)."}},"/v1/admin/finance/accounts":{"get":{"tags":["Admin Finance"],"summary":"Search/filter accounts with balance + MTD + margin (spec 85 §5).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminFinanceAccounts","description":"Search/filter accounts with balance + MTD + margin (spec 85 §5)."}},"/v1/admin/finance/snapshot":{"get":{"tags":["Admin Finance"],"summary":"Platform financial-health snapshot + trend + margin leaderboard (spec 85 §6).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":120,"default":30},"required":false,"name":"trend_days","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminFinanceSnapshot","description":"Platform financial-health snapshot + trend + margin leaderboard (spec 85 §6)."}},"/v1/admin/finance/master":{"get":{"tags":["Admin Finance"],"summary":"Master accounting sheet — per-model economics + daily/monthly rollups incl. credit reloads.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":365,"default":30},"required":false,"name":"since_days","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminFinanceMaster","description":"Master accounting sheet — per-model economics + daily/monthly rollups incl. credit reloads."}},"/v1/admin/accounts/{slug}/accounting":{"get":{"tags":["Admin Finance"],"summary":"Per-account credit ledger + consumption + P&L + summary (spec 85 §7).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":365,"default":30},"required":false,"name":"since_days","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsBySlugAccounting","description":"Per-account credit ledger + consumption + P&L + summary (spec 85 §7)."}},"/v1/admin/accounts/{slug}/credits/transfer":{"post":{"tags":["Admin Finance"],"summary":"Transfer credits from this account to another (operator; expiry-preserving; idempotent).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to_slug":{"type":"string","minLength":1},"credits":{"type":"integer","exclusiveMinimum":0},"transfer_id":{"type":"string","format":"uuid"},"reason_internal":{"type":"string","minLength":10,"maxLength":500}},"required":["to_slug","credits","transfer_id","reason_internal"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccountsBySlugCreditsTransfer","description":"Transfer credits from this account to another (operator; expiry-preserving; idempotent)."}},"/v1/admin/blocks":{"get":{"tags":["Admin"],"summary":"Block catalog: manifests, enabled-account counts, price-row completeness, 30-day usage.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":["string","null"]},"summary":{"type":"string"},"description":{"type":["string","null"]},"docsUrl":{"type":["string","null"]},"dashboardPath":{"type":["string","null"]},"mcpToolPrefix":{"type":"string"},"entitlementFeature":{"type":"string"},"enabledAccounts":{"type":"number"},"operations":{"type":"number"},"priceRows":{"type":"object","properties":{"total":{"type":"number"},"priced":{"type":"number"}},"required":["total","priced"]},"usage30d":{"type":"object","properties":{"calls":{"type":"number"},"credits":{"type":"number"},"storageBytes":{"type":"number"}},"required":["calls","credits","storageBytes"]},"sparkline":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"value":{"type":"number"}},"required":["day","value"]}}},"required":["name","version","summary","description","docsUrl","dashboardPath","mcpToolPrefix","entitlementFeature","enabledAccounts","operations","priceRows","usage30d","sparkline"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminBlocks","description":"Block catalog: manifests, enabled-account counts, price-row completeness, 30-day usage."}},"/v1/admin/blocks/{name}":{"get":{"tags":["Admin"],"summary":"Block manifest + operations with current price + price-row status.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[a-z]([a-z0-9-]{0,62}[a-z0-9])?$"},"required":true,"name":"name","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":["string","null"]},"summary":{"type":"string"},"description":{"type":["string","null"]},"docsUrl":{"type":["string","null"]},"dashboardPath":{"type":["string","null"]},"restBasePath":{"type":"string"},"mcpToolPrefix":{"type":"string"},"entitlementFeature":{"type":"string"},"enabledAccounts":{"type":"number"},"operations":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"weightClass":{"type":"string"},"mode":{"type":"string"},"variant":{"type":"string"},"rateMicrousd":{"type":["number","null"]},"credits":{"type":["number","null"]},"priced":{"type":"boolean"}},"required":["name","weightClass","mode","variant","rateMicrousd","credits","priced"]}},"storage":{"type":["object","null"],"properties":{"variant":{"type":"string"},"unit":{"type":"string"},"rateMicrousd":{"type":"number"},"credits":{"type":"number"}},"required":["variant","unit","rateMicrousd","credits"]},"priceRows":{"type":"object","properties":{"total":{"type":"number"},"priced":{"type":"number"}},"required":["total","priced"]},"pricebookSlug":{"type":"string"}},"required":["name","version","summary","description","docsUrl","dashboardPath","restBasePath","mcpToolPrefix","entitlementFeature","enabledAccounts","operations","storage","priceRows","pricebookSlug"]}}}},"404":{"description":"block_unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminBlocksByName","description":"Block manifest + operations with current price + price-row status."}},"/v1/admin/blocks/{name}/accounts":{"get":{"tags":["Admin"],"summary":"Every account with this block’s state, plan and 30-day usage (cursor-paginated).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[a-z]([a-z0-9-]{0,62}[a-z0-9])?$"},"required":true,"name":"name","in":"path"},{"schema":{"type":"string","enum":["enabled","disabled","not_in_plan"]},"required":false,"name":"state","in":"query"},{"schema":{"type":"string"},"required":false,"name":"account","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"accountId":{"type":"string"},"accountSlug":{"type":"string"},"accountName":{"type":"string"},"plan":{"type":["string","null"]},"enabled":{"type":"boolean"},"inPlan":{"type":"boolean"},"enabledAt":{"type":["string","null"]},"enabledBy":{"type":["string","null"]},"enabledByEmail":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"usage30d":{"type":"object","properties":{"calls":{"type":"number"},"credits":{"type":"number"},"storageBytes":{"type":"number"}},"required":["calls","credits","storageBytes"]}},"required":["accountId","accountSlug","accountName","plan","enabled","inPlan","enabledAt","enabledBy","enabledByEmail","disabledAt","usage30d"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"404":{"description":"block_unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminBlocksByNameAccounts","description":"Every account with this block’s state, plan and 30-day usage (cursor-paginated)."}},"/v1/admin/blocks/{name}/usage":{"get":{"tags":["Admin"],"summary":"Daily calls / credits / storage across all accounts + top accounts by credits.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[a-z]([a-z0-9-]{0,62}[a-z0-9])?$"},"required":true,"name":"name","in":"path"},{"schema":{"type":"string","enum":["30d","90d"]},"required":false,"name":"window","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"string","enum":["30d","90d"]},"series":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"calls":{"type":"number"},"credits":{"type":"number"},"storageBytes":{"type":"number"}},"required":["day","calls","credits","storageBytes"]}},"topAccounts":{"type":"array","items":{"type":"object","properties":{"accountSlug":{"type":"string"},"accountName":{"type":"string"},"calls":{"type":"number"},"credits":{"type":"number"}},"required":["accountSlug","accountName","calls","credits"]}}},"required":["window","series","topAccounts"]}}}},"404":{"description":"block_unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminBlocksByNameUsage","description":"Daily calls / credits / storage across all accounts + top accounts by credits."}},"/v1/admin/blocks/{name}/audit":{"get":{"tags":["Admin"],"summary":"block.* and admin.block.* audit events for this block, newest first.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","pattern":"^[a-z]([a-z0-9-]{0,62}[a-z0-9])?$"},"required":true,"name":"name","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"account","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"at":{"type":"string"},"action":{"type":"string"},"accountSlug":{"type":["string","null"]},"actorEmail":{"type":["string","null"]},"reason":{"type":["string","null"]},"payload":{"type":"object","additionalProperties":{}}},"required":["id","at","action","accountSlug","actorEmail","reason","payload"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"404":{"description":"block_unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminBlocksByNameAudit","description":"block.* and admin.block.* audit events for this block, newest first."}},"/v1/admin/accounts/{slug}/blocks/{name}/enable":{"post":{"tags":["Admin"],"summary":"Force-enable a block for an account (bypasses plan gating; audited as admin.block.enable).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","pattern":"^[a-z]([a-z0-9-]{0,62}[a-z0-9])?$"},"required":true,"name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":10,"maxLength":1000}},"required":["reason"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"block_name":{"type":"string"},"account_id":{"type":"string","format":"uuid"},"enabled":{"type":"boolean"},"enabled_at":{"type":["string","null"],"format":"date-time"},"enabled_by":{"type":["string","null"],"format":"uuid"},"disabled_at":{"type":["string","null"],"format":"date-time"},"data_retained":{"type":"boolean","enum":[true]},"bypassed_plan":{"type":"boolean"},"audit_id":{"type":"string"}},"required":["block_name","account_id","enabled","enabled_at","enabled_by","disabled_at","data_retained","bypassed_plan","audit_id"]}}}},"400":{"description":"reason_too_short | block_not_enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"account_not_found | block_unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccountsBySlugBlocksByNameEnable","description":"Force-enable a block for an account (bypasses plan gating; audited as admin.block.enable)."}},"/v1/admin/accounts/{slug}/blocks/{name}/disable":{"post":{"tags":["Admin"],"summary":"Disable a block for an account (data retained; audited as admin.block.disable).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","pattern":"^[a-z]([a-z0-9-]{0,62}[a-z0-9])?$"},"required":true,"name":"name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":10,"maxLength":1000}},"required":["reason"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"block_name":{"type":"string"},"account_id":{"type":"string","format":"uuid"},"enabled":{"type":"boolean"},"enabled_at":{"type":["string","null"],"format":"date-time"},"enabled_by":{"type":["string","null"],"format":"uuid"},"disabled_at":{"type":["string","null"],"format":"date-time"},"data_retained":{"type":"boolean","enum":[true]},"bypassed_plan":{"type":"boolean"},"audit_id":{"type":"string"}},"required":["block_name","account_id","enabled","enabled_at","enabled_by","disabled_at","data_retained","bypassed_plan","audit_id"]}}}},"400":{"description":"reason_too_short | block_not_enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"account_not_found | block_unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminAccountsBySlugBlocksByNameDisable","description":"Disable a block for an account (data retained; audited as admin.block.disable)."}},"/v1/accounts/{accountSlug}/usage/forecast":{"get":{"tags":["Usage"],"summary":"Current-period cost forecast: spent by product, committed to period end, projected total with band, balance runway, upcoming events (CON-16).","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageForecast"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugUsageForecast","description":"Current-period cost forecast: spent by product, committed to period end, projected total with band, balance runway, upcoming events (CON-16)."}},"/v1/admin/accounts/{slug}/usage/forecast":{"get":{"tags":["Admin"],"summary":"Operator view of an account's current-period usage forecast (CON-16).","parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageForecast"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsBySlugUsageForecast","description":"Operator view of an account's current-period usage forecast (CON-16)."}},"/v1/admin/accounts/{slug}/notifications":{"get":{"tags":["Admin"],"summary":"Operator view of an account's wallet notification history (CON-17).","parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"sent_at":{"type":"string"},"cleared_at":{"type":["string","null"]},"recipients":{"type":"array","items":{"type":"string"}},"payload":{"type":"object","additionalProperties":{}}},"required":["id","kind","sent_at","cleared_at","recipients","payload"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsBySlugNotifications","description":"Operator view of an account's wallet notification history (CON-17)."}},"/v1/admin/connections":{"get":{"tags":["Admin"],"summary":"Cross-account connection list (operator triage).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"account_slug","in":"query"},{"schema":{"type":"string"},"required":false,"name":"kind","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["90d","no"]},"required":false,"name":"stale","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"account_slug":{"type":"string"},"account_name":{"type":"string"},"kind":{"type":"string"},"display_name":{"type":"string"},"external_account_id":{"type":"string"},"external_account_label":{"type":["string","null"]},"status":{"type":"string"},"status_detail":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"created_at":{"type":"string"},"dependent_instance_count":{"type":"number"}},"required":["id","account_id","account_slug","account_name","kind","display_name","external_account_id","external_account_label","status","status_detail","last_used_at","created_at","dependent_instance_count"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminConnections","description":"Cross-account connection list (operator triage)."}},"/v1/admin/accounts/{slug}/connections":{"get":{"tags":["Admin"],"summary":"Connections for a single account.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"account_slug":{"type":"string"},"account_name":{"type":"string"},"kind":{"type":"string"},"display_name":{"type":"string"},"external_account_id":{"type":"string"},"external_account_label":{"type":["string","null"]},"status":{"type":"string"},"status_detail":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"created_at":{"type":"string"},"dependent_instance_count":{"type":"number"}},"required":["id","account_id","account_slug","account_name","kind","display_name","external_account_id","external_account_label","status","status_detail","last_used_at","created_at","dependent_instance_count"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAccountsBySlugConnections","description":"Connections for a single account."}},"/v1/admin/connections/{id}":{"get":{"tags":["Admin"],"summary":"Connection detail (metadata + dependents + last 50 audit rows).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"account_slug":{"type":"string"},"account_name":{"type":"string"},"kind":{"type":"string"},"display_name":{"type":"string"},"external_account_id":{"type":"string"},"external_account_label":{"type":["string","null"]},"status":{"type":"string"},"status_detail":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"created_at":{"type":"string"},"dependent_instance_count":{"type":"number"},"metadata":{"type":"object","additionalProperties":{}},"kms_key_version":{"type":["string","null"]},"encrypted_secret_present":{"type":"boolean"},"operator_note":{"type":["string","null"]},"dependent_instances":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"project_slug":{"type":"string"},"mount_prefix":{"type":"string"},"status":{"type":"string"},"last_refresh_at":{"type":["string","null"]}},"required":["id","project_id","project_slug","mount_prefix","status","last_refresh_at"]}},"audit_tail":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"occurred_at":{"type":"string"},"event":{"type":"string"},"actor_role":{"type":"string","enum":["user","operator","system"]},"actor_user_id":{"type":["string","null"]},"reason_internal":{"type":["string","null"]},"reason_customer_facing":{"type":["string","null"]},"detail":{"type":"object","additionalProperties":{}}},"required":["id","occurred_at","event","actor_role","actor_user_id","reason_internal","reason_customer_facing","detail"]}}},"required":["id","account_id","account_slug","account_name","kind","display_name","external_account_id","external_account_label","status","status_detail","last_used_at","created_at","dependent_instance_count","metadata","kms_key_version","encrypted_secret_present","operator_note","dependent_instances","audit_tail"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminConnectionsById","description":"Connection detail (metadata + dependents + last 50 audit rows)."},"delete":{"tags":["Admin"],"summary":"Hard delete a connection (audit row written BEFORE the delete).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason_internal":{"type":"string","minLength":10,"maxLength":2000},"reason_customer_facing":{"type":["string","null"],"maxLength":2000}},"required":["reason_internal"]}}}},"responses":{"204":{"description":"deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminConnectionsById","description":"Hard delete a connection (audit row written BEFORE the delete)."}},"/v1/admin/connections/{id}/refresh-metadata":{"post":{"tags":["Admin"],"summary":"Operator-initiated metadata refresh (audit-only; provider call lands in phase A.1).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason_internal":{"type":"string","minLength":10,"maxLength":2000},"reason_customer_facing":{"type":["string","null"],"maxLength":2000}},"required":["reason_internal"]}}}},"responses":{"204":{"description":"queued"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminConnectionsByIdRefreshMetadata","description":"Operator-initiated metadata refresh (audit-only; provider call lands in phase A.1)."}},"/v1/admin/connections/{id}/re-mint":{"post":{"tags":["Admin"],"summary":"Operator-initiated re-mint (audit-only; provider call lands in phase A.1).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason_internal":{"type":"string","minLength":10,"maxLength":2000},"reason_customer_facing":{"type":["string","null"],"maxLength":2000}},"required":["reason_internal"]}}}},"responses":{"204":{"description":"queued"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminConnectionsByIdReMint","description":"Operator-initiated re-mint (audit-only; provider call lands in phase A.1)."}},"/v1/admin/connections/{id}/test":{"post":{"tags":["Admin"],"summary":"Connection health probe (derived from stored state; live provider round-trip lands in §4.3).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason_internal":{"type":"string","minLength":10,"maxLength":2000},"reason_customer_facing":{"type":["string","null"],"maxLength":2000}},"required":["reason_internal"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"probe":{"type":"string","enum":["derived"]},"connection_id":{"type":"string"},"status":{"type":"string"},"status_detail":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"encrypted_secret_present":{"type":"boolean"},"dependent_instance_count":{"type":"number"},"healthy":{"type":"boolean"},"checked_at":{"type":"string"}},"required":["probe","connection_id","status","status_detail","last_used_at","encrypted_secret_present","dependent_instance_count","healthy","checked_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminConnectionsByIdTest","description":"Connection health probe (derived from stored state; live provider round-trip lands in §4.3)."}},"/v1/admin/connections/{id}/mark-revoked":{"post":{"tags":["Admin"],"summary":"Flip status to revoked without provider-side delete.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason_internal":{"type":"string","minLength":10,"maxLength":2000},"reason_customer_facing":{"type":["string","null"],"maxLength":2000}},"required":["reason_internal"]}}}},"responses":{"204":{"description":"revoked"},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminConnectionsByIdMarkRevoked","description":"Flip status to revoked without provider-side delete."}},"/v1/admin/audit-log":{"get":{"tags":["Admin"],"summary":"Cross-source audit log (v1: connection_audit only).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["connection"]},"required":false,"name":"source","in":"query"},{"schema":{"type":"string"},"required":false,"name":"account_slug","in":"query"},{"schema":{"type":"string","enum":["1h","24h","7d","30d"]},"required":false,"name":"range","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string","enum":["connection"]},"occurred_at":{"type":"string"},"account_id":{"type":["string","null"]},"account_slug":{"type":["string","null"]},"event":{"type":"string"},"actor_role":{"type":"string","enum":["user","operator","system"]},"actor_user_id":{"type":["string","null"]},"reason_internal":{"type":["string","null"]},"reason_customer_facing":{"type":["string","null"]},"detail":{"type":"object","additionalProperties":{}}},"required":["id","source","occurred_at","account_id","account_slug","event","actor_role","actor_user_id","reason_internal","reason_customer_facing","detail"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminAuditLog","description":"Cross-source audit log (v1: connection_audit only)."}},"/v1/connectors":{"post":{"tags":["Connectors"],"summary":"Register a new connector instance for a project.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_slug":{"type":"string"},"project_slug":{"type":"string"},"connector_name":{"type":"string","minLength":1,"maxLength":64},"mount_prefix":{"type":"string"},"config":{"type":"object","additionalProperties":{},"default":{}},"connection_id":{"type":["string","null"],"format":"uuid"},"credentials_ref":{"type":["string","null"]},"refresh_policy":{"type":"object","additionalProperties":{},"default":{}}},"required":["account_slug","project_slug","connector_name","mount_prefix"]}}}},"responses":{"200":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"connector_name":{"type":"string"},"mount_prefix":{"type":"string"},"workspace_path":{"type":"string"},"config":{"type":"object","additionalProperties":{}},"credentials_ref":{"type":["string","null"]},"connection_id":{"type":["string","null"]},"status":{"type":"string","enum":["pending","ok","failed","stale"]},"last_refresh_at":{"type":["string","null"]},"last_refresh_summary":{"type":["object","null"],"additionalProperties":{}},"source_fingerprint":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","project_id","connector_name","mount_prefix","workspace_path","config","credentials_ref","connection_id","status","last_refresh_at","last_refresh_summary","source_fingerprint","created_at","updated_at"]}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"role insufficient or duplicate mount","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"apps/connectors unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1Connectors","description":"Register a new connector instance for a project."},"get":{"tags":["Connectors"],"summary":"List connector instances for a project.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"query"},{"schema":{"type":"string"},"required":true,"name":"project_slug","in":"query"}],"responses":{"200":{"description":"list","content":{"application/json":{"schema":{"type":"object","properties":{"connectors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"connector_name":{"type":"string"},"mount_prefix":{"type":"string"},"workspace_path":{"type":"string"},"config":{"type":"object","additionalProperties":{}},"credentials_ref":{"type":["string","null"]},"connection_id":{"type":["string","null"]},"status":{"type":"string","enum":["pending","ok","failed","stale"]},"last_refresh_at":{"type":["string","null"]},"last_refresh_summary":{"type":["object","null"],"additionalProperties":{}},"source_fingerprint":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","project_id","connector_name","mount_prefix","workspace_path","config","credentials_ref","connection_id","status","last_refresh_at","last_refresh_summary","source_fingerprint","created_at","updated_at"]}}},"required":["connectors"]}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"project not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"role insufficient","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"apps/connectors unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1Connectors","description":"List connector instances for a project."}},"/v1/accounts/{account_slug}/connections/{connection_id}/instances":{"get":{"tags":["Connectors"],"summary":"List connector instances bound to a given connection.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"connection_id","in":"path"}],"responses":{"200":{"description":"list","content":{"application/json":{"schema":{"type":"object","properties":{"instances":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"project_id":{"type":"string"},"connector_name":{"type":"string"},"mount_prefix":{"type":"string"},"workspace_path":{"type":"string"},"config":{"type":"object","additionalProperties":{}},"credentials_ref":{"type":["string","null"]},"connection_id":{"type":["string","null"]},"status":{"type":"string","enum":["pending","ok","failed","stale"]},"last_refresh_at":{"type":["string","null"]},"last_refresh_summary":{"type":["object","null"],"additionalProperties":{}},"source_fingerprint":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"project_slug":{"type":"string"},"project_name":{"type":"string"}},"required":["id","project_id","connector_name","mount_prefix","workspace_path","config","credentials_ref","connection_id","status","last_refresh_at","last_refresh_summary","source_fingerprint","created_at","updated_at","project_slug","project_name"]}}},"required":["instances"]}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"not a member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"account not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugConnectionsByConnectionIdInstances","description":"List connector instances bound to a given connection."}},"/v1/connectors/refresh":{"post":{"tags":["Connectors"],"summary":"Trigger a materialise run for one connector instance.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_slug":{"type":"string"},"project_slug":{"type":"string"},"mount_prefix":{"type":"string"}},"required":["account_slug","project_slug","mount_prefix"]}}}},"responses":{"200":{"description":"materialised","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"files_written":{"type":"number"},"bytes_written":{"type":"number"},"files_deleted":{"type":"number"},"source_fingerprint":{"type":"string"},"error":{"type":"string"}},"required":["ok","files_written","bytes_written","files_deleted"]}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"connector not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"role insufficient","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"apps/connectors unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1ConnectorsRefresh","description":"Trigger a materialise run for one connector instance."}},"/v1/connectors/remove":{"post":{"tags":["Connectors"],"summary":"Remove a connector instance + drop its R2 materialised view.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"account_slug":{"type":"string"},"project_slug":{"type":"string"},"mount_prefix":{"type":"string"}},"required":["account_slug","project_slug","mount_prefix"]}}}},"responses":{"200":{"description":"removed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"files_deleted":{"type":"number"}},"required":["ok","files_deleted"]}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"connector not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"role insufficient","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"apps/connectors unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1ConnectorsRemove","description":"Remove a connector instance + drop its R2 materialised view."}},"/v1/accounts/{account_slug}/connections":{"get":{"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}]},"required":false,"name":"effective_role","in":"query"}],"responses":{"200":{"description":"connection list","content":{"application/json":{"schema":{"type":"object","properties":{"connections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"kind":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"display_name":{"type":"string"},"external_account_id":{"type":"string"},"external_account_label":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["active","revoked","degraded","error"]},"status_detail":{"type":["string","null"]},"created_at":{"type":"string"},"last_used_at":{"type":["string","null"]},"effective_roles":{"type":"array","items":{"type":"string"}}},"required":["id","account_id","kind","display_name","external_account_id","external_account_label","metadata","status","status_detail","created_at","last_used_at","effective_roles"]}}},"required":["connections"]}}}},"401":{"description":"unauthenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"not a member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"account not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugConnections"}},"/v1/accounts/{account_slug}/connections/{id}":{"get":{"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"connection","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"kind":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"display_name":{"type":"string"},"external_account_id":{"type":"string"},"external_account_label":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["active","revoked","degraded","error"]},"status_detail":{"type":["string","null"]},"created_at":{"type":"string"},"last_used_at":{"type":["string","null"]}},"required":["id","account_id","kind","display_name","external_account_id","external_account_label","metadata","status","status_detail","created_at","last_used_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugConnectionsById"}},"/v1/connections/form-schema":{"get":{"parameters":[{"schema":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"required":true,"name":"kind","in":"query"}],"responses":{"200":{"description":"connection form schema (direct providers only)","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"400":{"description":"kind is not a direct-intake provider","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"provider not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1ConnectionsFormSchema"}},"/v1/accounts/{account_slug}/connections/start":{"post":{"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"return_url":{"type":"string","format":"uri"}},"required":["kind","return_url"]}}}},"responses":{"200":{"description":"authorization URL for the redirect intake","content":{"application/json":{"schema":{"type":"object","properties":{"authorization_url":{"type":"string","format":"uri"}},"required":["authorization_url"]}}}},"400":{"description":"kind is not redirect intake","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"provider not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugConnectionsStart"}},"/v1/accounts/{account_slug}/connections/test":{"post":{"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"payload":{"type":"object","additionalProperties":{"type":"string"}}},"required":["kind","payload"]}}}},"responses":{"200":{"description":"test result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"detail":{"type":"string"},"probe":{"type":"object","additionalProperties":{}}},"required":["ok"]}}}},"400":{"description":"kind is not direct intake","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"provider not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugConnectionsTest"}},"/v1/accounts/{account_slug}/connections/submit":{"post":{"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"display_name":{"type":"string","minLength":1,"maxLength":200},"payload":{"type":"object","additionalProperties":{"type":"string"}}},"required":["kind","display_name","payload"]}}}},"responses":{"200":{"description":"connection created","content":{"application/json":{"schema":{"type":"object","properties":{"connection_id":{"type":"string"},"status":{"type":"string"}},"required":["connection_id","status"]}}}},"400":{"description":"validation / test failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugConnectionsSubmit"}},"/v1/connections/{kind}/callback":{"get":{"parameters":[{"schema":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"required":true,"name":"kind","in":"path"},{"schema":{"type":"string","minLength":1},"required":false,"name":"state","in":"query"}],"responses":{"302":{"description":"redirect to return_url with ?connection_id + ?status"},"400":{"description":"state invalid / payload missing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"callback handler failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1ConnectionsByKindCallback"}},"/v1/connections/{id}/refresh-metadata":{"post":{"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"updated row","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"kind":{"type":"string","enum":["github","notion","google_drive","postgres","mysql"]},"display_name":{"type":"string"},"external_account_id":{"type":"string"},"external_account_label":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["active","revoked","degraded","error"]},"status_detail":{"type":["string","null"]},"created_at":{"type":"string"},"last_used_at":{"type":["string","null"]}},"required":["id","account_id","kind","display_name","external_account_id","external_account_label","metadata","status","status_detail","created_at","last_used_at"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1ConnectionsByIdRefreshMetadata"}},"/v1/connections/{id}":{"delete":{"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"deleted","content":{"application/json":{"schema":{"type":"object","properties":{"revoked_at":{"type":"string"},"dependent_instances":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"mount_prefix":{"type":"string"},"project_id":{"type":"string"},"status":{"type":"string"}},"required":["id","mount_prefix","project_id","status"]}}},"required":["revoked_at","dependent_instances"]}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1ConnectionsById"}},"/v1/accounts/{account_slug}/connections/nango/start":{"post":{"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"integration_slug":{"type":"string","minLength":1,"maxLength":120},"return_url":{"type":"string","format":"uri"}},"required":["integration_slug","return_url"]}}}},"responses":{"200":{"description":"connect session minted","content":{"application/json":{"schema":{"type":"object","properties":{"session_token":{"type":"string"},"expires_at":{"type":["string","null"]},"connect_link":{"type":["string","null"]},"state":{"type":"string"},"provider_config_key":{"type":"string"}},"required":["session_token","expires_at","connect_link","state","provider_config_key"]}}}},"400":{"description":"integration is not a nango_proxy provider","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"integration not allowed for this account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"integration not in catalog","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"nango error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"nango or state secret not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugConnectionsNangoStart"}},"/v1/accounts/{account_slug}/connections/nango/complete":{"post":{"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"state":{"type":"string","minLength":1},"connection_id":{"type":"string","minLength":1,"maxLength":255}},"required":["state","connection_id"]}}}},"responses":{"200":{"description":"connection created","content":{"application/json":{"schema":{"type":"object","properties":{"connection_id":{"type":"string"},"status":{"type":"string"}},"required":["connection_id","status"]}}}},"400":{"description":"state invalid / replay / connection not found in nango","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"state minted for a different account","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"502":{"description":"nango error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"nango or state secret not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugConnectionsNangoComplete"}},"/v1/accounts/{accountSlug}/agents/roster-stream":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"SSE event stream"},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"account not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"roster stream unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsRosterStream"}},"/v1/accounts/{account_slug}/agents":{"get":{"tags":["Agents"],"summary":"List agents installed on this account.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"avatar_url":{"type":["string","null"]},"client_id":{"type":["string","null"]},"status":{"type":"string","enum":["active","suspended","revoked"]},"installed_by_user_id":{"type":"string"},"installed_at":{"type":"string"},"last_authenticated_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"is_proxy":{"type":"boolean"}},"required":["id","account_id","slug","display_name","description","avatar_url","client_id","status","installed_by_user_id","installed_at","last_authenticated_at","revoked_at","is_proxy"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgents","description":"List agents installed on this account."},"post":{"tags":["Agents"],"summary":"Install a new agent. Returns the cleartext client_secret exactly once.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":2,"maxLength":40,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"display_name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":2000},"avatar_url":{"type":"string","maxLength":2000,"format":"uri"},"system_prompt":{"type":"string","maxLength":20000},"skill_ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":200},"is_proxy":{"type":"boolean"}},"required":["slug","display_name"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"avatar_url":{"type":["string","null"]},"client_id":{"type":["string","null"]},"status":{"type":"string","enum":["active","suspended","revoked"]},"installed_by_user_id":{"type":"string"},"installed_at":{"type":"string"},"last_authenticated_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"is_proxy":{"type":"boolean"},"client_secret":{"type":"string"}},"required":["id","account_id","slug","display_name","description","avatar_url","client_id","status","installed_by_user_id","installed_at","last_authenticated_at","revoked_at","is_proxy","client_secret"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgents","description":"Install a new agent. Returns the cleartext client_secret exactly once."}},"/v1/accounts/{account_slug}/agents/{id}":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"avatar_url":{"type":["string","null"]},"client_id":{"type":["string","null"]},"status":{"type":"string","enum":["active","suspended","revoked"]},"installed_by_user_id":{"type":"string"},"installed_at":{"type":"string"},"last_authenticated_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"is_proxy":{"type":"boolean"}},"required":["id","account_id","slug","display_name","description","avatar_url","client_id","status","installed_by_user_id","installed_at","last_authenticated_at","revoked_at","is_proxy"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsById"},"patch":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":["string","null"],"maxLength":2000},"avatar_url":{"type":["string","null"],"maxLength":2000,"format":"uri"},"status":{"type":"string","enum":["active","suspended"]},"a2a_enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"avatar_url":{"type":["string","null"]},"client_id":{"type":["string","null"]},"status":{"type":"string","enum":["active","suspended","revoked"]},"installed_by_user_id":{"type":"string"},"installed_at":{"type":"string"},"last_authenticated_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"is_proxy":{"type":"boolean"}},"required":["id","account_id","slug","display_name","description","avatar_url","client_id","status","installed_by_user_id","installed_at","last_authenticated_at","revoked_at","is_proxy"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AccountsByAccountSlugAgentsById"},"delete":{"tags":["Agents"],"summary":"Revoke the agent. One-way; the row stays for audit history.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"revoked"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugAgentsById","description":"Revoke the agent. One-way; the row stays for audit history."}},"/v1/accounts/{account_slug}/agents/{id}/rotate-secret":{"post":{"tags":["Agents"],"summary":"Mint a new client_secret. The prior secret becomes invalid immediately.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"avatar_url":{"type":["string","null"]},"client_id":{"type":["string","null"]},"status":{"type":"string","enum":["active","suspended","revoked"]},"installed_by_user_id":{"type":"string"},"installed_at":{"type":"string"},"last_authenticated_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"is_proxy":{"type":"boolean"},"client_secret":{"type":"string"}},"required":["id","account_id","slug","display_name","description","avatar_url","client_id","status","installed_by_user_id","installed_at","last_authenticated_at","revoked_at","is_proxy","client_secret"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgentsByIdRotateSecret","description":"Mint a new client_secret. The prior secret becomes invalid immediately."}},"/v1/accounts/{account_slug}/agents/{id}/credentials":{"get":{"tags":["Agents"],"summary":"List credentials attached to an agent.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"agent_id":{"type":"string"},"kind":{"type":"string","enum":["oauth_client","bearer_token"]},"label":{"type":"string"},"client_id":{"type":["string","null"]},"token_prefix":{"type":["string","null"]},"audiences":{"type":"array","items":{"type":"string","enum":["api","mcp"]}},"expires_at":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"}},"required":["id","agent_id","kind","label","client_id","token_prefix","audiences","expires_at","last_used_at","revoked_at","created_at","created_by_user_id"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdCredentials","description":"List credentials attached to an agent."},"post":{"tags":["Agents"],"summary":"Mint a new credential. Returns the cleartext secret exactly once.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["oauth_client","bearer_token"]},"label":{"type":"string","minLength":1,"maxLength":80},"audiences":{"type":"array","items":{"type":"string","enum":["api","mcp"]},"minItems":1,"maxItems":2},"expires_at":{"type":["string","null"],"format":"date-time"}},"required":["kind","label"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"agent_id":{"type":"string"},"kind":{"type":"string","enum":["oauth_client","bearer_token"]},"label":{"type":"string"},"client_id":{"type":["string","null"]},"token_prefix":{"type":["string","null"]},"audiences":{"type":"array","items":{"type":"string","enum":["api","mcp"]}},"expires_at":{"type":["string","null"]},"last_used_at":{"type":["string","null"]},"revoked_at":{"type":["string","null"]},"created_at":{"type":"string"},"created_by_user_id":{"type":"string"},"cleartext":{"type":"string"}},"required":["id","agent_id","kind","label","client_id","token_prefix","audiences","expires_at","last_used_at","revoked_at","created_at","created_by_user_id","cleartext"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgentsByIdCredentials","description":"Mint a new credential. Returns the cleartext secret exactly once."}},"/v1/accounts/{account_slug}/agents/{id}/credentials/{credential_id}":{"delete":{"tags":["Agents"],"summary":"Revoke a credential. Other credentials on the agent keep working.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"credential_id","in":"path"}],"responses":{"204":{"description":"revoked"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugAgentsByIdCredentialsByCredentialId","description":"Revoke a credential. Other credentials on the agent keep working."}},"/v1/accounts/{accountSlug}/agents/{id}/runs":{"post":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"thread_id":{"type":"string","format":"uuid"},"thread_title":{"type":"string","minLength":1,"maxLength":200},"trigger_kind":{"type":"string","enum":["manual","rest","cron","webhook","mcp","agent","telegram","email","slack","a2a"],"default":"manual"},"input":{"type":"object","additionalProperties":{},"default":{}},"project_id":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"queued","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"thread_id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"trigger_kind":{"type":"string","enum":["manual","rest","cron","webhook","mcp","agent","telegram","email","slack","a2a"]},"triggered_by_kind":{"type":"string","enum":["user","agent","system","cron","webhook"]},"triggered_by_id":{"type":"string"},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"input":{"type":"object","additionalProperties":{}},"output":{"type":["object","null"],"additionalProperties":{}},"error":{"type":["object","null"],"additionalProperties":{}},"cost_microusd":{"type":"number"},"started_at":{"type":["string","null"]},"finished_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","thread_id","account_id","agent_id","trigger_kind","triggered_by_kind","triggered_by_id","status","input","output","error","cost_microusd","started_at","finished_at","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgentsByIdRuns"},"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"anyOf":[{"type":"number"},{"type":"string"}]},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"thread_id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"trigger_kind":{"type":"string","enum":["manual","rest","cron","webhook","mcp","agent","telegram","email","slack","a2a"]},"triggered_by_kind":{"type":"string","enum":["user","agent","system","cron","webhook"]},"triggered_by_id":{"type":"string"},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"input":{"type":"object","additionalProperties":{}},"output":{"type":["object","null"],"additionalProperties":{}},"error":{"type":["object","null"],"additionalProperties":{}},"cost_microusd":{"type":"number"},"started_at":{"type":["string","null"]},"finished_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","thread_id","account_id","agent_id","trigger_kind","triggered_by_kind","triggered_by_id","status","input","output","error","cost_microusd","started_at","finished_at","created_at","updated_at"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdRuns"}},"/v1/accounts/{accountSlug}/agents/{id}/runs/{runId}":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"thread_id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"trigger_kind":{"type":"string","enum":["manual","rest","cron","webhook","mcp","agent","telegram","email","slack","a2a"]},"triggered_by_kind":{"type":"string","enum":["user","agent","system","cron","webhook"]},"triggered_by_id":{"type":"string"},"status":{"type":"string","enum":["queued","running","succeeded","failed","timeout","budget_blocked","cancelled","awaiting_input"]},"input":{"type":"object","additionalProperties":{}},"output":{"type":["object","null"],"additionalProperties":{}},"error":{"type":["object","null"],"additionalProperties":{}},"cost_microusd":{"type":"number"},"started_at":{"type":["string","null"]},"finished_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","thread_id","account_id","agent_id","trigger_kind","triggered_by_kind","triggered_by_id","status","input","output","error","cost_microusd","started_at","finished_at","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdRunsByRunId"}},"/v1/accounts/{accountSlug}/agents/{id}/runs/{runId}/cancel":{"post":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"204":{"description":"cancelled"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgentsByIdRunsByRunIdCancel"}},"/v1/accounts/{accountSlug}/agents/{id}/threads":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"project_id":{"type":["string","null"]},"title":{"type":"string"},"opened_by_kind":{"type":"string","enum":["user","agent","system"]},"opened_by_id":{"type":"string"},"last_activity_at":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]}},"required":["id","account_id","agent_id","project_id","title","opened_by_kind","opened_by_id","last_activity_at","created_at","updated_at","archived_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdThreads"}},"/v1/accounts/{accountSlug}/threads/{threadId}/messages":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"threadId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"run_id":{"type":["string","null"]},"author_kind":{"type":"string"},"author_id":{"type":["string","null"]},"role":{"type":"string"},"content":{"type":"object","additionalProperties":{}},"position":{"type":"number"},"created_at":{"type":"string"}},"required":["id","run_id","author_kind","author_id","role","content","position","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugThreadsByThreadIdMessages"}},"/v1/accounts/{accountSlug}/agents/{id}/runs/{runId}/stream":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"SSE event stream"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"cf-agent-runner not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdRunsByRunIdStream"}},"/v1/accounts/{accountSlug}/agents/{id}/triggers":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string"},"mcp":{"type":"object","properties":{"enabled":{"type":"boolean"},"expose_as_tool_slug":{"type":["string","null"]}},"required":["enabled","expose_as_tool_slug"]},"webhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"retain_thread":{"type":"boolean"},"secret_prefix":{"type":["string","null"]},"secret_minted_at":{"type":["string","null"]}},"required":["enabled","retain_thread","secret_prefix","secret_minted_at"]},"cron":{"type":"object","properties":{"enabled":{"type":"boolean"},"expression":{"type":["string","null"]},"tz":{"type":["string","null"]},"retain_thread":{"type":"boolean"},"job_name":{"type":["string","null"]},"last_reconciled_at":{"type":["string","null"]},"last_reconcile_status":{"type":["string","null"],"enum":["ok","drifted","error"]}},"required":["enabled","expression","tz","retain_thread","job_name","last_reconciled_at","last_reconcile_status"]}},"required":["agent_id","mcp","webhook","cron"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdTriggers"},"put":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mcp":{"type":"object","properties":{"enabled":{"type":"boolean"},"expose_as_tool_slug":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9][a-z0-9-]*$"}},"required":["enabled"]},"cron":{"type":"object","properties":{"expression":{"type":"string","minLength":7,"maxLength":120,"pattern":"^[\\dA-Za-z\\s*/,\\-?LW#]+$"},"tz":{"type":"string","minLength":1,"maxLength":40},"retain_thread":{"type":"boolean"}},"required":["expression"]},"webhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"retain_thread":{"type":"boolean"}},"required":["enabled"]}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string"},"mcp":{"type":"object","properties":{"enabled":{"type":"boolean"},"expose_as_tool_slug":{"type":["string","null"]}},"required":["enabled","expose_as_tool_slug"]},"webhook":{"type":"object","properties":{"enabled":{"type":"boolean"},"retain_thread":{"type":"boolean"},"secret_prefix":{"type":["string","null"]},"secret_minted_at":{"type":["string","null"]}},"required":["enabled","retain_thread","secret_prefix","secret_minted_at"]},"cron":{"type":"object","properties":{"enabled":{"type":"boolean"},"expression":{"type":["string","null"]},"tz":{"type":["string","null"]},"retain_thread":{"type":"boolean"},"job_name":{"type":["string","null"]},"last_reconciled_at":{"type":["string","null"]},"last_reconcile_status":{"type":["string","null"],"enum":["ok","drifted","error"]}},"required":["enabled","expression","tz","retain_thread","job_name","last_reconciled_at","last_reconcile_status"]}},"required":["agent_id","mcp","webhook","cron"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"putV1AccountsByAccountSlugAgentsByIdTriggers"}},"/v1/accounts/{accountSlug}/agents/{id}/triggers/webhook/rotate":{"post":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"201":{"description":"rotated","content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string"},"prefix":{"type":"string"}},"required":["secret","prefix"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgentsByIdTriggersWebhookRotate"}},"/v1/accounts/{accountSlug}/agents/{id}/budget":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string"},"account_id":{"type":"string"},"notify_at_microusd":{"type":["number","null"]},"hard_cap_microusd":{"type":["number","null"]},"notify_at_last_fired_day":{"type":["string","null"]},"hard_cap_last_fired_day":{"type":["string","null"]},"set_by_user_id":{"type":["string","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]}},"required":["agent_id","account_id","notify_at_microusd","hard_cap_microusd","notify_at_last_fired_day","hard_cap_last_fired_day","set_by_user_id","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdBudget"},"put":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"notify_at_microusd":{"type":["integer","null"],"exclusiveMinimum":0},"hard_cap_microusd":{"type":["integer","null"],"exclusiveMinimum":0}},"required":["notify_at_microusd","hard_cap_microusd"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string"},"account_id":{"type":"string"},"notify_at_microusd":{"type":["number","null"]},"hard_cap_microusd":{"type":["number","null"]},"notify_at_last_fired_day":{"type":["string","null"]},"hard_cap_last_fired_day":{"type":["string","null"]},"set_by_user_id":{"type":["string","null"]},"created_at":{"type":["string","null"]},"updated_at":{"type":["string","null"]}},"required":["agent_id","account_id","notify_at_microusd","hard_cap_microusd","notify_at_last_fired_day","hard_cap_last_fired_day","set_by_user_id","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"putV1AccountsByAccountSlugAgentsByIdBudget"},"delete":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"cleared"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugAgentsByIdBudget"}},"/v1/accounts/{accountSlug}/threads/{threadId}/forks":{"post":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"threadId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"checkpoint_message_id":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1,"maxLength":200}},"required":["checkpoint_message_id"]}}}},"responses":{"201":{"description":"forked","content":{"application/json":{"schema":{"type":"object","properties":{"thread_id":{"type":"string","format":"uuid"},"parent_thread_id":{"type":"string","format":"uuid"},"checkpoint_position":{"type":"number"},"copied_messages":{"type":"number"}},"required":["thread_id","parent_thread_id","checkpoint_position","copied_messages"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugThreadsByThreadIdForks"}},"/v1/accounts/{accountSlug}/agents/{id}/runs/{runId}/replay":{"post":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["in_place","fork"]},"fork_at_message_id":{"type":"string","format":"uuid"},"input_override":{"type":"object","additionalProperties":{}}}}}}},"responses":{"201":{"description":"queued","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"thread_id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"trigger_kind":{"type":"string"},"triggered_by_kind":{"type":"string"},"triggered_by_id":{"type":"string"},"status":{"type":"string"},"input":{"type":"object","additionalProperties":{}},"output":{"type":["object","null"],"additionalProperties":{}},"error":{"type":["object","null"],"additionalProperties":{}},"cost_microusd":{"type":"number"},"started_at":{"type":["string","null"]},"finished_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","thread_id","account_id","agent_id","trigger_kind","triggered_by_kind","triggered_by_id","status","input","output","error","cost_microusd","started_at","finished_at","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgentsByIdRunsByRunIdReplay"}},"/v1/accounts/{accountSlug}/agents/{id}/invoke":{"post":{"tags":["Agents"],"summary":"Inter-agent invoke. Caller must be an agent principal.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"object","additionalProperties":{}},"thread_id":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"queued","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"thread_id":{"type":"string"},"account_id":{"type":"string"},"agent_id":{"type":"string"},"trigger_kind":{"type":"string"},"triggered_by_kind":{"type":"string"},"triggered_by_id":{"type":"string"},"status":{"type":"string"},"input":{"type":"object","additionalProperties":{}},"output":{"type":["object","null"],"additionalProperties":{}},"error":{"type":["object","null"],"additionalProperties":{}},"cost_microusd":{"type":"number"},"started_at":{"type":["string","null"]},"finished_at":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"}},"required":["id","thread_id","account_id","agent_id","trigger_kind","triggered_by_kind","triggered_by_id","status","input","output","error","cost_microusd","started_at","finished_at","created_at","updated_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugAgentsByIdInvoke","description":"Inter-agent invoke. Caller must be an agent principal."}},"/v1/accounts/{accountSlug}/agents/{id}/skill-exposure":{"get":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string"},"account_id":{"type":"string"},"exposed":{"type":"boolean"},"skill_id":{"type":["string","null"]},"skill_slug":{"type":["string","null"]},"skill_owner_kind":{"type":["string","null"]}},"required":["agent_id","account_id","exposed","skill_id","skill_slug","skill_owner_kind"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAgentsByIdSkillExposure"},"put":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"skill_slug":{"type":"string","minLength":1,"maxLength":120,"pattern":"^[a-z0-9][a-z0-9/_-]*$"},"description":{"type":"string","minLength":1,"maxLength":500}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"agent_id":{"type":"string"},"account_id":{"type":"string"},"exposed":{"type":"boolean"},"skill_id":{"type":["string","null"]},"skill_slug":{"type":["string","null"]},"skill_owner_kind":{"type":["string","null"]}},"required":["agent_id","account_id","exposed","skill_id","skill_slug","skill_owner_kind"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"putV1AccountsByAccountSlugAgentsByIdSkillExposure"},"delete":{"tags":["Agents"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"cleared"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugAgentsByIdSkillExposure"}},"/v1/accounts/{account_slug}/teams":{"get":{"tags":["Teams"],"summary":"List teams in this account.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"is_scim_managed":{"type":"boolean"},"idp_external_id":{"type":["string","null"]},"last_scim_sync_at":{"type":["string","null"]},"created_by_user_id":{"type":"string"},"created_at":{"type":"string"},"member_count":{"type":"number"},"member_count_by_kind":{"type":"object","properties":{"user":{"type":"number"},"agent":{"type":"number"}},"required":["user","agent"]}},"required":["id","account_id","slug","name","description","is_scim_managed","idp_external_id","last_scim_sync_at","created_by_user_id","created_at","member_count","member_count_by_kind"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugTeams","description":"List teams in this account."},"post":{"tags":["Teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":2,"maxLength":20,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"},"name":{"type":"string","minLength":1,"maxLength":20},"description":{"type":"string","maxLength":1000}},"required":["slug","name"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"is_scim_managed":{"type":"boolean"},"idp_external_id":{"type":["string","null"]},"last_scim_sync_at":{"type":["string","null"]},"created_by_user_id":{"type":"string"},"created_at":{"type":"string"},"member_count":{"type":"number"},"member_count_by_kind":{"type":"object","properties":{"user":{"type":"number"},"agent":{"type":"number"}},"required":["user","agent"]}},"required":["id","account_id","slug","name","description","is_scim_managed","idp_external_id","last_scim_sync_at","created_by_user_id","created_at","member_count","member_count_by_kind"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugTeams"}},"/v1/accounts/{account_slug}/teams/{id}":{"get":{"tags":["Teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"is_scim_managed":{"type":"boolean"},"idp_external_id":{"type":["string","null"]},"last_scim_sync_at":{"type":["string","null"]},"created_by_user_id":{"type":"string"},"created_at":{"type":"string"},"member_count":{"type":"number"},"member_count_by_kind":{"type":"object","properties":{"user":{"type":"number"},"agent":{"type":"number"}},"required":["user","agent"]}},"required":["id","account_id","slug","name","description","is_scim_managed","idp_external_id","last_scim_sync_at","created_by_user_id","created_at","member_count","member_count_by_kind"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugTeamsById"},"patch":{"tags":["Teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":20},"description":{"type":["string","null"],"maxLength":1000},"slug":{"type":"string","minLength":2,"maxLength":20,"pattern":"^[a-z][a-z0-9-]*[a-z0-9]$"}}}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"is_scim_managed":{"type":"boolean"},"idp_external_id":{"type":["string","null"]},"last_scim_sync_at":{"type":["string","null"]},"created_by_user_id":{"type":"string"},"created_at":{"type":"string"},"member_count":{"type":"number"},"member_count_by_kind":{"type":"object","properties":{"user":{"type":"number"},"agent":{"type":"number"}},"required":["user","agent"]}},"required":["id","account_id","slug","name","description","is_scim_managed","idp_external_id","last_scim_sync_at","created_by_user_id","created_at","member_count","member_count_by_kind"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AccountsByAccountSlugTeamsById"},"delete":{"tags":["Teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"deleted"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugTeamsById"}},"/v1/accounts/{account_slug}/teams/{id}/members":{"get":{"tags":["Teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"principal_kind":{"type":"string","enum":["user","agent"]},"principal_id":{"type":"string"},"added_at":{"type":"string"},"added_by_user_id":{"type":"string"},"is_scim_managed":{"type":"boolean"}},"required":["principal_kind","principal_id","added_at","added_by_user_id","is_scim_managed"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugTeamsByIdMembers"},"post":{"tags":["Teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"principal_kind":{"type":"string","enum":["user","agent"]},"principal_id":{"type":"string","format":"uuid"}},"required":["principal_kind","principal_id"]}}}},"responses":{"201":{"description":"added","content":{"application/json":{"schema":{"type":"object","properties":{"principal_kind":{"type":"string","enum":["user","agent"]},"principal_id":{"type":"string"},"added_at":{"type":"string"},"added_by_user_id":{"type":"string"},"is_scim_managed":{"type":"boolean"}},"required":["principal_kind","principal_id","added_at","added_by_user_id","is_scim_managed"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugTeamsByIdMembers"}},"/v1/accounts/{account_slug}/teams/{id}/members/{principal_kind}/{principal_id}":{"delete":{"tags":["Teams"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["user","agent"]},"required":true,"name":"principal_kind","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"principal_id","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugTeamsByIdMembersByPrincipalKindByPrincipalId"}},"/v1/accounts/{account_slug}/connections/{connection_id}/acl/grants":{"get":{"tags":["ACL"],"summary":"List grants on a connector_connection.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"connection_id","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"resource_kind":{"type":"string"},"resource_id":{"type":"string"},"subject_kind":{"type":"string","enum":["team","user","agent"]},"subject_id":{"type":"string"},"role":{"type":"string"},"granted_at":{"type":"string"},"granted_by_user_id":{"type":"string"}},"required":["id","account_id","resource_kind","resource_id","subject_kind","subject_id","role","granted_at","granted_by_user_id"]}}},"required":["items"]}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"account not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugConnectionsByConnectionIdAclGrants","description":"List grants on a connector_connection."},"post":{"tags":["ACL"],"summary":"Add or upsert a grant on this connection.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"connection_id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"subject_kind":{"type":"string","enum":["team","user","agent"]},"subject_id":{"type":"string","format":"uuid"},"role":{"type":"string","minLength":1,"maxLength":64}},"required":["subject_kind","subject_id","role"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"resource_kind":{"type":"string"},"resource_id":{"type":"string"},"subject_kind":{"type":"string","enum":["team","user","agent"]},"subject_id":{"type":"string"},"role":{"type":"string"},"granted_at":{"type":"string"},"granted_by_user_id":{"type":"string"}},"required":["id","account_id","resource_kind","resource_id","subject_kind","subject_id","role","granted_at","granted_by_user_id"]}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"account not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugConnectionsByConnectionIdAclGrants","description":"Add or upsert a grant on this connection."}},"/v1/accounts/{account_slug}/connections/{connection_id}/acl/grants/{grant_id}":{"patch":{"tags":["ACL"],"summary":"Change the role of an existing grant.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"connection_id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"grant_id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","minLength":1,"maxLength":64}},"required":["role"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"resource_kind":{"type":"string"},"resource_id":{"type":"string"},"subject_kind":{"type":"string","enum":["team","user","agent"]},"subject_id":{"type":"string"},"role":{"type":"string"},"granted_at":{"type":"string"},"granted_by_user_id":{"type":"string"}},"required":["id","account_id","resource_kind","resource_id","subject_kind","subject_id","role","granted_at","granted_by_user_id"]}}}},"400":{"description":"invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"grant not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AccountsByAccountSlugConnectionsByConnectionIdAclGrantsByGrantId","description":"Change the role of an existing grant."},"delete":{"tags":["ACL"],"summary":"Remove a grant.","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"connection_id","in":"path"},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"grant_id","in":"path"}],"responses":{"204":{"description":"removed"},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"grant not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugConnectionsByConnectionIdAclGrantsByGrantId","description":"Remove a grant."}},"/v1/accounts/{account_slug}/audit":{"get":{"tags":["Audit"],"summary":"Read the per-domain audit log for this account (UNION view).","description":"Reads connection_audit + acl_audit + member_audit, merged + time-ordered. Read window is gated by the active billing plan (free = 30d, pro = 90d, enterprise = unlimited).","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":500},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"until","in":"query"},{"schema":{"type":"string","enum":["connection","acl","member"]},"required":false,"name":"source","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string","enum":["connection","acl","member"]},"occurred_at":{"type":"string"},"account_id":{"type":"string"},"event":{"type":"string"},"summary":{"type":["string","null"]},"resource_kind":{"type":["string","null"]},"resource_id":{"type":["string","null"]},"subject_kind":{"type":["string","null"]},"subject_id":{"type":["string","null"]},"subject_label":{"type":["string","null"]},"role_before":{"type":["string","null"]},"role_after":{"type":["string","null"]},"actor_principal_kind":{"type":["string","null"]},"actor_principal_id":{"type":["string","null"]},"on_behalf_of_principal_kind":{"type":["string","null"]},"on_behalf_of_principal_id":{"type":["string","null"]},"detail":{"type":"object","additionalProperties":{}}},"required":["id","source","occurred_at","account_id","event","summary","resource_kind","resource_id","subject_kind","subject_id","subject_label","role_before","role_after","actor_principal_kind","actor_principal_id","on_behalf_of_principal_kind","on_behalf_of_principal_id","detail"]}},"tier":{"type":"string","enum":["free","pro","enterprise"]},"retention_days":{"type":["number","null"]}},"required":["items","tier","retention_days"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugAudit"}},"/v1/agents/{account_slug}/{agent_slug}":{"get":{"tags":["Per-agent"],"summary":"Agent identity on its own URL pair","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"}],"responses":{"200":{"description":"Agent identity","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_slug":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["active","suspended"]},"urls":{"type":"object","properties":{"rest":{"type":"string"},"openapi":{"type":"string"},"mcp":{"type":"string"}},"required":["rest","openapi","mcp"]}},"required":["id","account_slug","slug","display_name","description","status","urls"]}}}},"404":{"description":"Unknown account or agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Agent revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AgentsByAccountSlugByAgentSlug","description":"Agent identity on its own URL pair"}},"/v1/agents/{account_slug}/{agent_slug}/openapi.json":{"get":{"tags":["Per-agent"],"summary":"Self-contained OpenAPI doc for this agent (public)","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"}],"responses":{"200":{"description":"OpenAPI 3.1 document"},"404":{"description":"Unknown account or agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Agent revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AgentsByAccountSlugByAgentSlugOpenapiJson","description":"Self-contained OpenAPI doc for this agent (public)"}},"/v1/agents/{account_slug}/{agent_slug}/runs":{"post":{"tags":["Per-agent"],"summary":"Trigger a run (trigger_kind=rest)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"thread_id":{"type":"string"},"thread_title":{"type":"string","minLength":1,"maxLength":200},"input":{"type":"object","additionalProperties":{},"default":{}}}}}}},"responses":{"201":{"description":"Run queued"},"402":{"description":"Insufficient credits","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Unknown account or agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Agent revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AgentsByAccountSlugByAgentSlugRuns","description":"Trigger a run (trigger_kind=rest)"},"get":{"tags":["Per-agent"],"summary":"List runs","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Runs"},"404":{"description":"Unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AgentsByAccountSlugByAgentSlugRuns","description":"List runs"}},"/v1/agents/{account_slug}/{agent_slug}/runs/{run_id}":{"get":{"tags":["Per-agent"],"summary":"Run detail","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"run_id","in":"path"}],"responses":{"200":{"description":"Run"},"404":{"description":"Unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AgentsByAccountSlugByAgentSlugRunsByRunId","description":"Run detail"}},"/v1/agents/{account_slug}/{agent_slug}/runs/{run_id}/cancel":{"post":{"tags":["Per-agent"],"summary":"Cancel an in-flight run (idempotent)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"run_id","in":"path"}],"responses":{"204":{"description":"Cancelled"},"404":{"description":"Unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AgentsByAccountSlugByAgentSlugRunsByRunIdCancel","description":"Cancel an in-flight run (idempotent)"}},"/v1/agents/{account_slug}/{agent_slug}/threads":{"get":{"tags":["Per-agent"],"summary":"List threads","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Threads"},"404":{"description":"Unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AgentsByAccountSlugByAgentSlugThreads","description":"List threads"}},"/v1/agents/{account_slug}/{agent_slug}/threads/{thread_id}/messages":{"get":{"tags":["Per-agent"],"summary":"Thread messages","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"thread_id","in":"path"}],"responses":{"200":{"description":"Messages"},"404":{"description":"Unknown","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AgentsByAccountSlugByAgentSlugThreadsByThreadIdMessages","description":"Thread messages"}},"/v1/agents/{account_slug}/{agent_slug}/.well-known/agent-card.json":{"get":{"tags":["Per-agent","A2A"],"summary":"A2A Agent Card (public; 404 unless a2a_enabled)","parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"}],"responses":{"200":{"description":"Agent Card"},"404":{"description":"Unknown agent or A2A not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Agent revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AgentsByAccountSlugByAgentSlugWellKnownAgentCardJson","description":"A2A Agent Card (public; 404 unless a2a_enabled)"}},"/v1/agents/{account_slug}/{agent_slug}/a2a":{"post":{"tags":["Per-agent","A2A"],"summary":"A2A JSON-RPC endpoint (message/send, tasks/get, tasks/cancel)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"account_slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"agent_slug","in":"path"}],"responses":{"200":{"description":"JSON-RPC envelope (result or error)"},"404":{"description":"Unknown agent or A2A not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"410":{"description":"Agent revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AgentsByAccountSlugByAgentSlugA2a","description":"A2A JSON-RPC endpoint (message/send, tasks/get, tasks/cancel)"}},"/.well-known/oauth-protected-resource":{"get":{"tags":["Well-Known"],"summary":"RFC 9728 protected-resource metadata. Discovery for OAuth-protected api.connect0.ai endpoints.","responses":{"200":{"description":"protected-resource metadata","content":{"application/json":{"schema":{"type":"object","properties":{"resource":{"type":"string"},"authorization_servers":{"type":"array","items":{"type":"string"}},"bearer_methods_supported":{"type":"array","items":{"type":"string"}},"scopes_supported":{"type":"array","items":{"type":"string"}},"resource_documentation":{"type":"string"}},"required":["resource","authorization_servers","bearer_methods_supported","scopes_supported"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getWellKnownOauthProtectedResource","description":"RFC 9728 protected-resource metadata. Discovery for OAuth-protected api.connect0.ai endpoints."}},"/v1/models":{"get":{"tags":["Models"],"summary":"List catalog rows. Filter by modality / provider / client_kind.","parameters":[{"schema":{"type":"string","enum":["chat","embedding","image_generation","image_edit","text_to_speech","speech_to_text","music_generation","video_generation","rerank","code_completion"]},"required":false,"name":"modality","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string","enum":["openai_compatible","anthropic_native","openai_native","gemini_native","openrouter","replicate","fal","aisdk"]},"required":false,"name":"client_kind","in":"query"},{"schema":{"type":["boolean","null"]},"required":false,"name":"include_deprecated","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"provider":{"type":"string"},"family":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"modality":{"type":"string"},"route":{"type":"string"},"client_kind":{"type":"string"},"provider_model_id":{"type":"string"},"base_url":{"type":["string","null"]},"context_length":{"type":["number","null"]},"max_completion_tokens":{"type":["number","null"]},"supports_function_calling":{"type":"boolean"},"supports_vision":{"type":"boolean"},"supports_streaming":{"type":"boolean"},"supports_json_mode":{"type":"boolean"},"supports_prompt_caching":{"type":"boolean"},"supports_batch":{"type":"boolean"},"modality_metadata":{"type":"object","additionalProperties":{}},"pricing":{"type":"object","additionalProperties":{}},"deprecated_at":{"type":["string","null"]},"deprecated_in_favor_of_slug":{"type":["string","null"]},"retired_at":{"type":["string","null"]},"source":{"type":"string"}},"required":["id","slug","provider","family","display_name","description","modality","route","client_kind","provider_model_id","base_url","context_length","max_completion_tokens","supports_function_calling","supports_vision","supports_streaming","supports_json_mode","supports_prompt_caching","supports_batch","modality_metadata","pricing","deprecated_at","deprecated_in_favor_of_slug","retired_at","source"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1Models","description":"List catalog rows. Filter by modality / provider / client_kind."}},"/v1/models/{slug}":{"get":{"tags":["Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"provider":{"type":"string"},"family":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"modality":{"type":"string"},"route":{"type":"string"},"client_kind":{"type":"string"},"provider_model_id":{"type":"string"},"base_url":{"type":["string","null"]},"context_length":{"type":["number","null"]},"max_completion_tokens":{"type":["number","null"]},"supports_function_calling":{"type":"boolean"},"supports_vision":{"type":"boolean"},"supports_streaming":{"type":"boolean"},"supports_json_mode":{"type":"boolean"},"supports_prompt_caching":{"type":"boolean"},"supports_batch":{"type":"boolean"},"modality_metadata":{"type":"object","additionalProperties":{}},"pricing":{"type":"object","additionalProperties":{}},"deprecated_at":{"type":["string","null"]},"deprecated_in_favor_of_slug":{"type":["string","null"]},"retired_at":{"type":["string","null"]},"source":{"type":"string"}},"required":["id","slug","provider","family","display_name","description","modality","route","client_kind","provider_model_id","base_url","context_length","max_completion_tokens","supports_function_calling","supports_vision","supports_streaming","supports_json_mode","supports_prompt_caching","supports_batch","modality_metadata","pricing","deprecated_at","deprecated_in_favor_of_slug","retired_at","source"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1ModelsBySlug"}},"/v1/accounts/{accountSlug}/models/allowlist":{"get":{"tags":["Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"model_slug":{"type":"string"},"created_at":{"type":"string"}},"required":["account_id","model_slug","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugModelsAllowlist"},"post":{"tags":["Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"model_slug":{"type":"string","minLength":1}},"required":["model_slug"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"model_slug":{"type":"string"},"created_at":{"type":"string"}},"required":["account_id","model_slug","created_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugModelsAllowlist"}},"/v1/accounts/{accountSlug}/models/allowlist/{modelSlug}":{"delete":{"tags":["Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"modelSlug","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugModelsAllowlistByModelSlug"}},"/v1/accounts/{accountSlug}/models/denylist":{"get":{"tags":["Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"model_slug":{"type":"string"},"reason":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["account_id","model_slug","reason","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugModelsDenylist"},"post":{"tags":["Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"model_slug":{"type":"string","minLength":1},"reason":{"type":"string"}},"required":["model_slug"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"model_slug":{"type":"string"},"reason":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["account_id","model_slug","reason","created_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugModelsDenylist"}},"/v1/accounts/{accountSlug}/models/denylist/{modelSlug}":{"delete":{"tags":["Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"modelSlug","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugModelsDenylistByModelSlug"}},"/v1/accounts/{accountSlug}/byok":{"get":{"tags":["BYOK"],"summary":"List BYOK API keys configured on this account.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"provider":{"type":"string","enum":["anthropic","openai","openrouter","gemini","mistral","groq","together","fireworks","perplexity","deepinfra","cerebras","cohere","elevenlabs","deepgram","replicate","fal"]},"display_name":{"type":"string"},"status":{"type":"string","enum":["active","revoked","degraded","error"]},"status_detail":{"type":["string","null"]},"created_at":{"type":"string"},"last_validated_at":{"type":["string","null"]},"orchestration_fee_basis_points":{"type":"number"},"orchestration_fee_flat_microusd_per_call":{"type":"number"}},"required":["id","account_id","provider","display_name","status","status_detail","created_at","last_validated_at","orchestration_fee_basis_points","orchestration_fee_flat_microusd_per_call"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugByok","description":"List BYOK API keys configured on this account."},"post":{"tags":["BYOK"],"summary":"Add or rotate a BYOK API key. The plaintext key is encrypted before persistence + dropped.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["anthropic","openai","openrouter","gemini","mistral","groq","together","fireworks","perplexity","deepinfra","cerebras","cohere","elevenlabs","deepgram","replicate","fal"]},"secret":{"type":"string","minLength":1,"maxLength":8192},"display_name":{"type":"string","minLength":1,"maxLength":120}},"required":["provider","secret"]}}}},"responses":{"201":{"description":"created or rotated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":"string"},"provider":{"type":"string","enum":["anthropic","openai","openrouter","gemini","mistral","groq","together","fireworks","perplexity","deepinfra","cerebras","cohere","elevenlabs","deepgram","replicate","fal"]},"display_name":{"type":"string"},"status":{"type":"string","enum":["active","revoked","degraded","error"]},"status_detail":{"type":["string","null"]},"created_at":{"type":"string"},"last_validated_at":{"type":["string","null"]},"orchestration_fee_basis_points":{"type":"number"},"orchestration_fee_flat_microusd_per_call":{"type":"number"}},"required":["id","account_id","provider","display_name","status","status_detail","created_at","last_validated_at","orchestration_fee_basis_points","orchestration_fee_flat_microusd_per_call"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugByok","description":"Add or rotate a BYOK API key. The plaintext key is encrypted before persistence + dropped."}},"/v1/accounts/{accountSlug}/byok/{provider}":{"delete":{"tags":["BYOK"],"summary":"Revoke a BYOK key. Clears the encrypted blob; future calls fall back to the platform pool.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string","enum":["anthropic","openai","openrouter","gemini","mistral","groq","together","fireworks","perplexity","deepinfra","cerebras","cohere","elevenlabs","deepgram","replicate","fal"]},"required":true,"name":"provider","in":"path"}],"responses":{"204":{"description":"revoked"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugByokByProvider","description":"Revoke a BYOK key. Clears the encrypted blob; future calls fall back to the platform pool."}},"/v1/accounts/{accountSlug}/byok/{provider}/pricing":{"patch":{"tags":["BYOK"],"summary":"Operator-only orchestration-fee editor (admin scope required).","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string","enum":["anthropic","openai","openrouter","gemini","mistral","groq","together","fireworks","perplexity","deepinfra","cerebras","cohere","elevenlabs","deepgram","replicate","fal"]},"required":true,"name":"provider","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orchestration_fee_basis_points":{"type":"integer","minimum":0,"maximum":10000},"orchestration_fee_flat_microusd_per_call":{"type":"integer","minimum":0}},"required":["orchestration_fee_basis_points","orchestration_fee_flat_microusd_per_call"]}}}},"responses":{"204":{"description":"updated"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"patchV1AccountsByAccountSlugByokByProviderPricing","description":"Operator-only orchestration-fee editor (admin scope required)."}},"/v1/admin/models":{"get":{"tags":["Admin Models"],"parameters":[{"schema":{"type":"string","enum":["chat","embedding","image_generation","image_edit","text_to_speech","speech_to_text","music_generation","video_generation","rerank","code_completion"]},"required":false,"name":"modality","in":"query"},{"schema":{"type":"string"},"required":false,"name":"provider","in":"query"},{"schema":{"type":"string","enum":["openai_compatible","anthropic_native","openai_native","gemini_native","openrouter","replicate","fal","aisdk"]},"required":false,"name":"client_kind","in":"query"},{"schema":{"type":["boolean","null"]},"required":false,"name":"include_deprecated","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"provider":{"type":"string"},"family":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"modality":{"type":"string"},"route":{"type":"string"},"client_kind":{"type":"string"},"provider_model_id":{"type":"string"},"base_url":{"type":["string","null"]},"context_length":{"type":["number","null"]},"max_completion_tokens":{"type":["number","null"]},"supports_function_calling":{"type":"boolean"},"supports_vision":{"type":"boolean"},"supports_streaming":{"type":"boolean"},"supports_json_mode":{"type":"boolean"},"supports_prompt_caching":{"type":"boolean"},"supports_batch":{"type":"boolean"},"modality_metadata":{"type":"object","additionalProperties":{}},"pricing":{"type":"object","additionalProperties":{}},"deprecated_at":{"type":["string","null"]},"deprecated_in_favor_of_slug":{"type":["string","null"]},"retired_at":{"type":["string","null"]},"source":{"type":"string"}},"required":["id","slug","provider","family","display_name","description","modality","route","client_kind","provider_model_id","base_url","context_length","max_completion_tokens","supports_function_calling","supports_vision","supports_streaming","supports_json_mode","supports_prompt_caching","supports_batch","modality_metadata","pricing","deprecated_at","deprecated_in_favor_of_slug","retired_at","source"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminModels"}},"/v1/admin/models/{slug}":{"get":{"tags":["Admin Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"provider":{"type":"string"},"family":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"modality":{"type":"string"},"route":{"type":"string"},"client_kind":{"type":"string"},"provider_model_id":{"type":"string"},"base_url":{"type":["string","null"]},"context_length":{"type":["number","null"]},"max_completion_tokens":{"type":["number","null"]},"supports_function_calling":{"type":"boolean"},"supports_vision":{"type":"boolean"},"supports_streaming":{"type":"boolean"},"supports_json_mode":{"type":"boolean"},"supports_prompt_caching":{"type":"boolean"},"supports_batch":{"type":"boolean"},"modality_metadata":{"type":"object","additionalProperties":{}},"pricing":{"type":"object","additionalProperties":{}},"deprecated_at":{"type":["string","null"]},"deprecated_in_favor_of_slug":{"type":["string","null"]},"retired_at":{"type":["string","null"]},"source":{"type":"string"}},"required":["id","slug","provider","family","display_name","description","modality","route","client_kind","provider_model_id","base_url","context_length","max_completion_tokens","supports_function_calling","supports_vision","supports_streaming","supports_json_mode","supports_prompt_caching","supports_batch","modality_metadata","pricing","deprecated_at","deprecated_in_favor_of_slug","retired_at","source"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminModelsBySlug"},"put":{"tags":["Admin Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":256},"provider":{"type":"string","minLength":1},"family":{"type":"string","minLength":1},"display_name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"modality":{"type":"string","enum":["chat","embedding","image_generation","image_edit","text_to_speech","speech_to_text","music_generation","video_generation","rerank","code_completion"]},"route":{"type":"string","enum":["native","openrouter","byok_native"]},"client_kind":{"type":"string","enum":["openai_compatible","anthropic_native","openai_native","gemini_native","openrouter","replicate","fal","aisdk"]},"provider_model_id":{"type":"string","minLength":1},"base_url":{"type":["string","null"],"format":"uri"},"aisdk_provider":{"type":["string","null"]},"context_length":{"type":["integer","null"],"exclusiveMinimum":0},"max_completion_tokens":{"type":["integer","null"],"exclusiveMinimum":0},"supports_function_calling":{"type":"boolean"},"supports_vision":{"type":"boolean"},"supports_streaming":{"type":"boolean"},"supports_json_mode":{"type":"boolean"},"supports_prompt_caching":{"type":"boolean"},"supports_batch":{"type":"boolean"},"modality_metadata":{"type":"object","additionalProperties":{}},"pricing":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["per_token"]},"input_microusd_per_million":{"type":"number","minimum":0},"output_microusd_per_million":{"type":"number","minimum":0},"modifiers":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["prompt_caching_write","prompt_caching_read","batch_api_discount"]},"applies_to":{"anyOf":[{"type":"string","enum":["input","output"]},{"type":"array","items":{"type":"string","enum":["input","output"]}}]},"factor":{"type":"number","minimum":0}},"required":["kind","applies_to","factor"]}}},"required":["kind","input_microusd_per_million","output_microusd_per_million"]},{"type":"object","properties":{"kind":{"type":"string","enum":["per_unit"]},"units":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1},"microusd_per_unit":{"type":"number","minimum":0}},"required":["label","microusd_per_unit"]},"minItems":1}},"required":["kind","units"]},{"type":"object","properties":{"kind":{"type":"string","enum":["replicate_compute_seconds"]},"hardware":{"type":"string","minLength":1},"hardware_microusd_per_second":{"type":"number","minimum":0}},"required":["kind","hardware","hardware_microusd_per_second"]},{"type":"object","properties":{"kind":{"type":"string","enum":["per_call"]},"microusd_per_call":{"type":"number","minimum":0}},"required":["kind","microusd_per_call"]}]},"deprecated_at":{"type":["string","null"],"format":"date-time"},"deprecated_in_favor_of_slug":{"type":["string","null"]},"retired_at":{"type":["string","null"],"format":"date-time"}},"required":["slug","provider","family","display_name","modality","route","client_kind","provider_model_id","pricing"]}}}},"responses":{"200":{"description":"updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"provider":{"type":"string"},"family":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"modality":{"type":"string"},"route":{"type":"string"},"client_kind":{"type":"string"},"provider_model_id":{"type":"string"},"base_url":{"type":["string","null"]},"context_length":{"type":["number","null"]},"max_completion_tokens":{"type":["number","null"]},"supports_function_calling":{"type":"boolean"},"supports_vision":{"type":"boolean"},"supports_streaming":{"type":"boolean"},"supports_json_mode":{"type":"boolean"},"supports_prompt_caching":{"type":"boolean"},"supports_batch":{"type":"boolean"},"modality_metadata":{"type":"object","additionalProperties":{}},"pricing":{"type":"object","additionalProperties":{}},"deprecated_at":{"type":["string","null"]},"deprecated_in_favor_of_slug":{"type":["string","null"]},"retired_at":{"type":["string","null"]},"source":{"type":"string"}},"required":["id","slug","provider","family","display_name","description","modality","route","client_kind","provider_model_id","base_url","context_length","max_completion_tokens","supports_function_calling","supports_vision","supports_streaming","supports_json_mode","supports_prompt_caching","supports_batch","modality_metadata","pricing","deprecated_at","deprecated_in_favor_of_slug","retired_at","source"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"putV1AdminModelsBySlug"}},"/v1/admin/models/dry-run-pricing":{"post":{"tags":["Admin Models"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"formula":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["per_token"]},"input_microusd_per_million":{"type":"number","minimum":0},"output_microusd_per_million":{"type":"number","minimum":0},"modifiers":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["prompt_caching_write","prompt_caching_read","batch_api_discount"]},"applies_to":{"anyOf":[{"type":"string","enum":["input","output"]},{"type":"array","items":{"type":"string","enum":["input","output"]}}]},"factor":{"type":"number","minimum":0}},"required":["kind","applies_to","factor"]}}},"required":["kind","input_microusd_per_million","output_microusd_per_million"]},{"type":"object","properties":{"kind":{"type":"string","enum":["per_unit"]},"units":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1},"microusd_per_unit":{"type":"number","minimum":0}},"required":["label","microusd_per_unit"]},"minItems":1}},"required":["kind","units"]},{"type":"object","properties":{"kind":{"type":"string","enum":["replicate_compute_seconds"]},"hardware":{"type":"string","minLength":1},"hardware_microusd_per_second":{"type":"number","minimum":0}},"required":["kind","hardware","hardware_microusd_per_second"]},{"type":"object","properties":{"kind":{"type":"string","enum":["per_call"]},"microusd_per_call":{"type":"number","minimum":0}},"required":["kind","microusd_per_call"]}]},"unit_counts":{"type":"object","additionalProperties":{"type":"number"}}},"required":["formula","unit_counts"]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"microusd":{"type":"number"},"unattributed_units":{"type":"array","items":{"type":"string"}}},"required":["microusd","unattributed_units"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AdminModelsDryRunPricing"}},"/v1/admin/byok-pricing":{"get":{"tags":["Admin Models"],"parameters":[{"schema":{"type":"string"},"required":false,"name":"account_slug","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"account_slug":{"type":"string"},"provider":{"type":"string"},"orchestration_fee_basis_points":{"type":"number"},"orchestration_fee_flat_microusd_per_call":{"type":"number"},"created_at":{"type":"string"}},"required":["account_id","account_slug","provider","orchestration_fee_basis_points","orchestration_fee_flat_microusd_per_call","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminByokPricing"}},"/v1/admin/byok-pricing/{accountSlug}/{provider}":{"put":{"tags":["Admin Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"provider","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orchestration_fee_basis_points":{"type":"integer","minimum":0,"maximum":10000},"orchestration_fee_flat_microusd_per_call":{"type":"integer","minimum":0}},"required":["orchestration_fee_basis_points","orchestration_fee_flat_microusd_per_call"]}}}},"responses":{"204":{"description":"updated"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"putV1AdminByokPricingByAccountSlugByProvider"},"delete":{"tags":["Admin Models"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"provider","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AdminByokPricingByAccountSlugByProvider"}},"/v1/admin/skills":{"get":{"tags":["Admin"],"summary":"Cross-account skill catalog (operator view).","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["system","account","project","user","agent"]},"required":false,"name":"owner_kind","in":"query"},{"schema":{"type":"string"},"required":false,"name":"q","in":"query"},{"schema":{"type":"string"},"required":false,"name":"include_archived","in":"query"},{"schema":{"anyOf":[{"type":"string"},{"type":"number"}]},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"owner_kind":{"type":"string","enum":["system","account","project","user","agent"]},"owner_account_id":{"type":["string","null"]},"owner_account_slug":{"type":["string","null"]},"source":{"type":"string"},"imported_from_source_id":{"type":["string","null"]},"visibility":{"type":"string"},"current_revision_id":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]}},"required":["id","slug","owner_kind","owner_account_id","owner_account_slug","source","imported_from_source_id","visibility","current_revision_id","created_at","updated_at","archived_at"]}},"total_by_owner_kind":{"type":"object","additionalProperties":{"type":"number"}}},"required":["items","total_by_owner_kind"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminSkills","description":"Cross-account skill catalog (operator view)."}},"/v1/admin/skill-import-runs":{"get":{"tags":["Admin"],"summary":"Most-recent skill_import_run rows across the platform.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source_id":{"type":["string","null"]},"source_kind":{"type":"string"},"source_display_name":{"type":"string"},"account_id":{"type":["string","null"]},"source_url":{"type":["string","null"]},"status":{"type":"string"},"rows_inserted":{"type":"number"},"rows_updated":{"type":"number"},"rows_skipped":{"type":"number"},"rows_deprecated":{"type":"number"},"error_message":{"type":["string","null"]},"started_at":{"type":"string"},"finished_at":{"type":["string","null"]}},"required":["id","source_id","source_kind","source_display_name","account_id","source_url","status","rows_inserted","rows_updated","rows_skipped","rows_deprecated","error_message","started_at","finished_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AdminSkillImportRuns","description":"Most-recent skill_import_run rows across the platform."}},"/v1/integrations":{"get":{"tags":["Integrations"],"summary":"List integration catalog rows. Filter by category / kind / q.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":100},"required":false,"name":"category","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":50},"required":false,"name":"kind","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"include_deprecated","in":"query"},{"schema":{"anyOf":[{"type":"number"},{"type":"string"}]},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"primary_category":{"type":"string"},"categories":{"type":"array","items":{"type":"string"}},"connection_kind":{"type":"string"},"aggregator_provider_slug":{"type":["string","null"]},"native_provider_kind":{"type":["string","null"]},"auth_mode":{"type":"string"},"docs_url":{"type":["string","null"]},"catalog_doc":{"type":["string","null"]},"source":{"type":"string"},"deprecated_at":{"type":["string","null"]},"deprecated_in_favor_of_slug":{"type":["string","null"]}},"required":["id","slug","display_name","description","primary_category","categories","connection_kind","aggregator_provider_slug","native_provider_kind","auth_mode","docs_url","catalog_doc","source","deprecated_at","deprecated_in_favor_of_slug"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1Integrations","description":"List integration catalog rows. Filter by category / kind / q."}},"/v1/integrations/{slug}":{"get":{"tags":["Integrations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"display_name":{"type":"string"},"description":{"type":["string","null"]},"primary_category":{"type":"string"},"categories":{"type":"array","items":{"type":"string"}},"connection_kind":{"type":"string"},"aggregator_provider_slug":{"type":["string","null"]},"native_provider_kind":{"type":["string","null"]},"auth_mode":{"type":"string"},"docs_url":{"type":["string","null"]},"catalog_doc":{"type":["string","null"]},"source":{"type":"string"},"deprecated_at":{"type":["string","null"]},"deprecated_in_favor_of_slug":{"type":["string","null"]}},"required":["id","slug","display_name","description","primary_category","categories","connection_kind","aggregator_provider_slug","native_provider_kind","auth_mode","docs_url","catalog_doc","source","deprecated_at","deprecated_in_favor_of_slug"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1IntegrationsBySlug"}},"/v1/accounts/{accountSlug}/integrations/allowlist":{"get":{"tags":["Integrations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"integration_slug":{"type":"string"},"created_at":{"type":"string"}},"required":["account_id","integration_slug","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugIntegrationsAllowlist"},"post":{"tags":["Integrations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"integration_slug":{"type":"string","minLength":1,"maxLength":200}},"required":["integration_slug"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"integration_slug":{"type":"string"},"created_at":{"type":"string"}},"required":["account_id","integration_slug","created_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugIntegrationsAllowlist"}},"/v1/accounts/{accountSlug}/integrations/allowlist/{integrationSlug}":{"delete":{"tags":["Integrations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"integrationSlug","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugIntegrationsAllowlistByIntegrationSlug"}},"/v1/accounts/{accountSlug}/integrations/denylist":{"get":{"tags":["Integrations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"integration_slug":{"type":"string"},"reason":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["account_id","integration_slug","reason","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugIntegrationsDenylist"},"post":{"tags":["Integrations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"integration_slug":{"type":"string","minLength":1,"maxLength":200},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["integration_slug"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"integration_slug":{"type":"string"},"reason":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["account_id","integration_slug","reason","created_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugIntegrationsDenylist"}},"/v1/accounts/{accountSlug}/integrations/denylist/{integrationSlug}":{"delete":{"tags":["Integrations"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"integrationSlug","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugIntegrationsDenylistByIntegrationSlug"}},"/v1/accounts/{accountSlug}/skills/allowlist":{"get":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"fully_qualified_slug":{"type":"string"},"created_at":{"type":"string"}},"required":["account_id","fully_qualified_slug","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkillsAllowlist"},"post":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fully_qualified_slug":{"type":"string","minLength":1,"maxLength":200}},"required":["fully_qualified_slug"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"fully_qualified_slug":{"type":"string"},"created_at":{"type":"string"}},"required":["account_id","fully_qualified_slug","created_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkillsAllowlist"}},"/v1/accounts/{accountSlug}/skills/allowlist/{slug}":{"delete":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugSkillsAllowlistBySlug"}},"/v1/accounts/{accountSlug}/skills/denylist":{"get":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"account_id":{"type":"string"},"fully_qualified_slug":{"type":"string"},"reason":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["account_id","fully_qualified_slug","reason","created_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkillsDenylist"},"post":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fully_qualified_slug":{"type":"string","minLength":1,"maxLength":200},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["fully_qualified_slug"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"fully_qualified_slug":{"type":"string"},"reason":{"type":["string","null"]},"created_at":{"type":"string"}},"required":["account_id","fully_qualified_slug","reason","created_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkillsDenylist"}},"/v1/accounts/{accountSlug}/skills/denylist/{slug}":{"delete":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"204":{"description":"removed"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugSkillsDenylistBySlug"}},"/v1/accounts/{accountSlug}/skill-imports":{"get":{"tags":["Skills"],"summary":"List the account's active skill import sources (github + npm).","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":["string","null"]},"kind":{"type":"string","enum":["connect0_system","github","npm","connect0_marketplace"]},"display_name":{"type":"string"},"source_url":{"type":"string"},"pinned_ref":{"type":["string","null"]},"refresh_cadence":{"type":"string","enum":["on_demand","nightly","on_webhook"]},"last_refreshed_at":{"type":["string","null"]},"created_at":{"type":"string"},"created_by_user_id":{"type":["string","null"]},"archived_at":{"type":["string","null"]}},"required":["id","account_id","kind","display_name","source_url","pinned_ref","refresh_cadence","last_refreshed_at","created_at","created_by_user_id","archived_at"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkillImports","description":"List the account's active skill import sources (github + npm)."},"post":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["github","npm"]},"display_name":{"type":"string","minLength":1,"maxLength":120},"source_url":{"type":"string","minLength":1,"maxLength":500},"pinned_ref":{"type":"string","minLength":1,"maxLength":200},"refresh_cadence":{"type":"string","enum":["on_demand","nightly"],"default":"nightly"}},"required":["kind","display_name","source_url"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":["string","null"]},"kind":{"type":"string","enum":["connect0_system","github","npm","connect0_marketplace"]},"display_name":{"type":"string"},"source_url":{"type":"string"},"pinned_ref":{"type":["string","null"]},"refresh_cadence":{"type":"string","enum":["on_demand","nightly","on_webhook"]},"last_refreshed_at":{"type":["string","null"]},"created_at":{"type":"string"},"created_by_user_id":{"type":["string","null"]},"archived_at":{"type":["string","null"]}},"required":["id","account_id","kind","display_name","source_url","pinned_ref","refresh_cadence","last_refreshed_at","created_at","created_by_user_id","archived_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkillImports"}},"/v1/accounts/{accountSlug}/skill-imports/{sourceId}/runs":{"get":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sourceId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"import_source_id":{"type":"string"},"started_at":{"type":"string"},"finished_at":{"type":["string","null"]},"fetched_ref":{"type":["string","null"]},"rows_inserted":{"type":"number"},"rows_updated":{"type":"number"},"rows_skipped":{"type":"number"},"rows_deprecated":{"type":"number"},"status":{"type":"string","enum":["running","succeeded","failed","partial"]},"error_message":{"type":["string","null"]}},"required":["id","import_source_id","started_at","finished_at","fetched_ref","rows_inserted","rows_updated","rows_skipped","rows_deprecated","status","error_message"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkillImportsBySourceIdRuns"}},"/v1/accounts/{accountSlug}/skill-imports/{sourceId}":{"get":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sourceId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"account_id":{"type":["string","null"]},"kind":{"type":"string","enum":["connect0_system","github","npm","connect0_marketplace"]},"display_name":{"type":"string"},"source_url":{"type":"string"},"pinned_ref":{"type":["string","null"]},"refresh_cadence":{"type":"string","enum":["on_demand","nightly","on_webhook"]},"last_refreshed_at":{"type":["string","null"]},"created_at":{"type":"string"},"created_by_user_id":{"type":["string","null"]},"archived_at":{"type":["string","null"]}},"required":["id","account_id","kind","display_name","source_url","pinned_ref","refresh_cadence","last_refreshed_at","created_at","created_by_user_id","archived_at"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkillImportsBySourceId"},"delete":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"sourceId","in":"path"}],"responses":{"204":{"description":"archived"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"deleteV1AccountsByAccountSlugSkillImportsBySourceId"}},"/v1/accounts/{accountSlug}/skills":{"get":{"tags":["Skills"],"summary":"List skills (system + this account). Filter by owner_kind / body_kind / q.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string","enum":["system","account","project","user","agent"]},"required":false,"name":"owner_kind","in":"query"},{"schema":{"type":"string","enum":["prompt","mcp_tool","composition","script","integration_action","model_call"]},"required":false,"name":"body_kind","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"q","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}]},"required":false,"name":"include_archived","in":"query"},{"schema":{"anyOf":[{"type":"number"},{"type":"string"}]},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"owner_project_id","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"owner_agent_id","in":"query"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"owner_kind":{"type":"string","enum":["system","account","project","user","agent"]},"owner_account_id":{"type":["string","null"]},"owner_project_id":{"type":["string","null"]},"owner_user_id":{"type":["string","null"]},"owner_agent_id":{"type":["string","null"]},"slug":{"type":"string"},"current_revision_id":{"type":["string","null"]},"source":{"type":"string","enum":["manual","imported","system_baseline","forked"]},"imported_from_source_id":{"type":["string","null"]},"imported_ref":{"type":["string","null"]},"forked_from_skill_id":{"type":["string","null"]},"visibility":{"type":"string","enum":["private","shared","published"]},"created_by_user_id":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]},"fully_qualified_slug":{"type":"string"}},"required":["id","owner_kind","owner_account_id","owner_project_id","owner_user_id","owner_agent_id","slug","current_revision_id","source","imported_from_source_id","imported_ref","forked_from_skill_id","visibility","created_by_user_id","created_at","updated_at","archived_at","fully_qualified_slug"]}},"next_cursor":{"type":["string","null"]}},"required":["items","next_cursor"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkills","description":"List skills (system + this account). Filter by owner_kind / body_kind / q."},"post":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9-]*$"},"body_kind":{"type":"string","enum":["prompt","mcp_tool","composition","script","integration_action","model_call"]},"frontmatter":{"type":"object","additionalProperties":{}},"body":{"type":"string","minLength":1},"sidecar_files":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"composition":{"type":"object","additionalProperties":{}},"mcp_tool_spec":{"type":"object","additionalProperties":{}},"script_spec":{"type":"object","additionalProperties":{}},"binding_connector_connection_id":{"type":"string","format":"uuid"},"binding_model_catalog_slug":{"type":"string","minLength":1}},"required":["slug","body_kind","frontmatter","body"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"owner_kind":{"type":"string","enum":["system","account","project","user","agent"]},"owner_account_id":{"type":["string","null"]},"owner_project_id":{"type":["string","null"]},"owner_user_id":{"type":["string","null"]},"owner_agent_id":{"type":["string","null"]},"slug":{"type":"string"},"current_revision_id":{"type":["string","null"]},"source":{"type":"string","enum":["manual","imported","system_baseline","forked"]},"imported_from_source_id":{"type":["string","null"]},"imported_ref":{"type":["string","null"]},"forked_from_skill_id":{"type":["string","null"]},"visibility":{"type":"string","enum":["private","shared","published"]},"created_by_user_id":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]},"fully_qualified_slug":{"type":"string"}},"required":["id","owner_kind","owner_account_id","owner_project_id","owner_user_id","owner_agent_id","slug","current_revision_id","source","imported_from_source_id","imported_ref","forked_from_skill_id","visibility","created_by_user_id","created_at","updated_at","archived_at","fully_qualified_slug"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkills"}},"/v1/accounts/{accountSlug}/skills/{skillId}":{"get":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"skillId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"owner_kind":{"type":"string","enum":["system","account","project","user","agent"]},"owner_account_id":{"type":["string","null"]},"owner_project_id":{"type":["string","null"]},"owner_user_id":{"type":["string","null"]},"owner_agent_id":{"type":["string","null"]},"slug":{"type":"string"},"current_revision_id":{"type":["string","null"]},"source":{"type":"string","enum":["manual","imported","system_baseline","forked"]},"imported_from_source_id":{"type":["string","null"]},"imported_ref":{"type":["string","null"]},"forked_from_skill_id":{"type":["string","null"]},"visibility":{"type":"string","enum":["private","shared","published"]},"created_by_user_id":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]},"fully_qualified_slug":{"type":"string"}},"required":["id","owner_kind","owner_account_id","owner_project_id","owner_user_id","owner_agent_id","slug","current_revision_id","source","imported_from_source_id","imported_ref","forked_from_skill_id","visibility","created_by_user_id","created_at","updated_at","archived_at","fully_qualified_slug"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkillsBySkillId"}},"/v1/accounts/{accountSlug}/skills/{skillId}/revisions":{"get":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"skillId","in":"path"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"skill_id":{"type":"string"},"version":{"type":"string"},"body_kind":{"type":"string"},"frontmatter":{"type":"object","additionalProperties":{}},"body":{"type":"string"},"sidecar_files":{"type":"object","additionalProperties":{"type":"string"}},"composition":{"type":["object","null"],"additionalProperties":{}},"mcp_tool_spec":{"type":["object","null"],"additionalProperties":{}},"script_spec":{"type":["object","null"],"additionalProperties":{}},"binding_connector_connection_id":{"type":["string","null"]},"binding_model_catalog_slug":{"type":["string","null"]},"body_sha256":{"type":"string"},"remote_sha":{"type":["string","null"]},"remote_url":{"type":["string","null"]},"authored_by_user_id":{"type":["string","null"]},"authored_at":{"type":"string"},"changelog":{"type":["string","null"]},"deprecated":{"type":"boolean"}},"required":["id","skill_id","version","body_kind","frontmatter","body","sidecar_files","composition","mcp_tool_spec","script_spec","binding_connector_connection_id","binding_model_catalog_slug","body_sha256","remote_sha","remote_url","authored_by_user_id","authored_at","changelog","deprecated"]}}},"required":["items"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"getV1AccountsByAccountSlugSkillsBySkillIdRevisions"},"post":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"skillId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"body_kind":{"type":"string","enum":["prompt","mcp_tool","composition","script","integration_action","model_call"]},"frontmatter":{"type":"object","additionalProperties":{}},"body":{"type":"string","minLength":1},"sidecar_files":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"composition":{"type":"object","additionalProperties":{}},"mcp_tool_spec":{"type":"object","additionalProperties":{}},"script_spec":{"type":"object","additionalProperties":{}},"binding_connector_connection_id":{"type":"string","format":"uuid"},"binding_model_catalog_slug":{"type":"string","minLength":1},"changelog":{"type":"string","minLength":1,"maxLength":1000}},"required":["body_kind","frontmatter","body"]}}}},"responses":{"201":{"description":"created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"skill_id":{"type":"string"},"version":{"type":"string"},"body_kind":{"type":"string"},"frontmatter":{"type":"object","additionalProperties":{}},"body":{"type":"string"},"sidecar_files":{"type":"object","additionalProperties":{"type":"string"}},"composition":{"type":["object","null"],"additionalProperties":{}},"mcp_tool_spec":{"type":["object","null"],"additionalProperties":{}},"script_spec":{"type":["object","null"],"additionalProperties":{}},"binding_connector_connection_id":{"type":["string","null"]},"binding_model_catalog_slug":{"type":["string","null"]},"body_sha256":{"type":"string"},"remote_sha":{"type":["string","null"]},"remote_url":{"type":["string","null"]},"authored_by_user_id":{"type":["string","null"]},"authored_at":{"type":"string"},"changelog":{"type":["string","null"]},"deprecated":{"type":"boolean"}},"required":["id","skill_id","version","body_kind","frontmatter","body","sidecar_files","composition","mcp_tool_spec","script_spec","binding_connector_connection_id","binding_model_catalog_slug","body_sha256","remote_sha","remote_url","authored_by_user_id","authored_at","changelog","deprecated"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkillsBySkillIdRevisions"}},"/v1/accounts/{accountSlug}/skills/{skillId}/archive":{"post":{"tags":["Skills"],"parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"skillId","in":"path"}],"responses":{"204":{"description":"archived"},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkillsBySkillIdArchive"}},"/v1/accounts/{accountSlug}/skills/{skillId}/fork":{"post":{"tags":["Skills"],"summary":"Fork a system / account / project / user / agent skill into this account scope.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"skillId","in":"path"}],"responses":{"201":{"description":"forked","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"owner_kind":{"type":"string","enum":["system","account","project","user","agent"]},"owner_account_id":{"type":["string","null"]},"owner_project_id":{"type":["string","null"]},"owner_user_id":{"type":["string","null"]},"owner_agent_id":{"type":["string","null"]},"slug":{"type":"string"},"current_revision_id":{"type":["string","null"]},"source":{"type":"string","enum":["manual","imported","system_baseline","forked"]},"imported_from_source_id":{"type":["string","null"]},"imported_ref":{"type":["string","null"]},"forked_from_skill_id":{"type":["string","null"]},"visibility":{"type":"string","enum":["private","shared","published"]},"created_by_user_id":{"type":["string","null"]},"created_at":{"type":"string"},"updated_at":{"type":"string"},"archived_at":{"type":["string","null"]},"fully_qualified_slug":{"type":"string"}},"required":["id","owner_kind","owner_account_id","owner_project_id","owner_user_id","owner_agent_id","slug","current_revision_id","source","imported_from_source_id","imported_ref","forked_from_skill_id","visibility","created_by_user_id","created_at","updated_at","archived_at","fully_qualified_slug"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkillsBySkillIdFork","description":"Fork a system / account / project / user / agent skill into this account scope."}},"/v1/accounts/{accountSlug}/skills/{skillId}/invoke":{"post":{"tags":["Skills"],"summary":"Invoke a skill (resolve + dispatch). Returns the body-kind client output verbatim.","parameters":[{"schema":{"type":"string"},"required":true,"name":"accountSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"skillId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"inputs":{"type":"object","additionalProperties":{},"default":{}},"thread_id":{"type":"string","minLength":1,"maxLength":200},"run_id":{"type":"string","minLength":1,"maxLength":200}}}}}},"responses":{"200":{"description":"invoked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"output":{},"error":{"type":["object","null"],"properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"metrics":{"type":"object","properties":{"duration_ms":{"type":"number"},"unit_counts":{"type":"object","additionalProperties":{"type":"number"}}},"required":["duration_ms","unit_counts"]}},"required":["ok","error","metrics"]}}}},"429":{"description":"Rate limited — retry after the interval in the Retry-After header.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"postV1AccountsByAccountSlugSkillsBySkillIdInvoke","description":"Invoke a skill (resolve + dispatch). Returns the body-kind client output verbatim."}}},"webhooks":{},"servers":[{"url":"https://api.connect0.ai"}]}