{"openapi":"3.1.0","info":{"title":"backlex Cloud API","version":"0.0.1","description":"Control-plane REST API."},"servers":[{"url":"/api"}],"components":{"securitySchemes":{"sessionCookie":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"better-auth browser session cookie (sent automatically by the SPA)."},"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"pak_<hex>","description":"Org API key. `Authorization: Bearer pak_…`."}},"schemas":{"OrgMembership":{"allOf":[{"$ref":"#/components/schemas/Org"},{"type":"object","properties":{"role":{"type":"string"}},"required":["role"]}]},"Org":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"planId":{"type":"string"},"residency":{"type":"string"},"defaultRegion":{"type":"string"},"ipAllowlist":{"type":"array","items":{"type":"string"}},"webhookUrl":{"type":"string","nullable":true},"status":{"type":"string"}},"required":["id","slug","name","planId","residency","defaultRegion","ipAllowlist","webhookUrl","status"]},"AppError":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","example":"UNAUTHORIZED"},"message":{"type":"string","example":"Sign-in required"},"details":{"nullable":true}},"required":["code","message"]}},"required":["error"],"description":"Uniform error envelope."},"CreateOrgInput":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":80},"residency":{"type":"string","enum":["eu","tr","global"]},"defaultRegion":{"type":"string","enum":["ist","fra","ams","lhr","sjc","iad","sin","syd"]},"purpose":{"type":"string","maxLength":40},"teamSize":{"type":"string","maxLength":40}},"required":["name"]},"AcceptInvitationInput":{"type":"object","properties":{"token":{"type":"string","minLength":1}},"required":["token"]},"Account":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"name":{"type":"string","nullable":true},"emailVerified":{"type":"boolean"},"title":{"type":"string","nullable":true},"timezone":{"type":"string","nullable":true},"preferences":{"nullable":true}},"required":["id","email","name","emailVerified","title","timezone"]},"Ok":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]},"UpdateAccountInput":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"title":{"type":"string","maxLength":120},"timezone":{"type":"string","maxLength":60},"preferences":{"type":"object","additionalProperties":{"nullable":true}}}},"ProjectSummary":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"environment":{"type":"string"},"primaryRegion":{"type":"string","nullable":true}},"required":["id","slug","name","status","environment","primaryRegion"]},"Member":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"UpdateOrgInput":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":80},"defaultRegion":{"type":"string","enum":["ist","fra","ams","lhr","sjc","iad","sin","syd"]},"ipAllowlist":{"type":"array","items":{"type":"string","minLength":1}},"webhookUrl":{"type":"string","nullable":true,"format":"uri"}}},"Usage":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"UsageHistory":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"MemberRoleInput":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","developer","viewer"]}},"required":["role"]},"AuditEvent":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"InviteInput":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","developer","viewer"]}},"required":["email","role"]},"Project":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"CreateProjectInput":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":60},"region":{"type":"string","enum":["ist","fra","ams","lhr","sjc","iad","sin","syd"]},"dbType":{"type":"string","enum":["d1"]},"template":{"type":"string","maxLength":40}},"required":["name"]},"UpdateProjectInput":{"type":"object","properties":{"name":{"type":"string","minLength":2,"maxLength":60},"environment":{"type":"string","enum":["production","staging","development"]}}},"Backup":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"BackupInput":{"type":"object","properties":{"kind":{"type":"string","enum":["auto","manual"]}}},"PitrRestoreResult":{"type":"object","properties":{"restoredTo":{"type":"string"}},"required":["restoredTo"]},"PitrRestoreInput":{"type":"object","properties":{"timestamp":{"type":"integer","minimum":0,"exclusiveMinimum":true}},"required":["timestamp"]},"Domain":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"DomainInput":{"type":"object","properties":{"hostname":{"type":"string","minLength":3,"maxLength":253}},"required":["hostname"]},"Branch":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"Deploy":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"TenantError":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"Alarm":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"AlarmInput":{"type":"object","properties":{"metric":{"type":"string","enum":["requests","d1","r2"]},"thresholdPct":{"type":"integer","minimum":1,"maximum":100}},"required":["metric","thresholdPct"]},"BranchInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":63},"prNumber":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true}},"required":["name"]},"ApiKey":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"ApiKeyInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"scope":{"type":"string","enum":["full","deploy","read-only"]},"expiresInDays":{"type":"integer","minimum":0,"exclusiveMinimum":true},"mcpTools":{"type":"array","items":{"type":"string","maxLength":80},"maxItems":64}},"required":["name","scope"]},"Integration":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"IntegrationInput":{"type":"object","properties":{"kind":{"type":"string","enum":["slack","discord","datadog","github"]},"config":{"type":"object","additionalProperties":{"nullable":true}},"events":{"type":"array","nullable":true,"items":{"type":"string","minLength":1},"description":"Event patterns to subscribe to (e.g. `alarm.fired`); null/empty = all."}},"required":["kind"]},"Webhook":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"WebhookDelivery":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"WebhookInput":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string","minLength":1},"minItems":1}},"required":["url","events"]},"Notification":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"SsoConfig":{"type":"object","nullable":true,"properties":{},"additionalProperties":{"nullable":true}},"SsoInput":{"type":"object","properties":{"type":{"type":"string","enum":["oidc","saml"]},"enabled":{"type":"boolean"},"emailDomain":{"type":"string","nullable":true},"config":{"type":"object","additionalProperties":{"nullable":true}}},"required":["type"]},"Subscription":{"type":"object","nullable":true,"properties":{},"additionalProperties":{"nullable":true}},"Invoice":{"type":"object","properties":{},"additionalProperties":{"nullable":true}},"CheckoutInput":{"type":"object","properties":{"plan":{"type":"string","enum":["pro","scale","max"]},"interval":{"type":"string","enum":["monthly","annual"],"default":"monthly"}},"required":["plan"]},"PackCheckoutInput":{"type":"object","properties":{"type":{"type":"string","enum":["requests","neurons","r2","d1"]}},"required":["type"]}},"parameters":{}},"paths":{"/orgs":{"get":{"tags":["Account"],"summary":"List the signed-in user's organizations","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"Organizations the caller belongs to, with their role in each.","content":{"application/json":{"schema":{"type":"object","properties":{"orgs":{"type":"array","items":{"$ref":"#/components/schemas/OrgMembership"}}},"required":["orgs"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org":{"post":{"tags":["Account"],"summary":"Create an organization","security":[{"sessionCookie":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgInput"}}}},"responses":{"201":{"description":"The created organization; the caller is seated as owner.","content":{"application/json":{"schema":{"type":"object","properties":{"org":{"$ref":"#/components/schemas/Org"}},"required":["org"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/invitations/accept":{"post":{"tags":["Account"],"summary":"Accept an organization invitation","security":[{"sessionCookie":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationInput"}}}},"responses":{"200":{"description":"The slug of the organization the caller joined.","content":{"application/json":{"schema":{"type":"object","properties":{"orgSlug":{"type":"string"}},"required":["orgSlug"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/account":{"get":{"tags":["Account"],"summary":"Get the signed-in user's profile","security":[{"sessionCookie":[]}],"responses":{"200":{"description":"The caller's profile + preferences.","content":{"application/json":{"schema":{"type":"object","properties":{"account":{"$ref":"#/components/schemas/Account"}},"required":["account"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"patch":{"tags":["Account"],"summary":"Update the signed-in user's profile","security":[{"sessionCookie":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountInput"}}}},"responses":{"200":{"description":"Profile updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/overview":{"get":{"tags":["Account"],"summary":"Organization dashboard payload","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Org record, the caller's role, and a project summary.","content":{"application/json":{"schema":{"type":"object","properties":{"org":{"$ref":"#/components/schemas/Org"},"role":{"type":"string"},"projectCount":{"type":"number"},"projects":{"type":"array","items":{"$ref":"#/components/schemas/ProjectSummary"}}},"required":["org","projectCount","projects"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/members":{"get":{"tags":["Organization"],"summary":"List org members","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}},"required":["members"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}":{"patch":{"tags":["Organization"],"summary":"Update org settings","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"org":{"$ref":"#/components/schemas/Org"}},"required":["org"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"delete":{"tags":["Organization"],"summary":"Delete the organization","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/export":{"post":{"tags":["Organization"],"summary":"List a non-deleted project per downloadable SQL dump for export","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"filename":{"type":"string"}},"required":["slug","filename"]}},"exportedAt":{"type":"string"}},"required":["projects","exportedAt"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/usage":{"get":{"tags":["Organization"],"summary":"Org resource usage snapshot","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/usage/history":{"get":{"tags":["Organization"],"summary":"Durable usage history (incl. deleted projects)","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageHistory"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/scim":{"get":{"tags":["Organization"],"summary":"SCIM provisioning status","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"scimBaseUrl":{"type":"string"}},"required":["scimBaseUrl"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/scim/token":{"post":{"tags":["Organization"],"summary":"Mint a SCIM bearer token","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"201":{"description":"Token returned once.","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}},"required":["token"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"delete":{"tags":["Organization"],"summary":"Revoke SCIM provisioning","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/members/{id}":{"patch":{"tags":["Organization"],"summary":"Change a member's role","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberRoleInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"delete":{"tags":["Organization"],"summary":"Remove a member","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Member removed."},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/members/{id}/resend":{"post":{"tags":["Organization"],"summary":"Resend a pending invitation","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/audit":{"get":{"tags":["Organization"],"summary":"Org audit log","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":false,"name":"action","in":"query"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/AuditEvent"}}},"required":["events"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/invitations":{"post":{"tags":["Organization"],"summary":"Invite a member","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteInput"}}}},"responses":{"201":{"description":"Invitation created; the accept link is emailed.","content":{"application/json":{"schema":{"type":"object","properties":{"invite":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"role":{"type":"string"}},"required":["id","email","role"]}},"required":["invite"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects":{"get":{"tags":["Projects"],"summary":"List projects","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}},"required":["projects"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Projects"],"summary":"Create a project","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProjectInput"}}}},"responses":{"201":{"description":"Project created + provisioning kicked off.","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}":{"get":{"tags":["Projects"],"summary":"Get a project","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"},"latestTemplateVersion":{"type":"string","nullable":true}},"required":["project","latestTemplateVersion"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"patch":{"tags":["Projects"],"summary":"Update a project","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProjectInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"delete":{"tags":["Projects"],"summary":"Soft-delete a project","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/pause":{"post":{"tags":["Projects"],"summary":"Pause a project","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/resume":{"post":{"tags":["Projects"],"summary":"Resume a project","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/provision-retry":{"post":{"tags":["Projects"],"summary":"Retry provisioning for a failed project","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/reprovision-admin":{"post":{"tags":["Projects"],"summary":"Re-generate the project admin credential","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"project":{"$ref":"#/components/schemas/Project"}},"required":["project"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/upgrade":{"post":{"tags":["Projects"],"summary":"Upgrade the instance to the latest worker template","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"},{"schema":{"type":"string"},"required":false,"name":"version","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["upgraded","skipped","failed"]},"from":{"type":"string","nullable":true},"to":{"type":"string"},"reason":{"type":"string"},"error":{"type":"string"}},"required":["status"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/backups":{"get":{"tags":["Projects"],"summary":"List backups","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"backups":{"type":"array","items":{"$ref":"#/components/schemas/Backup"}}},"required":["backups"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Projects"],"summary":"Create a backup","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackupInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"backup":{"$ref":"#/components/schemas/Backup"}},"required":["backup"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/backups/{id}/restore":{"post":{"tags":["Projects"],"summary":"Restore a backup","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"backup":{"$ref":"#/components/schemas/Backup"}},"required":["backup"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/restore":{"post":{"tags":["Projects"],"summary":"Point-in-time restore","description":"Restore the project's database to an arbitrary instant within the plan's PITR window, using D1 Time Travel's continuous history (no captured snapshot required).","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PitrRestoreInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PitrRestoreResult"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/domains":{"get":{"tags":["Projects"],"summary":"List custom domains","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"domains":{"type":"array","items":{"$ref":"#/components/schemas/Domain"}}},"required":["domains"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Projects"],"summary":"Add a custom domain","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DomainInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"$ref":"#/components/schemas/Domain"}},"required":["domain"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/domains/{id}/verify":{"post":{"tags":["Projects"],"summary":"Verify a custom domain","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"$ref":"#/components/schemas/Domain"}},"required":["domain"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/domains/{id}":{"delete":{"tags":["Projects"],"summary":"Remove a custom domain","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/branches":{"get":{"tags":["Projects"],"summary":"List branch previews","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"branches":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}},"required":["branches"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Projects"],"summary":"Create a branch preview","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"branch":{"$ref":"#/components/schemas/Branch"}},"required":["branch"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/deploys":{"get":{"tags":["Projects"],"summary":"List deploys","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deploys":{"type":"array","items":{"$ref":"#/components/schemas/Deploy"}}},"required":["deploys"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/errors":{"get":{"tags":["Projects"],"summary":"List tenant runtime errors","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/TenantError"}}},"required":["errors"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/alarms":{"get":{"tags":["Projects"],"summary":"List usage alarms","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"alarms":{"type":"array","items":{"$ref":"#/components/schemas/Alarm"}}},"required":["alarms"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Projects"],"summary":"Create a usage alarm","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlarmInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"alarm":{"$ref":"#/components/schemas/Alarm"}},"required":["alarm"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/alarms/{id}":{"delete":{"tags":["Projects"],"summary":"Delete a usage alarm","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/projects/{projectSlug}/branches/{id}":{"delete":{"tags":["Projects"],"summary":"Delete a branch preview","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"projectSlug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/api-keys":{"get":{"tags":["Integrations"],"summary":"List API keys","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}},"required":["keys"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Integrations"],"summary":"Create an API key","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyInput"}}}},"responses":{"201":{"description":"Plaintext token returned once.","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/ApiKey"}},"required":["key"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/api-keys/{id}":{"delete":{"tags":["Integrations"],"summary":"Revoke an API key","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Key revoked."},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/integrations":{"get":{"tags":["Integrations"],"summary":"List connected integrations","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"integrations":{"type":"array","items":{"$ref":"#/components/schemas/Integration"}}},"required":["integrations"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Integrations"],"summary":"Connect an integration","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationInput"}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"integration":{"$ref":"#/components/schemas/Integration"}},"required":["integration"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/integrations/{id}":{"delete":{"tags":["Integrations"],"summary":"Disconnect an integration","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Integration disconnected."},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/webhooks":{"get":{"tags":["Integrations"],"summary":"List webhooks","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["webhooks"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"post":{"tags":["Integrations"],"summary":"Create a webhook","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}},"responses":{"201":{"description":"Signing secret returned once.","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}},"required":["webhook"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/webhook-deliveries":{"get":{"tags":["Integrations"],"summary":"Recent outbound webhook deliveries","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":false,"name":"webhookId","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}}},"required":["deliveries"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/webhooks/{id}":{"delete":{"tags":["Integrations"],"summary":"Delete a webhook","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Webhook deleted."},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/webhooks/{id}/test":{"post":{"tags":["Integrations"],"summary":"Send a test webhook delivery","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"],"additionalProperties":{"nullable":true}}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/notifications":{"get":{"tags":["Integrations"],"summary":"List notifications","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"notifications":{"type":"array","items":{"$ref":"#/components/schemas/Notification"}}},"required":["notifications"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/notifications/{id}/read":{"post":{"tags":["Integrations"],"summary":"Mark a notification read","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/notifications/read-all":{"post":{"tags":["Integrations"],"summary":"Mark all notifications read","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/sso":{"get":{"tags":["Enterprise SSO"],"summary":"Get SSO config + IdP-facing URLs","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"sso":{"$ref":"#/components/schemas/SsoConfig"},"urls":{"type":"object","properties":{"oidcRedirectUri":{"type":"string"},"samlAcsUrl":{"type":"string"},"samlEntityId":{"type":"string"},"samlMetadataUrl":{"type":"string"},"loginUrl":{"type":"string"}},"required":["oidcRedirectUri","samlAcsUrl","samlEntityId","samlMetadataUrl","loginUrl"]}},"required":["sso","urls"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"put":{"tags":["Enterprise SSO"],"summary":"Configure SSO (OIDC / SAML)","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SsoInput"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"sso":{"$ref":"#/components/schemas/SsoConfig"}},"required":["sso"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}},"delete":{"tags":["Enterprise SSO"],"summary":"Disable SSO","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/billing":{"get":{"tags":["Billing"],"summary":"Billing snapshot: plan, subscription, invoices","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string"},"subscription":{"$ref":"#/components/schemas/Subscription"},"invoices":{"type":"array","items":{"$ref":"#/components/schemas/Invoice"}},"packs":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"quantity":{"type":"number"},"unitsPerPack":{"type":"number"},"status":{"type":"string"}},"required":["type","quantity","unitsPerPack","status"]}},"topups":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"units":{"type":"number"}},"required":["type","units"]}},"enforcement":{"type":"object","properties":{"requestThrottled":{"type":"boolean"},"storageReadOnly":{"type":"boolean"}},"required":["requestThrottled","storageReadOnly"]},"paymentMethod":{"type":"object","nullable":true,"properties":{"cardBrand":{"type":"string","nullable":true},"cardLastFour":{"type":"string","nullable":true},"renewsAt":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"customerPortalUrl":{"type":"string","nullable":true},"updatePaymentMethodUrl":{"type":"string","nullable":true}},"required":["cardBrand","cardLastFour","renewsAt","status","customerPortalUrl","updatePaymentMethodUrl"]}},"required":["plan","subscription","invoices","packs","topups","enforcement","paymentMethod"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/billing/checkout":{"post":{"tags":["Billing"],"summary":"Start a hosted checkout for a paid plan","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutInput"}}}},"responses":{"200":{"description":"Hosted checkout URL to redirect to.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/billing/packs/checkout":{"post":{"tags":["Billing"],"summary":"Start a hosted checkout for a prepaid usage pack","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackCheckoutInput"}}}},"responses":{"200":{"description":"Hosted checkout URL to redirect to.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/billing/subscription/cancel":{"post":{"tags":["Billing"],"summary":"Cancel the active subscription at period end","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Cancelled subscription state.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true}},"required":["status","endsAt"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}},"/org/{slug}/billing/subscription/resume":{"post":{"tags":["Billing"],"summary":"Resume a subscription cancelled within its grace period","security":[{"sessionCookie":[]}],"parameters":[{"schema":{"type":"string"},"required":true,"name":"slug","in":"path"}],"responses":{"200":{"description":"Resumed subscription state.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true}},"required":["status","endsAt"]}}}},"400":{"description":"Malformed payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"401":{"description":"Authentication required.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"403":{"description":"Insufficient role / forbidden.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"404":{"description":"Not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"409":{"description":"Conflict.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"422":{"description":"Request validation failed (code VALIDATION).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}},"429":{"description":"Rate limited.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppError"}}}}}}}}}