{"openapi":"3.0.3","info":{"title":"Flexday AI API","version":"2.0.0","description":"Generated from Zod schemas (schema-first). Edge validation, static types, and this spec share one source of truth."},"servers":[{"url":"https://api.flexday.ai"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"FormSpec":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":2000},"fields":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$"},"label":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","textarea","number","email","phone","url","date","time","datetime","select","multiselect","checkbox","file","info"]},"required":{"type":"boolean"},"help":{"type":"string","minLength":1,"maxLength":1000},"hint":{"type":"string","minLength":1,"maxLength":1000},"placeholder":{"type":"string","minLength":1,"maxLength":500},"options":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"value":{"type":"string","minLength":1,"maxLength":200}},"required":["label","value"],"additionalProperties":false},"minItems":1,"maxItems":100},"showWhen":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"values":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"minItems":1}},"required":["field","values"],"additionalProperties":false},"rules":{"type":"object","properties":{"minLength":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":8000},"maxLength":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":8000},"min":{"type":"number"},"max":{"type":"number"},"message":{"type":"string","minLength":1,"maxLength":500},"example":{"type":"string","minLength":1,"maxLength":500},"formatDescription":{"type":"string","minLength":1,"maxLength":500},"format":{"type":"string","enum":["digits","letters","alphanumeric","slug","hex","uuid","no_whitespace","postal_code_us"]},"startsWith":{"type":"string","minLength":1,"maxLength":200},"endsWith":{"type":"string","minLength":1,"maxLength":200},"contains":{"type":"string","minLength":1,"maxLength":200},"allowedDomains":{"type":"array","items":{"type":"string","minLength":1,"maxLength":253},"minItems":1,"maxItems":50},"blockedDomains":{"type":"array","items":{"type":"string","minLength":1,"maxLength":253},"minItems":1,"maxItems":50}},"additionalProperties":false},"calendar":{"type":"object","properties":{"workingDays":{"type":"array","items":{"type":"integer","minimum":0,"maximum":6},"minItems":1,"maxItems":7},"holidays":{"type":"array","items":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"maxItems":200},"workingHoursStart":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},"workingHoursEnd":{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"}},"additionalProperties":false},"file":{"type":"object","properties":{"fileStoreId":{"type":"string","minLength":1,"maxLength":128},"studioFolder":{"type":"string","minLength":1,"maxLength":512},"maxFiles":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":10},"maxBytes":{"type":"integer","minimum":0,"exclusiveMinimum":true},"accept":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[a-z0-9!#$&^_.+-]+\\/(?:[a-z0-9!#$&^_.+-]+|\\*)$"},"minItems":1,"maxItems":100}},"required":["fileStoreId"],"additionalProperties":false},"colSpan":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"type":"number","enum":[3]}]}},"required":["id","label","type"],"additionalProperties":false},"maxItems":40},"submitLabel":{"type":"string","minLength":1,"maxLength":100},"submittedMessage":{"type":"string","minLength":1,"maxLength":2000},"layout":{"type":"object","properties":{"columns":{"anyOf":[{"type":"number","enum":[1]},{"type":"number","enum":[2]},{"type":"number","enum":[3]}]}},"required":["columns"],"additionalProperties":false},"collection":{"type":"object","properties":{"mode":{"type":"string","enum":["card","sequential"]},"intro":{"type":"string","minLength":1,"maxLength":1000}},"required":["mode"],"additionalProperties":false},"store":{"type":"object","properties":{"enabled":{"type":"boolean"},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["enabled"],"additionalProperties":false}},"required":["fields"],"additionalProperties":false},"Card":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["document"]},"cardId":{"type":"string","minLength":1},"file":{"type":"object","properties":{"fileId":{"type":"string","minLength":1},"fileStoreId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"mediaType":{"type":"string","minLength":1},"sizeBytes":{"type":"number","minimum":0},"sha256":{"type":"string","minLength":1},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true}},"required":["fileId","fileStoreId","name","mediaType","sizeBytes","sha256","version"],"additionalProperties":false},"presentation":{"type":"object","properties":{"title":{"type":"string"},"caption":{"type":"string"},"canDownload":{"type":"boolean"},"downloadName":{"type":"string","minLength":1,"pattern":"^[^/\\\\]+$"},"display":{"type":"string","enum":["inline","link"]}},"required":["canDownload"],"additionalProperties":false}},"required":["kind","cardId","file","presentation"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["form"]},"requestId":{"type":"string","minLength":1},"spec":{"$ref":"#/components/schemas/FormSpec"},"errors":{"type":"object","additionalProperties":{"type":"string"}},"state":{"type":"string","enum":["active","submitting","completed"]}},"required":["kind","requestId","spec"],"additionalProperties":false}]},"DocumentPreview":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["pdf"]},"mediaType":{"type":"string","enum":["application/pdf"]},"sizeBytes":{"type":"number"}},"required":["kind","mediaType","sizeBytes"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["text"]},"text":{"type":"string"},"language":{"type":"string","enum":["plain","markdown","json","code"]},"truncated":{"type":"boolean"}},"required":["kind","text","truncated"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["table"]},"sheets":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"rows":{"type":"array","items":{"type":"array","items":{"type":"string"}}},"truncatedRows":{"type":"boolean"},"truncatedColumns":{"type":"boolean"}},"required":["name","rows","truncatedRows","truncatedColumns"],"additionalProperties":false}},"truncated":{"type":"boolean"}},"required":["kind","sheets","truncated"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["image"]},"mediaType":{"type":"string","enum":["image/png","image/jpeg","image/gif","image/webp"]},"sizeBytes":{"type":"number"}},"required":["kind","mediaType","sizeBytes"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["unavailable"]},"reason":{"type":"string","enum":["unsupported","too_large","parse_failed"]}},"required":["kind","reason"],"additionalProperties":false}]},"AgentTurnMetadata":{"type":"object","properties":{"citations":{"type":"array","items":{"type":"object","properties":{"documentName":{"type":"string"},"documentId":{"type":"string"}},"required":["documentName"],"additionalProperties":false}},"cards":{"type":"array","items":{"$ref":"#/components/schemas/Card"}},"previewAsAudiences":{"type":"array","items":{"type":"string"},"description":"FAI-902 — the preview scope this turn ran under, when it was sent with one."}}},"SuggestFormRulesBody":{"type":"object","properties":{"fieldLabel":{"type":"string","minLength":1,"maxLength":200},"fieldType":{"type":"string","enum":["text","textarea","number","email","phone","url","date","time","datetime","select","multiselect","checkbox","file","info"]},"example":{"type":"string","minLength":1,"maxLength":500},"formatDescription":{"type":"string","minLength":1,"maxLength":500}},"additionalProperties":false},"SuggestedFormRules":{"type":"object","properties":{"minLength":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":8000},"maxLength":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":8000},"message":{"type":"string","maxLength":500},"example":{"type":"string","maxLength":500},"formatDescription":{"type":"string","maxLength":500},"format":{"type":"string","enum":["digits","letters","alphanumeric","slug","hex","uuid","no_whitespace","postal_code_us"]},"startsWith":{"type":"string","maxLength":200},"endsWith":{"type":"string","maxLength":200},"contains":{"type":"string","maxLength":200},"allowedDomains":{"type":"array","items":{"type":"string","maxLength":253},"maxItems":50},"blockedDomains":{"type":"array","items":{"type":"string","maxLength":253},"maxItems":50}},"additionalProperties":false},"GatewayFlowAcceptedResponse":{"type":"object","properties":{"executionId":{"type":"string","description":"The tracking id - poll it, and the Flow reads it as {{run.executionId}}."},"runId":{"type":"string","nullable":true,"description":"The Flow run this execution started - the run's own {{run.id}}. Null only when no run row exists for it (yet)."},"status":{"type":"string","enum":["running"]},"poll":{"type":"string","description":"Where to follow this execution: the gateway's own address `/api/{slug}/_/executions/{executionId}`, relative to the origin that was called. Poll it with the same credential that started the run (the bearer, or the anonymous execution token). The `Location` header carries the same value."},"interactionContractVersion":{"type":"number","enum":[1]},"pollToken":{"type":"string","description":"The anonymous execution token (also sent as the X-Poll-Token header). Absent for a verified caller."}},"required":["executionId","runId","status","poll","interactionContractVersion"]},"FlowInteractionActions":{"type":"object","properties":{"submit":{"type":"string","description":"Form only, and only while it is still open: POST exactly one response here."},"preview":{"type":"string","description":"Document only: the bounded, inert preview representation."},"file":{"type":"string","description":"Document only, and only when the resolved download policy allows it."}}},"FlowInteractionProjection":{"type":"object","properties":{"card":{"nullable":true,"description":"The neutral Card (document | form). Never a credential."},"actions":{"$ref":"#/components/schemas/FlowInteractionActions"},"version":{"type":"integer","minimum":0,"description":"Optimistic form version. Send it as expectedVersion on submit."},"status":{"type":"string","enum":["presented","awaiting","completed","timed_out","cancelled"]},"deadlineAt":{"type":"string","nullable":true},"reaskCount":{"type":"integer","minimum":0}},"required":["actions","version","status","deadlineAt","reaskCount"]},"GatewayFlowSyncResponse":{"type":"object","properties":{"executionId":{"type":"string"},"runId":{"type":"string","nullable":true,"description":"The Flow run this execution started - the run's own {{run.id}}. Null only when no run row exists for it (yet)."},"status":{"type":"string","description":"The execution's status: terminal, or `running` when a Respond step answered while the run keeps working (see `responded`)."},"poll":{"type":"string","description":"The execution's address - the same value as the 202's `poll`, the gateway's own `/api/{slug}/_/executions/{executionId}`. Follow it with the same credential to see the rest of a `running` run, or to read its cards again later."},"data":{"nullable":true,"description":"The Flow's Respond body - the same `data` a sync call returns. Null when no Respond step answered."},"httpStatus":{"type":"integer","description":"The status code a sync call to the same Flow answers: the Respond step's own status (default 200). With no Respond step, 502 for a run that failed (the sync FLOW_FAILED) and 200 otherwise."},"responded":{"type":"boolean","description":"True once a Respond step has answered. A Flow can answer and keep working: `status` then stays `running` (no new status value - older clients switch on it) while `responded: true` says `data` is already the answer."},"interactionContractVersion":{"type":"number","enum":[1]},"cards":{"type":"array","items":{"$ref":"#/components/schemas/FlowInteractionProjection"}},"pollToken":{"type":"string"}},"required":["executionId","runId","status","poll","httpStatus","responded","interactionContractVersion","cards"]},"GatewayFlowFailedResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["FLOW_FAILED"]},"message":{"type":"string","description":"The reason's sentence - `detail.message` - or \"The run failed.\" when no reason was recorded."},"executionId":{"type":"string"},"runId":{"type":"string","nullable":true,"description":"The Flow run this execution started - the run's own {{run.id}}. Null only when no run row exists for it (yet)."},"detail":{"type":"object","nullable":true,"properties":{"code":{"type":"string","enum":["FLOW_FAILED","FLOW_CANCELLED","FLOW_TIMED_OUT"],"description":"`FLOW_FAILED` - a step failed, or the run failed outside any one step. `FLOW_TIMED_OUT` - a step ran past its own time limit, or nobody answered a Form before its deadline (the execution's `status` is still `failed`). `FLOW_CANCELLED` - the run was cancelled."},"step":{"type":"string","nullable":true,"description":"The name of the step that failed, as the Flow names it. Null when the run ended outside any one step (a cancel, a refusal before the first step)."},"message":{"type":"string","description":"Why, in a sentence safe to show the caller: a reason the platform wrote for a person (for example \"The service answered with HTTP 503.\"), the text of a Terminate step, or a generic sentence (\"The step failed.\") when the reason could name something internal. Never a URL, a file path, a table or a host."}},"required":["code","step","message"],"description":"Why the run failed - the same value the progress reply's `error` carries for this execution (`FLOW_FAILED` or `FLOW_TIMED_OUT`, the failed step's name, a caller-safe message). Null only for an execution an older release finished."}},"required":["code","message","executionId","runId","detail"]}},"required":["error"]},"Tenant":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["provisioning","active","suspended","offboarding","deleted"]},"planId":{"type":"string","nullable":true},"supportAccessEnabled":{"type":"boolean","description":"Whether Flexday AI staff may impersonate this workspace (owner-controlled consent)."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","slug","name","status","planId","supportAccessEnabled","createdAt","updatedAt"]},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"CreateTenantInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"Display name."},"slug":{"type":"string","minLength":1,"description":"Optional DNS-safe slug; derived from the name when omitted."}},"required":["name"]},"TenantMembership":{"allOf":[{"$ref":"#/components/schemas/Tenant"},{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member","viewer"]}},"required":["role"]}]},"UpdateTenantInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"New display name (slug is immutable)."}},"required":["name"]},"AiSettingsMap":{"type":"object","additionalProperties":{"type":"string"},"description":"use-case -> catalog model id"},"EffectiveModelEntry":{"type":"object","properties":{"useCase":{"type":"string","description":"agent | agent_judge | builder | definition | profiling | ontology | embedding"},"provider":{"type":"string"},"model":{"type":"string"},"source":{"type":"string","enum":["resource","tenant","env"],"description":"Which layer set it — 'tenant' = override, 'env' = platform default"},"catalogId":{"type":"string"},"dims":{"type":"integer","minimum":0,"exclusiveMinimum":true}},"required":["useCase","provider","model","source"]},"AiSettingsInput":{"type":"object","properties":{"settings":{"$ref":"#/components/schemas/AiSettingsMap"}},"required":["settings"]},"TenantMember":{"type":"object","properties":{"userId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"status":{"type":"string"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["userId","role","status","name","email","createdAt","updatedAt"]},"UpdateMemberRoleInput":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","member","viewer"],"description":"The new role."}},"required":["role"]},"TenantInvitation":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"status":{"type":"string","enum":["pending","accepted","revoked"]},"invitedBy":{"type":"string","nullable":true},"expiresAt":{"type":"string"},"acceptedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","tenantId","email","role","status","invitedBy","expiresAt","acceptedAt","createdAt"]},"CreatedTenantInvitation":{"allOf":[{"$ref":"#/components/schemas/TenantInvitation"},{"type":"object","properties":{"token":{"type":"string","description":"One-time raw token - shown ONCE (never stored)."},"acceptUrl":{"type":"string"}},"required":["token","acceptUrl"]}]},"CreateInvitationInput":{"type":"object","properties":{"email":{"type":"string","minLength":1,"description":"Invitee email address."},"role":{"type":"string","enum":["admin","member","viewer"],"description":"Invited role (default member)."}},"required":["email"]},"TenantIdentityConfig":{"type":"object","properties":{"provider":{"type":"string","nullable":true,"enum":["entra","oidc"]},"issuer":{"type":"string","nullable":true},"audience":{"type":"string","nullable":true},"allowedTenantIds":{"type":"array","items":{"type":"string"}},"jwksUri":{"type":"string","nullable":true}},"required":["provider","issuer","audience","allowedTenantIds","jwksUri"]},"UpdateTenantIdentityConfigInput":{"type":"object","properties":{"provider":{"type":"string","nullable":true,"enum":["entra","oidc"],"description":"Identity provider; null clears the opt-in (platform config governs)."},"issuer":{"type":"string","nullable":true},"audience":{"type":"string","nullable":true},"allowedTenantIds":{"type":"array","items":{"type":"string"},"description":"Multi-tenant Entra home-tenant allow-list (empty ⇒ no restriction)."},"jwksUri":{"type":"string","nullable":true}}},"OffboardTenantInput":{"type":"object","properties":{"confirm":{"type":"string","minLength":1,"description":"Double-confirm token - MUST equal the tenant slug."}},"required":["confirm"]},"SupportAccessInput":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether Flexday AI staff may impersonate this workspace. Off refuses new support sessions AND ends live ones on their next request."}},"required":["enabled"]},"SupportSession":{"type":"object","properties":{"id":{"type":"string"},"staffName":{"type":"string","nullable":true},"role":{"type":"string"},"escalated":{"type":"boolean","description":"True when the grant was minted write-capable (above viewer)."},"reason":{"type":"string"},"status":{"type":"string","enum":["active","revoked","expired"]},"startedAt":{"type":"string"},"expiresAt":{"type":"string"},"revokedAt":{"type":"string","nullable":true}},"required":["id","staffName","role","escalated","reason","status","startedAt","expiresAt","revokedAt"]},"AutoJoinDomainsInput":{"type":"object","properties":{"domains":{"type":"array","items":{"type":"string"},"description":"Verified-email domains that auto-join as member. Empty ⇒ off."}},"required":["domains"]},"BindingDescriptor":{"type":"object","properties":{"provider":{"type":"string","description":"Auth provider registry id (entra-workforce / cognito / …)."},"mode":{"type":"string","enum":["pooled","silo","federated"]},"issuer":{"type":"string"},"authority":{"type":"string","description":"MSAL authority URL (entra*)."},"clientId":{"type":"string","description":"Public app-registration / app-client id."},"scope":{"type":"string","description":"Requested scope string."},"cognitoDomain":{"type":"string","description":"Cognito hosted-UI OAuth domain."},"region":{"type":"string","description":"AWS region (Cognito)."},"authorizeUrl":{"type":"string","description":"BYO-SSO federated authorize URL."}},"required":["provider","mode"]},"TenantBindingDescriptor":{"allOf":[{"$ref":"#/components/schemas/BindingDescriptor"},{"type":"object","properties":{"status":{"type":"string","enum":["active","unavailable"]}},"required":["status"]}]},"DiscoverLoginOption":{"type":"object","properties":{"slug":{"type":"string","description":"The tenant to route the login through (/t/:slug)."},"label":{"type":"string","description":"Human label for the chooser (org name)."},"provider":{"type":"string","description":"Provider kind, for the button copy."}},"required":["slug","label","provider"]},"DiscoverLoginResult":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["default"]}},"required":["mode"]},{"type":"object","properties":{"mode":{"type":"string","enum":["tenant"]},"slug":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"}},"required":["mode","slug","label","provider"]},{"type":"object","properties":{"mode":{"type":"string","enum":["choice"]},"options":{"type":"array","items":{"$ref":"#/components/schemas/DiscoverLoginOption"}}},"required":["mode","options"]}]},"DiscoverLoginInput":{"type":"object","properties":{"email":{"type":"string","minLength":3,"maxLength":320,"description":"The user email - only its DOMAIN is used to resolve the IdP.","example":"you@acme.com"}},"required":["email"]},"PublicAddressTemplates":{"type":"object","properties":{"workspaceUrlTemplate":{"type":"string","description":"e.g. https://app.flexday.io/t/{slug}"},"appsOriginTemplate":{"type":"string","description":"e.g. https://{slug}.apps.flexday.io, or the bare apps origin below mode publish"},"appsOriginIsTenantHost":{"type":"boolean","description":"True when appsOriginTemplate carries the {slug} placeholder."}},"required":["workspaceUrlTemplate","appsOriginTemplate","appsOriginIsTenantHost"]},"GrantPlatformAdminInput":{"type":"object","properties":{"actorId":{"type":"string","minLength":1,"description":"The actor to grant platform-admin."},"role":{"type":"string","enum":["super","support","read_only"],"description":"The platform role (explicit - no silent super)."},"note":{"type":"string"}},"required":["actorId","role"]},"SetPlatformAdminRoleInput":{"type":"object","properties":{"role":{"type":"string","enum":["super","support","read_only"],"description":"The new platform role."}},"required":["role"]},"AdjustTenantQuotaInput":{"type":"object","properties":{"maxSchemas":{"type":"integer","minimum":0},"maxRowsSoft":{"type":"integer","minimum":0},"maxRowsHard":{"type":"integer","minimum":0},"maxStorageBytes":{"type":"integer","minimum":0},"maxStorageBytesSoft":{"type":"integer","minimum":0},"maxAiTokensSoft":{"type":"integer","minimum":0},"maxAiTokensHard":{"type":"integer","minimum":0},"rateLimitMax":{"type":"integer","minimum":0},"rateLimitWindowMs":{"type":"integer","minimum":0,"exclusiveMinimum":true},"retentionDays":{"type":"integer","minimum":0,"exclusiveMinimum":true}}},"SetTenantPlanInput":{"type":"object","properties":{"planId":{"type":"string","minLength":1,"description":"The plan id (free|team|enterprise|…)."}},"required":["planId"]},"ImpersonationHandoff":{"type":"object","properties":{"handoffCode":{"type":"string","description":"Single-use authorization code (≈30s TTL) - redeem at POST /api/v1/impersonation/redeem."},"expiresAt":{"type":"string","description":"When the CODE stops being redeemable (ISO) - not the session expiry."},"studioUrl":{"type":"string","description":"The studio-ui landing that redeems the code (`<studio>/t/<slug>?impersonation_code=…`)."},"sessionId":{"type":"string","description":"The durable impersonation session id (listable/revocable)."},"tenantId":{"type":"string"},"tenantSlug":{"type":"string"},"role":{"type":"string"},"seeAsUser":{"type":"boolean","description":"FAI-680: the session is scoped by Solution grants rather than bypassing the boundary."}},"required":["handoffCode","expiresAt","studioUrl","sessionId","tenantId","tenantSlug","role","seeAsUser"]},"ImpersonateInput":{"type":"object","properties":{"tenantId":{"type":"string","minLength":1,"description":"The tenant to act as."},"role":{"type":"string","enum":["viewer","member","admin"],"description":"Target role (≤ admin; default viewer — read-only). Above viewer is an ESCALATED, separately-audited grant."},"reason":{"type":"string","minLength":3,"description":"Required justification, recorded on every audited row."},"ttlMs":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":3600000,"description":"Token lifetime (≤ 1h)."},"seeAsUser":{"type":"boolean","description":"FAI-680: see the workspace as a member does - drop the Solution-boundary bypass, so only Solutions shared with the support account are visible. Default false (see everything); orthogonal to `role`, which decides what may be CHANGED."}},"required":["tenantId","reason"]},"AdminConfirmSlugInput":{"type":"object","properties":{"confirm":{"type":"string","minLength":1,"description":"The tenant slug, echoed back as a destructive-action double-confirm."}},"required":["confirm"]},"AdminSetOwnerInput":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"The owner email (assigned on-behalf)."},"transfer":{"type":"boolean","description":"Demote all other active owners to admin (single-owner transfer)."}},"required":["email"]},"ImpersonationGrant":{"type":"object","properties":{"token":{"type":"string","description":"The platform-issued impersonation JWT (present as the ordinary Authorization bearer)."},"sessionId":{"type":"string","description":"The durable session id (= the token jti — the revocation handle)."},"tenantId":{"type":"string"},"tenantSlug":{"type":"string"},"role":{"type":"string","description":"The impersonated member role (viewer|member|admin)."},"reason":{"type":"string"},"expiresAt":{"type":"string","description":"When the SESSION (and token) hard-expires (ISO)."}},"required":["token","sessionId","tenantId","tenantSlug","role","reason","expiresAt"]},"RedeemImpersonationInput":{"type":"object","properties":{"code":{"type":"string","minLength":1,"description":"The single-use handoff code from POST /admin/impersonate (≈30s TTL)."}},"required":["code"]},"AdminUpsertBindingInput":{"type":"object","properties":{"provider":{"type":"string","minLength":1,"description":"Auth provider id (cognito / entra-workforce / entra-external / oidc / saml)."},"mode":{"type":"string","enum":["pooled","silo","federated"]},"issuer":{"type":"string","description":"The IdP issuer (globally unique across bindings)."},"jwksUri":{"type":"string"},"audience":{"type":"string","description":"Token audience / app-client id basis."},"clientId":{"type":"string","description":"Public app-client id (folded into metadata → descriptor)."},"cognitoDomain":{"type":"string","description":"Cognito hosted-UI OAuth domain."},"region":{"type":"string","description":"AWS region (Cognito) / data residency."}},"required":["provider"]},"AdminPromoteSiloInput":{"type":"object","properties":{"provider":{"type":"string","minLength":1},"issuer":{"type":"string","minLength":1,"description":"The dedicated pool's issuer."},"audience":{"type":"string","minLength":1,"description":"The dedicated pool's app-client id."},"region":{"type":"string"},"jwksUri":{"type":"string"},"cognitoDomain":{"type":"string"},"userPoolId":{"type":"string","description":"Cognito user-pool id (folded into metadata)."}},"required":["provider","issuer","audience"]},"AdminDemotePooledInput":{"type":"object","properties":{"provider":{"type":"string","minLength":1,"description":"The provider whose tenant-own binding to drop (→ pooled default)."}},"required":["provider"]},"ModelCatalogEntry":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"kind":{"type":"string","enum":["chat","embedding","rerank"]},"label":{"type":"string"},"tier":{"type":"string","enum":["default","fast"]},"dims":{"type":"integer","minimum":0,"exclusiveMinimum":true},"hasPricing":{"type":"boolean"},"available":{"type":"boolean"},"unavailableReason":{"type":"string"}},"required":["id","provider","kind","label"]},"AuditEntry":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string"},"tableName":{"type":"string"},"rowId":{"type":"string"},"actorId":{"type":"string"},"actorName":{"type":"string","nullable":true},"impersonatorId":{"type":"string","nullable":true},"impersonatorName":{"type":"string","nullable":true},"impersonationReason":{"type":"string","nullable":true},"changed":{"nullable":true},"at":{"type":"string"}},"required":["id","action","tableName","rowId","actorId","actorName","impersonatorId","impersonatorName","impersonationReason","at"]},"TenantMeterRow":{"type":"object","properties":{"metric":{"type":"string"},"period":{"type":"string"},"value":{"type":"number"},"flags":{"type":"string","nullable":true}},"required":["metric","period","value","flags"]},"SearchHit":{"type":"object","properties":{"kind":{"type":"string","enum":["solution","launchpad","fact_base","data_portrait","doc_base","document","file_store","file","flow","agent","bot","gateway","identity","connection","template","person"]},"id":{"type":"string"},"title":{"type":"string"},"subtitle":{"type":"string","nullable":true},"solutionId":{"type":"string","nullable":true,"description":"The owning Solution, or null for people and templates."},"solutionName":{"type":"string","nullable":true},"parentId":{"type":"string","nullable":true,"description":"The owning Doc Base / File Store for a Document or File; null otherwise."},"ownerName":{"type":"string","nullable":true,"description":"The creator's name, or a person's workspace role."},"matchedOn":{"type":"string","enum":["name","slug","description","owner","email"]},"updatedAt":{"type":"string","nullable":true}},"required":["kind","id","title","subtitle","solutionId","solutionName","parentId","ownerName","matchedOn","updatedAt"]},"AcceptInvitationResult":{"type":"object","properties":{"tenantId":{"type":"string"},"tenantSlug":{"type":"string"},"role":{"type":"string","enum":["owner","admin","member","viewer"]},"alreadyMember":{"type":"boolean"}},"required":["tenantId","tenantSlug","role","alreadyMember"]},"AcceptInvitationInput":{"type":"object","properties":{"token":{"type":"string","minLength":1,"description":"The raw invitation token."}},"required":["token"]},"IdentityKind":{"type":"string","enum":["oidc_jwt","static_jwks","shared_secret_jwt","api_key","hmac","basic","oauth2_introspection","saml_federated","mtls"],"description":"How a caller proves who they are. `oidc_jwt` (JWKS signature + iss/aud/exp, with OIDC discovery) is the default and covers every standard IdP; the other kinds land in later chunks and refuse verification until then."},"IdentityListItem":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"solutionId":{"type":"string","nullable":true},"solutionName":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"kind":{"$ref":"#/components/schemas/IdentityKind"},"provider":{"type":"string"},"entraTenantId":{"type":"string","nullable":true},"oboConfigured":{"type":"boolean"},"gatewayCount":{"type":"number"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string","nullable":true}},"required":["id","name","description","solutionId","kind","provider","entraTenantId","oboConfigured","gatewayCount","updatedAt","updatedBy"]},"IdentityConfig":{"type":"object","properties":{"algs":{"type":"array","items":{"type":"string"},"description":"Accepted JWT signature algorithms. Defaults to the supported asymmetric set (RS/PS/ES 256–512). HS* is refused here — a shared-secret JWT is its own kind.","example":["RS256","ES256"]},"tokenUse":{"type":"string","enum":["id","access","any"]},"hostedDomain":{"type":"string"},"tokenEndpoint":{"type":"string","description":"Where the Flex Gateway redeems a served app's authorization code, when the issuer publishes no `.well-known/openid-configuration` to discover it from (the `jwksUri` escape hatch, for the token endpoint). Must be an absolute http(s) URL and not a private/loopback IP literal. Only meaningful on a kind whose users sign in through an OIDC redirect.","example":"https://oauth2.googleapis.com/token"},"staticJwks":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["keys"]},"publicKeysPem":{"type":"array","items":{"type":"string"}},"apiKey":{"type":"object","properties":{"header":{"type":"string"},"prefix":{"type":"string"}},"additionalProperties":false},"hmac":{"type":"object","properties":{"signatureHeader":{"type":"string"},"timestampHeader":{"type":"string"},"algorithm":{"type":"string","enum":["sha256","sha512"]},"toleranceSec":{"type":"number"}},"additionalProperties":false},"basic":{"type":"object","properties":{"username":{"type":"string"}},"additionalProperties":false},"introspection":{"type":"object","properties":{"endpoint":{"type":"string","description":"Where to ask about an opaque token. Must be an absolute http(s) URL and not a private/loopback IP literal. Defaults to the provider preset (e.g. https://api.github.com/user)."},"clientId":{"type":"string"},"mode":{"type":"string","enum":["introspect","userinfo"],"description":"`introspect` is RFC 7662 (POST token=… with client auth). `userinfo` calls a plain user endpoint WITH the token — what GitHub, X and Facebook actually offer, and the default for those presets."},"subjectClaim":{"type":"string","description":"Which response field carries the stable user id. Dot-path aware (X's /2/users/me wraps its payload, so `data.id`). Defaults per preset, else `sub`.","example":"data.id"},"authStyle":{"type":"string","enum":["basic","post"]},"tokenParam":{"type":"string","enum":["bearer","query"],"description":"How a `userinfo` call presents the token: an `Authorization: Bearer` header (default) or `?access_token=` (the Facebook Graph API)."},"appSecretProof":{"type":"boolean","description":"Facebook's `appsecret_proof` — an HMAC of the token under the app secret (the shared secret), so a stolen token alone cannot be used."},"cacheTtlSec":{"type":"number","description":"How long a POSITIVE result is cached, keyed by the token hash (0 disables; max 300). Negatives are never cached. Kept short so a revoked token cannot keep working."},"timeoutMs":{"type":"number","description":"How long to wait for the issuer before failing CLOSED (1–30000, default 3000)."}},"additionalProperties":false},"providerConfig":{"type":"object","additionalProperties":{"type":"string"},"description":"Per-provider fields for the chosen `provider` preset. The allowed keys are exactly that preset's `providerConfig` fields from GET /api/v1/identity-providers; anything else is rejected.","example":{"org":"acme","authServerId":"default"}},"claimMap":{"type":"object","properties":{"subject":{"type":"array","items":{"type":"string"}},"email":{"type":"array","items":{"type":"string"}},"displayName":{"type":"array","items":{"type":"string"}},"groups":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"description":"Which claims name the caller's subject / email / display name / groups. Resolved PER FIELD: this wins, else the provider preset's default, else the gateway default (`sub` then `oid`). Each name is read as an exact claim first and only then as a dot-path, so a namespaced Auth0 claim and a nested `realm_access.roles` both work. Rejected on a machine kind (api_key/hmac/basic/mtls), which has no claim set.","example":{"subject":["sub"],"groups":["realm_access.roles"]}},"authorization":{"type":"object","properties":{"requiredScopes":{"type":"array","items":{"type":"string"},"description":"Scopes the caller must hold — ALL of them. Read from `scp`, `scope` (space-delimited) and `scopes`, unioned. A missing scope is a 403 INSUFFICIENT_SCOPE, never a 401.","example":["read:data"]},"requiredClaims":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","minLength":1,"description":"The claim name, dot-path aware."},"anyOf":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"minItems":1,"description":"The claim must EQUAL one of these (same-type, no coercion)."}},"required":["path","anyOf"],"additionalProperties":false}},{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}}],"description":"Claim requirements. The array form is the documented shape (it can express non-string values, e.g. `email_verified` anyOf `[true, \"true\"]`); the `{ claim: values }` object form accepted since chunk 1 is normalized to it. An array claim satisfies a rule when ANY member matches, which is how a groups/roles requirement is expressed. A failure is 403 CLAIM_REQUIREMENT_FAILED.","example":[{"path":"realm_access.roles","anyOf":["ops"]}]},"emailDomains":{"type":"array","items":{"type":"string"},"description":"Bare domains the claim-mapped email must belong to, matched EXACTLY (case-insensitive) — list a subdomain in its own right. A token with no email claim fails closed. A failure is 403 EMAIL_DOMAIN_FORBIDDEN.","example":["acme.com"]}},"additionalProperties":false,"description":"Post-verify authorization rules — the 401/403 split. Verification answers \"who are you?\"; these answer \"are you allowed?\". Only enforced for a kind that verifies a claim set (rejected on api_key / hmac / basic / mtls, which carry none)."},"federationVia":{"type":"string","enum":["cognito","entra-external","oidc"],"description":"For a `saml_federated` identity: which provider mints the OIDC token your callers actually present. SAML is browser-redirect and assertion-based, so there is no SAML token an API can verify — the customer signs in through their SAML IdP against a pool (a Cognito user pool, an Entra External ID tenant, or any OIDC issuer), and the pool issues the token. Required on that kind, rejected on every other.","example":"cognito"},"mtls":{"type":"object","properties":{"fingerprints":{"type":"array","items":{"type":"string"},"description":"Accepted client-certificate sha256 fingerprints in hex; colons and case are ignored.","example":["AB:CD:…"]},"subjectPatterns":{"type":"array","items":{"type":"string"},"description":"Accepted subject DNs — exact (case-insensitive) or a `*` glob.","example":["CN=partner-*,O=Acme"]},"sans":{"type":"array","items":{"type":"string"},"description":"Accepted subject-alternative names (DNS / email / URI) — exact (case-insensitive) or a `*` glob.","example":["partner.acme.com"]},"headerName":{"type":"string","description":"Which header the edge proxy forwards the client certificate in. Default `X-Client-Cert`. The value may be a PEM certificate (raw, URL-encoded or base64 DER) or a bare sha256 fingerprint."}},"additionalProperties":false,"description":"Client-certificate rules for an `mtls` identity. mTLS terminates at the edge proxy, so the gateway checks the FORWARDED certificate — which only means anything when the deployment sets `GATEWAY_MTLS_ENABLED` and the proxy strips the header from client requests. At least one allowlist is required."}},"additionalProperties":false},"Identity":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"$ref":"#/components/schemas/IdentityKind"},"provider":{"type":"string"},"config":{"$ref":"#/components/schemas/IdentityConfig"},"entraTenantId":{"type":"string","nullable":true},"spaClientId":{"type":"string","nullable":true},"apiAudience":{"type":"string","nullable":true},"allowedAudiences":{"type":"array","items":{"type":"string"}},"issuer":{"type":"string","nullable":true},"jwksUri":{"type":"string","nullable":true},"defaultScopes":{"type":"array","items":{"type":"string"}},"oboClientId":{"type":"string","nullable":true},"oboConfigured":{"type":"boolean"},"sharedSecretConfigured":{"type":"boolean"},"oidcClientSecretConfigured":{"type":"boolean","description":"Is an IdP client secret sealed for the gateway's server-side token exchange? The secret itself is never returned."},"basicPasswordConfigured":{"type":"boolean"},"allowAnonymousEndpoints":{"type":"boolean"},"allowMemberImpersonation":{"type":"boolean","description":"Member impersonation (FAI-1128) — READ-ONLY here; set it via PUT /identities/:id/impersonation-settings, never via this update body (a value here is silently ignored)."},"tagAssignmentFlowId":{"type":"string","nullable":true,"description":"Identity-based tag assignment (plans/identity-tag-assignment.md) — READ-ONLY here; set it via PUT /identities/:id/tag-assignment, never via this update body (a value here is silently ignored)."},"tagAssignmentIntervalMs":{"type":"number","nullable":true},"tagAssignmentLastRunAt":{"type":"string","nullable":true},"tagAssignmentLastSuccessAt":{"type":"string","nullable":true},"tagAssignmentLastError":{"type":"string","nullable":true},"tagAssignmentNodeUnreachedAt":{"type":"string","nullable":true,"description":"NULL = the designated \"Set access tags\" node fired on its last run (or none has run yet). Non-null = the timestamp since which it has NOT fired despite the run itself succeeding — a DIFFERENT signal from tagAssignmentLastError, since a misconfigured graph (e.g. the node sitting behind a condition that never evaluates true) never produces an error at all."},"tagReEvaluationFlowId":{"type":"string","nullable":true,"description":"The SEPARATE Flow the \"Run now\" action uses for someone already signed in — READ-ONLY here; set it via PUT /identities/:id/tag-reevaluation, never via this update body (a value here is silently ignored)."},"tagReEvaluationLastRunAt":{"type":"string","nullable":true},"tagReEvaluationLastSuccessAt":{"type":"string","nullable":true},"tagReEvaluationLastError":{"type":"string","nullable":true},"tagReEvaluationNodeUnreachedAt":{"type":"string","nullable":true,"description":"Same meaning as tagAssignmentNodeUnreachedAt, for a \"Run now\" call that reached the Flow but not its designated node."}},"required":["id","solutionId","name","description","kind","provider","config","entraTenantId","spaClientId","apiAudience","allowedAudiences","issuer","jwksUri","defaultScopes","oboClientId","oboConfigured","sharedSecretConfigured","oidcClientSecretConfigured","basicPasswordConfigured","allowAnonymousEndpoints","allowMemberImpersonation","tagAssignmentFlowId","tagAssignmentIntervalMs","tagAssignmentLastRunAt","tagAssignmentLastSuccessAt","tagAssignmentLastError","tagAssignmentNodeUnreachedAt","tagReEvaluationFlowId","tagReEvaluationLastRunAt","tagReEvaluationLastSuccessAt","tagReEvaluationLastError","tagReEvaluationNodeUnreachedAt"]},"UpdateIdentityInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"provider":{"type":"string","minLength":1,"description":"The IdP preset: `entra` (default), `oidc` (generic), and the catalog presets.","example":"oidc"},"config":{"$ref":"#/components/schemas/IdentityConfig"},"entraTenantId":{"type":"string","nullable":true},"spaClientId":{"type":"string","nullable":true},"apiAudience":{"type":"string","nullable":true},"allowedAudiences":{"type":"array","items":{"type":"string"}},"issuer":{"type":"string","nullable":true},"jwksUri":{"type":"string","nullable":true},"defaultScopes":{"type":"array","items":{"type":"string"}},"oboClientId":{"type":"string","nullable":true},"oboClientSecret":{"type":"string","nullable":true,"description":"Write-only; encrypted at rest, never returned."},"sharedSecret":{"type":"string","nullable":true,"description":"Write-only; encrypted at rest, never returned. The shared decryptable secret used by the HMAC / shared-secret-JWT / introspection kinds. Send null or \"\" to clear it."},"oidcClientSecret":{"type":"string","nullable":true,"description":"Write-only; encrypted at rest, never returned. The IdP CLIENT SECRET the Flex Gateway presents at the provider's token endpoint when it exchanges a served app's authorization code server-side — required by Google, unused by a public PKCE client. Only settable on a kind whose users sign in through an OIDC redirect (oidc_jwt, saml_federated). Send null or \"\" to clear it."},"basicPassword":{"type":"string","nullable":true,"description":"Write-only; stored as a sha256 hash (never decryptable, never returned) for a `basic` identity. Rotate by sending a new one; send null or \"\" to clear it. Use a LONG RANDOM value — it is a machine credential, and an unsalted hash offers no protection against guessing a weak one."},"allowAnonymousEndpoints":{"type":"boolean"},"kind":{"$ref":"#/components/schemas/IdentityKind"}},"description":"An identity's `kind` is immutable after create — sending a different one returns 409 IDENTITY_KIND_IMMUTABLE (sending the same one is a no-op)."},"TestAuthorizationResult":{"type":"object","properties":{"sub":{"type":"string"},"email":{"type":"string"},"displayName":{"type":"string"},"groups":{"type":"array","items":{"type":"string"}},"claims":{"type":"object","additionalProperties":{"nullable":true}},"audiences":{"type":"array","items":{"type":"string"}},"allowed":{"type":"boolean"},"rulesReport":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string"},"requirement":{"type":"string"},"ok":{"type":"boolean"},"detail":{"type":"string"},"code":{"type":"string"}},"required":["rule","requirement","ok","detail"]}},"run":{"type":"object","properties":{"query":{"type":"string"},"data":{"nullable":true}},"required":["query"]}},"required":["sub","claims","audiences","allowed"]},"TestAuthorizationPersona":{"oneOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["member"],"description":"A real roster row — see GET …/members."},"subject":{"type":"string","minLength":1}},"required":["mode","subject"]},{"type":"object","properties":{"mode":{"type":"string","enum":["custom"],"description":"An operator-typed persona; nothing needs to have signed in."},"sub":{"type":"string","minLength":1},"email":{"type":"string"},"displayName":{"type":"string"},"groups":{"type":"array","items":{"type":"string"}},"claims":{"type":"object","additionalProperties":{"nullable":true},"description":"Extra raw claims, for a requiredClaims rule the roster cannot answer for (e.g. a custom claim, or email_verified:false to test the unverified-email path)."},"audiences":{"type":"array","items":{"type":"string"},"description":"D18 audience tags to test a Fact Base run under. Ignored outside 'run'."}},"required":["mode","sub"]}]},"TestAuthorizationRun":{"type":"object","properties":{"factBaseId":{"type":"string"},"query":{"type":"string","minLength":1,"description":"A saved query name or id — never ad-hoc SQL."},"params":{"type":"object","additionalProperties":{"nullable":true}},"roleId":{"type":"string","description":"Required when the Fact Base declares row-level policies, so the query runs under the same restriction a real caller would face."}},"required":["factBaseId","query"]},"TestAuthorizationInput":{"type":"object","properties":{"persona":{"$ref":"#/components/schemas/TestAuthorizationPersona"},"run":{"$ref":"#/components/schemas/TestAuthorizationRun"}},"required":["persona"]},"ValidateIdentityTokenResult":{"type":"object","properties":{"valid":{"type":"boolean","description":"Did VERIFICATION succeed? False is what the gateway answers 401 for."},"allowed":{"type":"boolean","description":"Did the post-verify authorization rules pass? Reported separately from `valid` because a genuine token that is not allowed is a 403, not a 401 — a different problem entirely. Absent when verification failed."},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"sub":{"type":"string","nullable":true},"claims":{"type":"object","additionalProperties":{"nullable":true}},"email":{"type":"string","description":"The claim-mapped email, if any."},"displayName":{"type":"string"},"groups":{"type":"array","items":{"type":"string"},"description":"The claim-mapped groups/roles."},"rulesReport":{"type":"array","items":{"type":"object","properties":{"rule":{"type":"string","description":"A stable id for the row (`scope:read:data`, `claim:hd`)."},"requirement":{"type":"string"},"ok":{"type":"boolean"},"detail":{"type":"string"},"code":{"type":"string","description":"The 403 code a runtime failure answers with."}},"required":["rule","requirement","ok","detail"]},"description":"Per-rule pass/fail for this token. A 403 reports only the FIRST failure; this reports every rule, so \"which of my rules is failing?\" is one call. Absent when the identity declares no rules."}},"required":["valid"]},"ValidateIdentityTokenInput":{"type":"object","properties":{"token":{"type":"string","minLength":1,"description":"The bearer credential to verify. Never logged, never persisted."}},"required":["token"]},"IdentityApiKey":{"type":"object","properties":{"id":{"type":"string"},"identityId":{"type":"string"},"name":{"type":"string"},"keyPrefix":{"type":"string","description":"The first characters of the key, so two keys can be told apart in a list. Not a credential.","example":"fdk_A1b2C3d"},"expiresAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"status":{"type":"string","enum":["active","revoked","expired"]}},"required":["id","identityId","name","keyPrefix","expiresAt","revokedAt","createdAt","status"]},"IdentityApiKeyError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"CreatedIdentityApiKey":{"allOf":[{"$ref":"#/components/schemas/IdentityApiKey"},{"type":"object","properties":{"key":{"type":"string","description":"THE RAW KEY — returned exactly once, here. It is stored only as a sha256 hash, is never logged, and can never be retrieved again. If it is lost, revoke this key and mint another.","example":"fdk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}},"required":["key"]}]},"CreateIdentityApiKeyInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"description":"What this key is for — shown in the key list (e.g. \"Nightly ETL job\").","example":"Nightly ETL job"},"expiresAt":{"type":"string","nullable":true,"format":"date-time","description":"ISO-8601 instant after which the key stops verifying. Must be in the future. Omit for a key that never expires.","example":"2027-01-01T00:00:00.000Z"}},"required":["name"]},"IdentityMemberRosterEntry":{"type":"object","properties":{"subject":{"type":"string"},"issuer":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"displayName":{"type":"string","nullable":true},"frozenAudiences":{"type":"array","items":{"type":"string"},"description":"What was frozen onto this subject's most recent session — already includes any tag that was granted at that moment, so this is not a pure claims-only readout."},"grants":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tag":{"type":"string"},"source":{"type":"string","enum":["admin","flow_grant","resolver"],"description":"Who decided this tag applies: an admin's own grant, or a set_identity_tags Flow node ('resolver' is legacy and no longer written)."},"sourceFlowId":{"type":"string","nullable":true,"description":"Which Flow authored this row, for a source:\"flow_grant\" row — null otherwise (or for a row written before this column existed)."},"sourceFlowName":{"type":"string","nullable":true,"description":"sourceFlowId resolved to that Flow's current name — null if sourceFlowId is null, or if that Flow has since been deleted."}},"required":["id","tag","source","sourceFlowId","sourceFlowName"]},"description":"Current grants for this subject, read live. Each carries its own id — revoke one with DELETE /members/{memberId}."},"effectiveAudiences":{"type":"array","items":{"type":"string"},"description":"frozenAudiences ∪ grants[].tag — the best available estimate of what a new session would resolve to right now."},"lastSeenAt":{"type":"string"}},"required":["subject","issuer","email","displayName","frozenAudiences","grants","effectiveAudiences","lastSeenAt"]},"IdentityMemberError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"IdentityMemberGrant":{"type":"object","properties":{"id":{"type":"string"},"identityId":{"type":"string"},"subject":{"type":"string"},"tag":{"type":"string"},"source":{"type":"string","enum":["admin","flow_grant","resolver"]},"sourceFlowId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"createdBy":{"type":"string","nullable":true}},"required":["id","identityId","subject","tag","source","sourceFlowId","createdAt","createdBy"]},"GrantIdentityMemberInput":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"description":"The verified subject to grant a tag to — the same value that would appear as end_user_ref.","example":"auth0|64f1c2…"},"tag":{"type":"string","minLength":1,"maxLength":32,"description":"One D18 audience tag (lowercase letters, digits, hyphens).","example":"principal"}},"required":["subject","tag"]},"IdentityEndUserCredential":{"type":"object","properties":{"id":{"type":"string"},"subject":{"type":"string","description":"The verified subject this credential belongs to — the same value that appears as end_user_ref."},"providerKey":{"type":"string","description":"The integration catalog's provider key, e.g. 'servicenow'. One person may hold several."},"scopes":{"type":"array","items":{"type":"string"}},"expiresAt":{"type":"string","nullable":true,"description":"When the ACCESS token last obtained for this person expires — not the stored credential's own lifetime, which is an instance setting no provider reports."},"connectedAt":{"type":"string"},"lastRefreshedAt":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true,"description":"Why the most recent refresh failed, if it did. 'invalid_grant' means the stored credential is dead and the person must consent again; the row is kept so an operator can see that rather than finding an absence."}},"required":["id","subject","providerKey","scopes","expiresAt","connectedAt","lastRefreshedAt","lastError"]},"IdentityCredentialError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"StartMemberImpersonationResult":{"type":"object","properties":{"sessionId":{"type":"string"},"token":{"type":"string","description":"The minted credential. Shown ONCE — it is never stored or re-displayable."},"expiresAt":{"type":"string"}},"required":["sessionId","token","expiresAt"]},"StartMemberImpersonationInput":{"type":"object","properties":{"reason":{"type":"string","minLength":3,"description":"Why you are doing this — at least 3 characters. Recorded on the durable session row.","example":"Debugging why the dashboard shows no rows for this customer"},"ttlMinutes":{"type":"integer","minimum":1,"maximum":60,"description":"How long the credential stays valid (1-60). Default 15."}},"required":["reason"]},"MemberImpersonationSession":{"type":"object","properties":{"id":{"type":"string"},"identityId":{"type":"string"},"subject":{"type":"string"},"initiatorActorId":{"type":"string"},"reason":{"type":"string"},"expiresAt":{"type":"string"},"revokedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","identityId","subject","initiatorActorId","reason","expiresAt","revokedAt","createdAt"]},"MemberImpersonationSettingsInput":{"type":"object","properties":{"allow":{"type":"boolean"}},"required":["allow"]},"IdentityMemberInvite":{"type":"object","properties":{"id":{"type":"string"},"identityId":{"type":"string"},"email":{"type":"string"},"tag":{"type":"string"},"source":{"type":"string","enum":["admin","flow_grant","resolver"],"description":"Who staged this pending invite — an admin's own action, or a set_identity_tags Flow node."},"sourceFlowId":{"type":"string","nullable":true},"sourceFlowName":{"type":"string","nullable":true,"description":"sourceFlowId resolved to that Flow's current name — null if sourceFlowId is null, or that Flow has since been deleted."},"createdAt":{"type":"string"},"createdBy":{"type":"string","nullable":true}},"required":["id","identityId","email","tag","source","sourceFlowId","sourceFlowName","createdAt","createdBy"]},"IdentityMemberInviteError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"CreateIdentityMemberInviteInput":{"type":"object","properties":{"email":{"type":"string","minLength":1,"description":"The email this identity has not yet seen sign in — held pending until it does.","example":"dara@school.edu"},"tag":{"type":"string","minLength":1,"maxLength":32,"description":"One D18 audience tag (lowercase letters, digits, hyphens).","example":"teachers"}},"required":["email","tag"]},"BulkGrantOutcome":{"type":"object","properties":{"granted":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"tag":{"type":"string"},"subject":{"type":"string"}},"required":["email","tag","subject"]},"description":"Applied immediately — this email had already signed in under this identity before."},"pending":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"tag":{"type":"string"}},"required":["email","tag"]},"description":"No prior sign-in for this email yet — held as a pending invite, applied automatically the first time they do sign in."},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"number"},"email":{"type":"string"},"tag":{"type":"string"},"reason":{"type":"string"}},"required":["row","email","tag","reason"]},"description":"Malformed rows, never silently dropped — every other row in the batch still applies."}},"required":["granted","pending","errors"]},"BulkGrantMembersInput":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string","minLength":1,"example":"dara@school.edu"},"tag":{"type":"string","minLength":1,"maxLength":32,"example":"teachers"}},"required":["email","tag"]},"minItems":1,"maxItems":2000,"description":"Parsed from the admin's own CSV/JSON export — one {email, tag} pair per row."}},"required":["rows"]},"EligibleTagAssignmentFlow":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"otherStarters":{"type":"array","items":{"type":"string","enum":["assistant","subflow"]},"description":"Who besides the platform can run this Flow — an assistant run_flow grant, another Flow's subflow step. Their runs carry no sign-in, so a Replace step can remove tags it granted."}},"required":["id","name"]},"IneligibleTagAssignmentFlow":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string","enum":["FLOW_NOT_PUBLISHED","FLOW_DISABLED","FLOW_MISSING_IDENTITY_TAG_NODE","FLOW_HAS_INTERACTION_NODES","FLOW_HAS_WEBHOOK_TRIGGER"],"description":"The one thing standing between this Flow and the picker — the same code a save of it would be refused with. FLOW_DISABLED means enabling it is the whole fix."},"reason":{"type":"string","description":"One short line saying why, for the Studio.","example":"Published, but disabled."}},"required":["id","name","code","reason"]},"IdentityTagAssignmentError":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]},"SetTagAssignmentFlowInput":{"type":"object","properties":{"flowId":{"type":"string","nullable":true,"description":"The Flow to run for this Identity's subjects, or null to stop resolving tags entirely. Must already be published, enabled, owned by the same Solution/Template as the Identity, contain a \"Set access tags\" (set_identity_tags) node targeting THIS Identity, and carry no interaction node — the same check the gateway itself runs before every trigger.","example":"01JL0X…"}},"required":["flowId"]},"TagAssignmentOutcome":{"type":"object","properties":{"ran":{"type":"boolean"},"granted":{"type":"array","items":{"type":"string"}},"revoked":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}},"nodeReached":{"type":"boolean","description":"Did the run's OWN \"Set access tags\" step targeting this Identity actually execute? false means the run completed but no such step fired — most likely a set_identity_tags node sitting behind a condition branch that never evaluates true — distinct from granted/revoked both being empty because the Flow legitimately decided this person gets no tags."}},"required":["ran","granted","revoked","errors","nodeReached"]},"ReEvaluateTagsInput":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"description":"The verified subject to run the Flow for — the same value that appears as end_user_ref/a roster row's subject.","example":"auth0|64f1c2…"},"email":{"type":"string","nullable":true,"description":"Passed to the Flow as trigger input, same shape as a real gateway trigger."},"issuer":{"type":"string","nullable":true}},"required":["subject"]},"IdentityPresetField":{"type":"object","properties":{"key":{"type":"string","description":"The storage key, interpreted per `source` — and the `{variable}` name inside `issuerTemplate`.","example":"org"},"source":{"type":"string","enum":["column","config","providerConfig"],"description":"Where the value is stored: a top-level Identity field (`column`), a declared `config` key, possibly dotted (`config`), or a key inside `config.providerConfig` (`providerConfig`)."},"label":{"type":"string"},"help":{"type":"string","description":"One sentence: what it is and where to find it."},"required":{"type":"boolean"},"placeholder":{"type":"string"},"options":{"type":"array","items":{"type":"string"},"description":"Render as a select, and validated on write."},"defaultValue":{"type":"string"},"secret":{"type":"boolean","description":"A write-only credential — accepted once, sealed at rest, never returned."},"alsoSeals":{"type":"string","enum":["oidcClientSecret"],"description":"This secret is ALSO the gateway's sign-in client secret: entered once, sealed for both uses (Facebook's App Secret). The form offers no separate client-secret field for such a provider."}},"required":["key","source","label","help"]},"IdentityProviderPreset":{"type":"object","properties":{"id":{"type":"string","description":"The value that goes in an Identity's `provider`.","example":"okta"},"label":{"type":"string"},"family":{"type":"string","enum":["microsoft","popular","social","self_hosted","dev_platform","machine","generic"],"description":"How the picker groups it."},"description":{"type":"string"},"kind":{"type":"string","enum":["oidc_jwt","static_jwks","shared_secret_jwt","api_key","hmac","basic","oauth2_introspection","saml_federated","mtls"],"description":"The verification mechanic this preset binds to. A dual-mode preset (Supabase, Facebook) reports its DEFAULT mode's kind; the mode field re-selects it at create time."},"issuerTemplate":{"type":"string","nullable":true,"description":"The issuer, as a `{variable}` template resolved from this preset's fields. An explicit `issuer` on the Identity always wins over it.","example":"https://{org}.okta.com/oauth2/{authServerId}"},"issuerHint":{"type":"string","nullable":true},"fields":{"type":"array","items":{"$ref":"#/components/schemas/IdentityPresetField"}},"algs":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Default accepted signature algorithms. Null means every supported RS/PS/ES algorithm."},"claimMapDefault":{"type":"object","properties":{"subject":{"type":"array","items":{"type":"string"}},"email":{"type":"array","items":{"type":"string"}},"displayName":{"type":"array","items":{"type":"string"}},"groups":{"type":"array","items":{"type":"string"}}},"required":["subject"],"description":"This provider's claim precedence, applied unless the Identity overrides it in `config.claimMap`. `groups` is the claim the chunk-4 authorization rules read (Cognito namespaces it, Keycloak nests it), and a name may be a dot-path."},"signInFlow":{"type":"string","enum":["msal","oidc_pkce","oauth2_code","none"],"description":"How a browser signs a user in: Microsoft MSAL, a plain Authorization-Code + PKCE redirect, or `none` (the app brings its own token)."},"signInFlowByKind":{"type":"object","nullable":true,"additionalProperties":{"type":"string","enum":["msal","oidc_pkce","oauth2_code","none"]},"description":"A two-mode preset whose modes sign in differently, keyed by the identity's kind; a kind not listed uses `signInFlow` (the default mode's flow). Facebook: `{ \"oidc_jwt\": \"none\" }` — Limited Login cannot sign anyone in from a web app. Null for every other preset."},"docsUrl":{"type":"string"},"quirks":{"type":"array","items":{"type":"string"},"description":"Machine-readable markers for this vendor's deviations (`token_use`, `x509`, `trailing-slash-issuer`, `opaque-token`, …)."},"catalogOnlyUntilKind":{"type":"string","nullable":true,"enum":["oidc_jwt","static_jwks","shared_secret_jwt","api_key","hmac","basic","oauth2_introspection","saml_federated","mtls"],"description":"Set when the preset's default mode needs a verification kind that is not implemented yet — listed so the picker is complete, but it cannot authenticate anyone until then."}},"required":["id","label","family","description","kind","issuerTemplate","issuerHint","fields","algs","claimMapDefault","signInFlow","signInFlowByKind","docsUrl","quirks","catalogOnlyUntilKind"]},"ConnectionKind":{"type":"string","enum":["bearer","api_key","basic","smtp","oauth2_client_credentials","oauth2_authorization_code"],"description":"http-auth kinds (bearer/api_key/basic → http_request or integration) + smtp (→ send_email) + the two OAuth grants (→ integration only; neither produces a static header). oauth2_client_credentials acts as the workspace; oauth2_authorization_code acts as the signed-in person, and additionally needs meta.authorizeEndpoint."},"ConnectionMeta":{"type":"object","properties":{"header":{"type":"string"},"username":{"type":"string"},"note":{"type":"string"},"host":{"type":"string"},"port":{"type":"integer"},"secure":{"type":"boolean"},"fromAddress":{"type":"string"},"fromName":{"type":"string"},"replyTo":{"type":"string"},"allowedDomains":{"type":"array","items":{"type":"string"}},"provider":{"type":"string","description":"Which application this credential is for (e.g. 'servicenow'). Absent = a generic HTTP/SMTP credential."},"baseUrl":{"type":"string","description":"The application's https base URL. Canonicalized on write; a non-https value is refused."},"clientId":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"tokenEndpoint":{"type":"string","description":"An explicit OAuth token endpoint, overriding the provider's own default path."},"authorizeEndpoint":{"type":"string","description":"Where a PERSON is sent to approve access, for the per-user OAuth grant. Nothing derives it - a token endpoint can be joined from a provider's own path, an authorize URL cannot - so the per-user kind refuses to save without it."},"clientAuth":{"type":"string","enum":["basic","body","both"],"description":"Where the client id/secret ride on a token call. Absent = 'both', which matches what ServiceNow's own document for this grant shows; an instance strict about RFC 6749 §2.3.1 uses 'basic'."},"identityCheckEndpoint":{"type":"string","description":"OPTIONAL. Called with the newly-minted access token at consent, to confirm the account that approved is the same person signed in here. All three identityCheck* settings together, or none."},"identityCheckField":{"type":"string","description":"Dot path into that response, e.g. 'result.email'."},"identityCheckClaim":{"type":"string","description":"Which of OUR verified values it must equal: 'email', 'sub', or a dot path into the signed-in person's claims."},"allowedCustomFields":{"type":"array","items":{"type":"string"},"description":"The provider fields an integration step may set. Empty/absent = none may be set."},"idempotencyField":{"type":"string","description":"A unique provider field carrying our operation id, so an interrupted write can be checked instead of failing."},"resolvedState":{"type":"string","description":"The application's own value for a resolved record, when that vocabulary is instance-specific."}}},"Connection":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionName":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"name":{"type":"string"},"kind":{"$ref":"#/components/schemas/ConnectionKind"},"meta":{"$ref":"#/components/schemas/ConnectionMeta"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string","nullable":true},"credentialSet":{"type":"boolean","description":"Whether a credential is stored. Presence only: never the credential, its length, a prefix or a hash. `false` is an imported or cloned Connection that needs its credential before a flow can use it."}},"required":["id","solutionId","name","kind","meta","createdAt","updatedAt"]},"UpdateConnectionInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"secret":{"type":"string","minLength":1,"description":"Present → rotate the secret. Never returned."},"meta":{"$ref":"#/components/schemas/ConnectionMeta"}}},"CreateConnectionInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"kind":{"$ref":"#/components/schemas/ConnectionKind"},"secret":{"type":"string","minLength":1,"description":"Plaintext secret - encrypted immediately, never returned."},"meta":{"$ref":"#/components/schemas/ConnectionMeta"}},"required":["name","kind","secret"]},"GatewayListItem":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string","nullable":true},"enabled":{"type":"boolean"},"solutionId":{"type":"string","nullable":true},"solutionName":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"endpoints":{"type":"number"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string","nullable":true}},"required":["id","name","slug","description","enabled","solutionId","solutionName","endpoints","updatedAt","updatedBy"]},"GatewayEndpointLimits":{"type":"object","properties":{"maxBodyBytesDefault":{"type":"integer","description":"What an endpoint with no Max request size accepts, in bytes: 1 MB (1048576)."},"maxBodyBytesMin":{"type":"integer","description":"The smallest Max request size accepted, in bytes: 1 KB (1024)."},"maxBodyBytesCeiling":{"type":"integer","description":"This deployment's ceiling on a Max request size, in bytes — `GATEWAY_MAX_BODY_BYTES_CEILING`, 3 MB (3145728) unless the operator changed it. A larger setting is refused `400 INVALID_MAX_BODY_BYTES`."}},"required":["maxBodyBytesDefault","maxBodyBytesMin","maxBodyBytesCeiling"]},"Gateway":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string"},"tenantId":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string","nullable":true},"identityId":{"type":"string","nullable":true},"identityResolutionMode":{"type":"string","enum":["static","dynamic"]},"enabled":{"type":"boolean"}},"required":["id","solutionId","tenantId","name","slug","description","identityId","identityResolutionMode","enabled"]},"UpdateGatewayInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"enabled":{"type":"boolean"},"identityResolutionMode":{"type":"string","enum":["static","dynamic"],"description":"'static' (default) — the ONE identity connected via PUT .../identity governs every request. 'dynamic' (flow-based dynamic identity resolution) — which identity governs a request is resolved per-caller from its bearer's own issuer, against this gateway's identity-candidates roster."}}},"AgentEndpointConfig":{"type":"object","nullable":true,"properties":{"audienceMapping":{"type":"object","properties":{"claimPath":{"type":"string","minLength":1,"description":"Dot-path into the verified token claims (e.g. \"groups\")."},"prefix":{"type":"string","description":"Optional prefix prepended to each mapped value (e.g. \"region-\")."}},"required":["claimPath"]},"staticAudiences":{"type":"array","items":{"type":"string"},"description":"Audience tags every session on this endpoint gets."}}},"FileEndpointConfig":{"type":"object","nullable":true,"properties":{"folderPolicy":{"type":"string","enum":["fixed","per_end_user","per_session"],"description":"Where an upload lands, and the overwrite boundary. `fixed` = the configured folder (a name collision mints a NEW de-duplicated file, never a new version of someone else’s); `per_end_user` = <folder>/<hash of the caller’s subject> (refused for an anonymous caller); `per_session` = <folder>/<sessionId>."},"folder":{"type":"string","description":"The base folder label. Omit for the store root."},"maxBytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Per-upload byte ceiling. Never raises the File Store’s own cap."},"allowedMediaTypes":{"type":"array","items":{"type":"string"},"description":"Media types this endpoint accepts (exact or `image/*`), on top of the store’s lists.","example":["image/*","application/pdf"]},"audienceMapping":{"type":"object","properties":{"claimPath":{"type":"string","minLength":1,"description":"Dot-path into the verified token claims (e.g. \"groups\")."},"prefix":{"type":"string","description":"Optional prefix prepended to each mapped value (e.g. \"region-\")."}},"required":["claimPath"]},"staticAudiences":{"type":"array","items":{"type":"string"},"description":"Audience tags every file uploaded here carries."},"allowDownload":{"type":"boolean","description":"Serve bytes back at GET {path}/files/:fileId/content. Default true."},"allowList":{"type":"boolean","description":"Enumerate files at GET {path}/files. Default FALSE — listing is more exposure than writing."}},"required":["folderPolicy"],"additionalProperties":false},"GatewayEndpoint":{"type":"object","properties":{"id":{"type":"string"},"apiId":{"type":"string"},"name":{"type":"string"},"method":{"type":"string"},"path":{"type":"string"},"kind":{"type":"string","enum":["flow","query","agent","file"]},"flowId":{"type":"string","nullable":true},"queryId":{"type":"string","nullable":true},"agentId":{"type":"string","nullable":true},"fileStoreId":{"type":"string","nullable":true},"roleId":{"type":"string","nullable":true},"mode":{"type":"string","enum":["sync","async"]},"syncTimeoutMs":{"type":"number"},"auth":{"type":"string","enum":["inherit","required","anonymous"]},"requestSchema":{"nullable":true},"responseMapping":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"rateLimit":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"agentConfig":{"$ref":"#/components/schemas/AgentEndpointConfig"},"fileConfig":{"$ref":"#/components/schemas/FileEndpointConfig"},"requiredScopes":{"type":"array","nullable":true,"items":{"type":"string"}},"maxBodyBytes":{"type":"integer","nullable":true,"description":"The endpoint's Max request size in bytes, or null for the 1 MB default (FAI-1421); absent only from a server older than the setting, which means the default too. The gateway never reads more than this deployment's ceiling, whatever is stored."},"enabled":{"type":"boolean"}},"required":["id","apiId","name","method","path","kind","flowId","queryId","agentId","fileStoreId","roleId","mode","syncTimeoutMs","auth","responseMapping","rateLimit","agentConfig","fileConfig","requiredScopes","enabled"]},"GatewayEndpointListItem":{"allOf":[{"$ref":"#/components/schemas/GatewayEndpoint"},{"type":"object","properties":{"effectiveAuth":{"type":"string","enum":["required","anonymous"],"description":"What this endpoint's `auth` setting resolves to right now: `required` if a call needs sign-in, `anonymous` if it does not. Resolved by the server from the same rule the request pipeline uses — an `inherit` endpoint follows its gateway, which means the gateway's attached Identity in 'static' mode and its identity-candidate roster in 'dynamic' mode. Absent only from a server older than this field, which means no answer rather than a default."}}}]},"CreateGatewayEndpointInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1},"kind":{"type":"string","enum":["flow","query","agent","file"],"description":"What this endpoint exposes, and therefore which target id it needs. 'flow' runs a published Flow (`flowId`) — the app calls it as runAction(). 'query' runs a Fact Base saved query under a Fact Base role (`queryId` + `roleId`) — runQuery(). 'agent' opens a chat with a published Agent (`agentId`) at {path}/sessions + {path}/messages. 'file' exposes a File Store for end-user upload and download (`fileStoreId` + `fileConfig`) at {path}/files — window.Flexday.files.*."},"flowId":{"type":"string","nullable":true},"queryId":{"type":"string","nullable":true},"agentId":{"type":"string","nullable":true},"fileStoreId":{"type":"string","nullable":true,"description":"Required for kind 'file': a File Store in this gateway's own Solution. A Doc-Base-managed store is refused (MANAGED_STORE_NOT_WRITABLE) — end-user uploads must not land inside a search index's private byte store."},"roleId":{"type":"string","nullable":true},"mode":{"type":"string","enum":["sync","async"]},"syncTimeoutMs":{"type":"integer","minimum":0,"exclusiveMinimum":true},"auth":{"type":"string","enum":["inherit","required","anonymous"]},"requestSchema":{"nullable":true},"responseMapping":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"rateLimit":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"agentConfig":{"$ref":"#/components/schemas/AgentEndpointConfig"},"fileConfig":{"$ref":"#/components/schemas/FileEndpointConfig"},"requiredScopes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Scopes the caller's credential must hold for THIS endpoint (GIP chunk 4), unioned with the Identity's own `config.authorization.requiredScopes` — an endpoint may narrow access, never widen it. A missing scope is a 403 INSUFFICIENT_SCOPE (not a 401). Rejected on an `anonymous` endpoint, which has no credential to read scopes from. Deliberately NOT published in the LaunchPad's public config.","example":["read:data"]},"maxBodyBytes":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"description":"The endpoint's Max request size: the largest request body, in bytes, the gateway reads for it (FAI-1421). From 1024 (1 KB) up to this deployment's ceiling (`GATEWAY_MAX_BODY_BYTES_CEILING`, 3 MB unless the operator changed it — `GET /api/v1/gateways/limits` answers both), or null for the default of 1 MB. A larger body is refused `413 BODY_TOO_LARGE` naming the limit. On an UPDATE, leaving the field out keeps the endpoint's current setting. Applies to every kind and to sync and async alike; larger content belongs in a `file` endpoint and a file handle.","example":524288},"enabled":{"type":"boolean"}},"required":["name","method","path","kind"]},"UpdateGatewayEndpointInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","minLength":1},"kind":{"type":"string","enum":["flow","query","agent","file"],"description":"What this endpoint exposes, and therefore which target id it needs. 'flow' runs a published Flow (`flowId`) — the app calls it as runAction(). 'query' runs a Fact Base saved query under a Fact Base role (`queryId` + `roleId`) — runQuery(). 'agent' opens a chat with a published Agent (`agentId`) at {path}/sessions + {path}/messages. 'file' exposes a File Store for end-user upload and download (`fileStoreId` + `fileConfig`) at {path}/files — window.Flexday.files.*."},"flowId":{"type":"string","nullable":true},"queryId":{"type":"string","nullable":true},"agentId":{"type":"string","nullable":true},"fileStoreId":{"type":"string","nullable":true,"description":"Required for kind 'file': a File Store in this gateway's own Solution. A Doc-Base-managed store is refused (MANAGED_STORE_NOT_WRITABLE) — end-user uploads must not land inside a search index's private byte store."},"roleId":{"type":"string","nullable":true},"mode":{"type":"string","enum":["sync","async"]},"syncTimeoutMs":{"type":"integer","minimum":0,"exclusiveMinimum":true},"auth":{"type":"string","enum":["inherit","required","anonymous"]},"requestSchema":{"nullable":true},"responseMapping":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"rateLimit":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"agentConfig":{"$ref":"#/components/schemas/AgentEndpointConfig"},"fileConfig":{"$ref":"#/components/schemas/FileEndpointConfig"},"requiredScopes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Scopes the caller's credential must hold for THIS endpoint (GIP chunk 4), unioned with the Identity's own `config.authorization.requiredScopes` — an endpoint may narrow access, never widen it. A missing scope is a 403 INSUFFICIENT_SCOPE (not a 401). Rejected on an `anonymous` endpoint, which has no credential to read scopes from. Deliberately NOT published in the LaunchPad's public config.","example":["read:data"]},"maxBodyBytes":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"description":"The endpoint's Max request size: the largest request body, in bytes, the gateway reads for it (FAI-1421). From 1024 (1 KB) up to this deployment's ceiling (`GATEWAY_MAX_BODY_BYTES_CEILING`, 3 MB unless the operator changed it — `GET /api/v1/gateways/limits` answers both), or null for the default of 1 MB. A larger body is refused `413 BODY_TOO_LARGE` naming the limit. On an UPDATE, leaving the field out keeps the endpoint's current setting. Applies to every kind and to sync and async alike; larger content belongs in a `file` endpoint and a file handle.","example":524288},"enabled":{"type":"boolean"}},"required":["name","method","path","kind"]},"ConnectGatewayIdentityInput":{"type":"object","properties":{"identityId":{"type":"string","nullable":true,"minLength":1,"description":"An Identity id in this gateway’s Solution, or null to clear. An empty string is refused (400): it is neither an id nor null."}},"required":["identityId"]},"GatewayIdentityCandidate":{"type":"object","properties":{"id":{"type":"string"},"apiId":{"type":"string"},"identityId":{"type":"string"},"resolverKey":{"type":"string"},"issuer":{"type":"string"},"domainVerifiedAt":{"type":"string","nullable":true},"provisionedBy":{"type":"string","enum":["manual","flow"]},"provisioningRunId":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","apiId","identityId","resolverKey","issuer","domainVerifiedAt","provisionedBy","provisioningRunId","createdAt","updatedAt"]},"AttachIdentityCandidateInput":{"type":"object","properties":{"identityId":{"type":"string","description":"An Identity id in this gateway's own Solution."},"resolverKey":{"type":"string","minLength":1,"description":"The discovery key a caller's sign-in hint is matched against (`/_auth/discover`) — unique within this gateway's own roster. The candidate's `issuer` is derived from the identity itself, never supplied here."}},"required":["identityId","resolverKey"]},"SolutionAccessLevel":{"type":"object","nullable":true,"properties":{"level":{"type":"string","enum":["viewer","editor","manager"]},"reason":{"type":"string","description":"Which rule decided the level — e.g. `grant`, `narrowed-by-tenant-role`, `open-tenant`, `tenant-admin`."}},"required":["level","reason"]},"SolutionListItem":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string","nullable":true},"finalized":{"type":"boolean"},"launchpadCount":{"type":"number"},"factBaseCount":{"type":"number"},"queryCount":{"type":"number"},"access":{"$ref":"#/components/schemas/SolutionAccessLevel"},"buildInProgress":{"type":"boolean","description":"True while a builder turn for this Solution is queued or running, and only then."},"hasLiveApp":{"type":"boolean","description":"True when one of its apps (LaunchPads) is live - the same fact as that app's own Live status."},"hasBuiltResources":{"type":"boolean","description":"True when this Solution holds something built that is neither an app nor a Fact Base - an automation, an assistant, a document library, or a file store someone made. A system-created file store (a chat attachment) and the gateway a finished build leaves behind do not count."}},"required":["id","title","name","description","createdAt","updatedAt","updatedBy","finalized","launchpadCount","factBaseCount"]},"SolutionDetail":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"finalized":{"type":"boolean"},"hasSampleData":{"type":"boolean"},"factBaseId":{"type":"string","nullable":true},"access":{"$ref":"#/components/schemas/SolutionAccessLevel"}},"required":["id","name","title","description","finalized","hasSampleData","factBaseId"]},"CreateSolutionInput":{"type":"object","properties":{"solutionName":{"type":"string","minLength":1,"description":"Display name (required)."},"description":{"type":"string","nullable":true},"factBaseId":{"type":"string"},"content":{"type":"string"}},"required":["solutionName"]},"FromPromptInput":{"type":"object","properties":{"prompt":{"type":"string","minLength":1,"maxLength":200000,"description":"The request, whole. Longer than 200,000 characters (String.length) is refused with 422 PROMPT_TOO_LONG, never trimmed."},"templateId":{"type":"string"},"files":{"type":"array","items":{"nullable":true},"description":"Up to 10 attachments (multipart file parts)."}},"required":["prompt"]},"UpdateSolutionInput":{"type":"object","properties":{"title":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"expectedUpdatedAt":{"type":"string","description":"Precondition: the `updatedAt` you last read; mismatch → 409 STALE_WRITE."}}},"DocBaseSettings":{"type":"object","properties":{"chunkTokens":{"type":"integer","minimum":0,"exclusiveMinimum":true},"overlapTokens":{"type":"integer","minimum":0},"defaultAudiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Audience tags (lowercase slugs). Empty ⇒ unrestricted (Everyone)."},"searchPreset":{"type":"string","enum":["fast","balanced","thorough"],"description":"Default retrieval preset for searches that don't override it (default: balanced)."},"rerankModel":{"type":"string","nullable":true,"description":"Catalog id of the re-ranking model searches use by default; absent/null = off."}}},"DocBase":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"embeddingProvider":{"type":"string"},"embeddingModel":{"type":"string"},"embeddingDims":{"type":"number"},"vectorStore":{"type":"string"},"settings":{"$ref":"#/components/schemas/DocBaseSettings"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","solutionId","name","description","status","embeddingProvider","embeddingModel","embeddingDims","vectorStore","settings","createdAt","updatedAt"]},"CreateDocBaseInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"embeddingModel":{"type":"string","description":"Catalog id override for the embedding model."},"vectorStore":{"type":"string","enum":["pgvector","qdrant"],"description":"Vector-store driver override."},"settings":{"$ref":"#/components/schemas/DocBaseSettings"}},"required":["name"]},"DocBaseListItem":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionTitle":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"embeddingModel":{"type":"string"},"vectorStore":{"type":"string"},"documentCount":{"type":"number"},"updatedBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","solutionId","solutionTitle","name","description","status","embeddingModel","vectorStore","documentCount","updatedBy","createdAt","updatedAt"]},"UpdateDocBaseInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"settings":{"$ref":"#/components/schemas/DocBaseSettings"}}},"ReindexDocBaseInput":{"type":"object","properties":{"vectorStore":{"type":"string","enum":["pgvector","qdrant"],"description":"Re-pin the vector driver + re-index into it."},"embeddingModel":{"type":"string","minLength":1,"description":"Re-pin the embedding model (a catalog id) + re-embed the whole corpus."},"chunkTokens":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Re-pin the target chunk size (tokens)."},"overlapTokens":{"type":"integer","minimum":0,"description":"Re-pin the chunk overlap (tokens)."}}},"IndexGenerationConfig":{"type":"object","nullable":true,"properties":{"embeddingProvider":{"type":"string"},"embeddingModel":{"type":"string"},"embeddingDims":{"type":"number"},"vectorStore":{"type":"string"},"chunkTokens":{"type":"number"},"overlapTokens":{"type":"number"}},"required":["embeddingProvider","embeddingModel","embeddingDims","vectorStore","chunkTokens","overlapTokens"]},"IndexGeneration":{"type":"object","properties":{"version":{"type":"number","description":"The generation number."},"state":{"type":"string","description":"indexed (the active build) | obsolete."},"label":{"type":"string","nullable":true},"config":{"$ref":"#/components/schemas/IndexGenerationConfig"},"configSha256":{"type":"string","nullable":true},"documents":{"type":"number","description":"Documents whose chunks reflect this generation."},"chunks":{"type":"number"},"createdAt":{"type":"string"}},"required":["version","state","label","config","configSha256","documents","chunks","createdAt"]},"DocBaseFileStore":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string"},"solutionId":{"type":"string"},"fileCount":{"type":"number"},"totalBytes":{"type":"number"}},"required":["id","name","solutionId","fileCount","totalBytes"]},"ReferencedFileStore":{"type":"object","properties":{"fileStoreId":{"type":"string"},"fileStoreName":{"type":"string"},"fileCount":{"type":"number"},"totalBytes":{"type":"number"}},"required":["fileStoreId","fileStoreName","fileCount","totalBytes"]},"DocBaseFileIndexCounts":{"type":"object","properties":{"indexed":{"type":"integer","description":"Files a ready document of this Doc Base stands for."},"waiting":{"type":"integer","description":"Files queued, or being indexed right now."},"skipped":{"type":"integer","description":"Files that cannot be indexed: a type a Doc Base cannot read, or a quarantined / failed scan."},"failed":{"type":"integer","description":"Files whose indexing failed — the per-file read gives the reason."}},"required":["indexed","waiting","skipped","failed"]},"DocBaseFileStoreLink":{"type":"object","properties":{"id":{"type":"string"},"fileStoreId":{"type":"string"},"fileStoreName":{"type":"string"},"addedAt":{"type":"string"},"fileCount":{"type":"number","description":"The store's live total file count — subtract the caller's own indexed-document count from it to get how much is left to review."},"autoIndex":{"type":"boolean","description":"Add every NEW file of the store to this Doc Base automatically (builder-hardening step 11): uploaded through an app, in the Studio, or by a flow or agent. Off by default; the files already in the store are added only by `index-existing`."},"indexCounts":{"$ref":"#/components/schemas/DocBaseFileIndexCounts"}},"required":["id","fileStoreId","fileStoreName","addedAt","fileCount","autoIndex","indexCounts"]},"AddDocBaseFileStoreInput":{"type":"object","properties":{"fileStoreId":{"type":"string","description":"A non-managed File Store owned by this Doc Base’s Solution."},"autoIndex":{"type":"boolean","description":"Add every NEW file of the store to this Doc Base automatically (builder-hardening step 11): uploaded through an app, in the Studio, or by a flow or agent. Off by default; the files already in the store are added only by `index-existing`. Omitted: a new link starts off, and an already-linked store keeps its switch."}},"required":["fileStoreId"]},"UpdateDocBaseFileStoreInput":{"type":"object","properties":{"autoIndex":{"type":"boolean","description":"Add every NEW file of the store to this Doc Base automatically (builder-hardening step 11): uploaded through an app, in the Studio, or by a flow or agent. Off by default; the files already in the store are added only by `index-existing`."}},"required":["autoIndex"],"additionalProperties":false},"DocBaseFileIndexState":{"type":"object","properties":{"fileId":{"type":"string"},"state":{"type":"string","enum":["indexed","waiting","not_indexable","failed"],"description":"indexed: a ready document stands for it · waiting: queued or being indexed · not_indexable: a type a Doc Base cannot read, or a quarantined / failed scan · failed: indexing failed."},"documentId":{"type":"string","description":"The document standing for the file here, when there is one."},"code":{"type":"string","description":"A stable code for not_indexable / failed."},"reason":{"type":"string","description":"Plain words for a person — never an internal name."}},"required":["fileId","state"]},"DocumentFileRef":{"type":"object","nullable":true,"properties":{"fileId":{"type":"string"},"fileStoreId":{"type":"string"},"fileStoreName":{"type":"string"},"name":{"type":"string"},"folder":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"number"},"sha256":{"type":"string"},"version":{"type":"number","description":"The file's current BYTE version (not the index generation)."},"scanStatus":{"type":"string"},"scanDetail":{"type":"string","nullable":true},"servable":{"type":"boolean","description":"False while the file is quarantined — nothing may be served."}},"required":["fileId","fileStoreId","fileStoreName","name","folder","mediaType","sizeBytes","sha256","version","scanStatus","scanDetail","servable"]},"Document":{"type":"object","properties":{"id":{"type":"string"},"docBaseId":{"type":"string"},"name":{"type":"string"},"source":{"type":"string","enum":["upload","url"]},"sourceUrl":{"type":"string","nullable":true},"mediaType":{"type":"string","nullable":true},"sizeBytes":{"type":"number","nullable":true},"sha256":{"type":"string","nullable":true},"status":{"type":"string","enum":["queued","processing","ready","error"]},"error":{"type":"string","nullable":true,"description":"Why indexing failed, in plain words for a person — never an internal name. An operator’s diagnosis is in the worker’s log and on the job, not here."},"pageCount":{"type":"number","nullable":true},"chunkCount":{"type":"number"},"audiences":{"type":"array","items":{"type":"string"}},"fileId":{"type":"string","nullable":true},"indexedVersion":{"type":"number"},"chunkTokensOverride":{"type":"number","nullable":true},"overlapTokensOverride":{"type":"number","nullable":true},"file":{"$ref":"#/components/schemas/DocumentFileRef"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","docBaseId","name","source","sourceUrl","mediaType","sizeBytes","sha256","status","error","pageCount","chunkCount","audiences","fileId","indexedVersion","chunkTokensOverride","overlapTokensOverride","createdAt","updatedAt"]},"UploadDocumentInput":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"allowDuplicate":{"type":"string","description":"Send \"true\" to index content this Doc Base already holds. Omitted (the default) means byte-identical content is refused with 409 DUPLICATE_DOCUMENT, whose details name the existing document."}}},"AddDocumentFromFileInput":{"type":"object","properties":{"fileId":{"type":"string","description":"A file in a File Store owned by this Doc Base’s Solution."},"name":{"type":"string","nullable":true,"minLength":1,"description":"Document name; defaults to the file’s own name."},"inheritFileAudiences":{"type":"boolean","description":"Default true: the document takes the FILE’s own audience tags (when it has any) instead of the Doc Base’s default. false lands the Doc Base’s ordinary default audiences instead."},"allowDuplicate":{"type":"boolean","description":"Index content this Doc Base already holds. Omit (the default) and byte-identical content is refused with 409 DUPLICATE_DOCUMENT, whose details name the existing document; send true to confirm."}},"required":["fileId"]},"IngestUrlInput":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]},"SetDocumentAudiencesInput":{"type":"object","properties":{"audiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Audience tags (lowercase slugs). Empty ⇒ unrestricted (Everyone)."}},"required":["audiences"]},"ReindexDocumentInput":{"type":"object","properties":{"chunkTokens":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"description":"This document's own chunk-size override (tokens). null clears it back to the Doc Base's default."},"overlapTokens":{"type":"integer","nullable":true,"minimum":0,"description":"This document's own chunk-overlap override (tokens). null clears it back to the Doc Base's default."}},"default":{}},"DocBaseSearchPresetInfo":{"type":"object","properties":{"id":{"type":"string","enum":["fast","balanced","thorough"]},"candidateCap":{"type":"integer","description":"Candidate cap PER ranker path (dense top-N and keyword top-N each)."},"topKDefault":{"type":"integer","description":"Results returned when the request doesn't set topK."},"efSearch":{"type":"integer","description":"pgvector HNSW ef_search (ignored by exact/qdrant)."},"mmr":{"type":"boolean","description":"Whether MMR diversification runs (semantic/hybrid only)."},"mmrPoolCap":{"type":"integer","description":"Max candidates considered for MMR after thresholding."},"rerankPoolCap":{"type":"integer","description":"Max fused candidates a re-ranker scores when re-ranking is on."}},"required":["id","candidateCap","topKDefault","efSearch","mmr","mmrPoolCap","rerankPoolCap"]},"RetrievedChunk":{"type":"object","properties":{"documentId":{"type":"string"},"documentName":{"type":"string"},"sectionHeading":{"type":"string","nullable":true},"content":{"type":"string"},"score":{"type":"number"},"idx":{"type":"number"},"chunkId":{"type":"string"}},"required":["documentId","documentName","sectionHeading","content","score","idx","chunkId"]},"DocBaseSearchInput":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":2000,"description":"The search query (≤ 2000 chars)."},"mode":{"type":"string","enum":["keyword","semantic","hybrid"],"description":"Retrieval mode (default 'hybrid')."},"topK":{"type":"integer","minimum":1,"maximum":50,"description":"Results to return (≤ 50; else the preset default)."},"preset":{"type":"string","enum":["fast","balanced","thorough"],"description":"Retrieval preset (else the DocBase's pinned setting)."},"rerank":{"type":"boolean","description":"Re-rank with the DocBase's configured model: false turns it off for this call; absent follows the DocBase default."},"context":{"type":"object","properties":{"priorQuery":{"type":"string","maxLength":2000}},"description":"Conversational context for the follow-up-query rewrite."},"previewAsAudiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Preview retrieval as an end-user holding ONLY these audiences (an explicit UNTRUSTED context — D18). Omit for the default trusted studio view. Empty array ⇒ preview as an anonymous caller (unrestricted documents only)."}},"required":["query"]},"LaunchPadListItem":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionTitle":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string","nullable":true},"live":{"type":"boolean"},"url":{"type":"string"},"previewUrl":{"type":"string"}},"required":["id","solutionId","solutionTitle","slug","title","description","createdAt","updatedAt","updatedBy","live","url","previewUrl"]},"LaunchPadDetail":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionTitle":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string","nullable":true},"live":{"type":"boolean"},"url":{"type":"string"},"previewUrl":{"type":"string"}},"required":["id","solutionId","solutionTitle","slug","title","description","createdAt","updatedAt","updatedBy","live","url","previewUrl"]},"UpdateLaunchpadInput":{"type":"object","properties":{"title":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true}}},"LaunchpadBrandingTokens":{"type":"object","properties":{"primaryColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","enum":["system","inter","barlow_condensed","ibm_plex_mono"]},"logoFileId":{"type":"string","nullable":true}},"required":["primaryColor","accentColor","font","logoFileId"]},"UpdateLaunchpadBrandingInput":{"type":"object","properties":{"primaryColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"font":{"type":"string","enum":["system","inter","barlow_condensed","ibm_plex_mono"]},"logoFileId":{"type":"string","nullable":true}}},"LaunchpadApiLinkInput":{"type":"object","properties":{"apiId":{"type":"string","nullable":true,"description":"A Flex Gateway id in this Solution, or null to clear."}},"required":["apiId"]},"LaunchpadPreviewLinkInput":{"type":"object","properties":{"audiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"FAI-902 — preview the LIVE app as an end user holding ONLY these audiences. Empty/omitted ⇒ preview as anonymous."}}},"LaunchpadFolderInput":{"type":"object","properties":{"path":{"type":"string"}},"required":["path"]},"LaunchpadFileWriteInput":{"type":"object","properties":{"content":{"type":"string"}},"required":["content"]},"CreateLaunchpadInput":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true}},"required":["title"]},"LaunchpadDomainDnsRecord":{"type":"object","properties":{"type":{"type":"string","enum":["TXT","CNAME"]},"name":{"type":"string"},"value":{"type":"string"}},"required":["type","name","value"]},"LaunchpadDomainClaim":{"type":"object","properties":{"id":{"type":"string"},"domain":{"type":"string"},"state":{"type":"string","enum":["setting_up","deploying","active","failed","removing","removed"]},"dnsRecords":{"type":"array","items":{"$ref":"#/components/schemas/LaunchpadDomainDnsRecord"}},"checkMessage":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","domain","state","dnsRecords","checkMessage","createdAt","updatedAt"]},"AddLaunchpadDomainInput":{"type":"object","properties":{"domain":{"type":"string","minLength":1}},"required":["domain"]},"DataPortrait":{"type":"object","properties":{"id":{"type":"string"},"factBaseId":{"type":"string"}},"required":["id","factBaseId"]},"ProfileEvent":{"type":"object","properties":{"id":{"type":"string"},"runId":{"type":"string"}},"required":["id","runId"]},"Agent":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionName":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"name":{"type":"string"},"enabled":{"type":"boolean"},"publishedVersion":{"type":"number","nullable":true}},"required":["id","solutionId","name","enabled","publishedVersion"]},"CreateAgentInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true}},"required":["name"]},"AgentDelegationCapabilities":{"type":"object","properties":{"definition":{"type":"boolean"},"runtime":{"type":"boolean"},"studio":{"type":"boolean"}},"required":["definition","runtime","studio"],"additionalProperties":false},"AgentApiCapabilities":{"type":"object","properties":{"agentDelegation":{"$ref":"#/components/schemas/AgentDelegationCapabilities"}},"additionalProperties":false},"UpdateAgentInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"enabled":{"type":"boolean"}}},"AgentDefinition":{"type":"object","additionalProperties":{"nullable":true}},"UpdateAgentDefinitionInput":{"type":"object","properties":{"definition":{"$ref":"#/components/schemas/AgentDefinition"}},"required":["definition"]},"PublishAgentInput":{"type":"object","properties":{"label":{"type":"string"}}},"PortableConfigurationVariable":{"type":"object","properties":{"key":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","json","secret"]},"required":{"type":"boolean"},"displayName":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"defaultValue":{"type":"object","additionalProperties":{"nullable":true}}},"required":["key","type","required","displayName","description","defaultValue"]},"AgentExport":{"type":"object","properties":{"formatVersion":{"type":"number","enum":[1]},"name":{"type":"string"},"description":{"type":"string","nullable":true},"definition":{"type":"object","additionalProperties":{"nullable":true}},"configurationVariables":{"type":"array","items":{"$ref":"#/components/schemas/PortableConfigurationVariable"}}},"required":["formatVersion","name","description","definition"]},"ImportAgentInput":{"type":"object","properties":{"formatVersion":{"type":"number"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"definition":{"type":"object","additionalProperties":{"nullable":true}},"configurationVariables":{"type":"array","items":{"$ref":"#/components/schemas/PortableConfigurationVariable"}}},"required":["definition"]},"GenerateIntentPhrasesInput":{"type":"object","properties":{"intentName":{"type":"string","minLength":1},"intentDescription":{"type":"string"},"existingPhrases":{"type":"array","items":{"type":"string"},"description":"Phrases already on the intent — the result excludes these."}},"required":["intentName"]},"AgentIntent":{"type":"object","properties":{"name":{"type":"string","description":"snake_case handle, unique within the agent."},"description":{"type":"string"},"trainingPhrases":{"type":"array","items":{"type":"string"}},"priority":{"type":"number"},"slots":{"type":"array","items":{"type":"string"}},"condition":{"type":"string"},"toolNames":{"type":"array","items":{"type":"string"}},"docBaseIds":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"}},"required":["name"]},"ExtractIntentsInput":{"type":"object","properties":{"description":{"type":"string","minLength":1,"description":"Plain-language description of the assistant."}},"required":["description"]},"Flow":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionName":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"name":{"type":"string"}},"required":["id","solutionId","name"]},"FlowNodeCapabilities":{"type":"object","properties":{"interactionNodes":{"type":"boolean"}},"required":["interactionNodes"]},"FlowDraftInput":{"type":"object","properties":{"graph":{"type":"object","additionalProperties":{"nullable":true}}},"required":["graph"]},"FlowRunReceived":{"type":"object","properties":{"source":{"type":"string","description":"How the run was started: manual, test, schedule, event, webhook, api (a Flex Gateway endpoint), agent (an assistant), subflow, tag_assignment (an Identity sign-in or Run now)."},"input":{"nullable":true,"description":"The trigger input as stored - what the caller sent. Null when `truncated` is set. For a gateway run stored in the older wrapped shape (2026-07-17 to 2026-08-06), its request body alone."},"inputBytes":{"type":"integer","description":"The size of the input's JSON text in bytes (UTF-8)."},"truncated":{"type":"object","nullable":true,"properties":{"shownBytes":{"type":"integer"},"preview":{"type":"string","description":"The beginning of the input's JSON text - not parseable JSON on its own."}},"required":["shownBytes","preview"],"description":"Set when the input is larger than 64 KB of JSON text: `input` is null and this carries its beginning."},"withheld":{"type":"array","items":{"type":"string"},"description":"Dot paths, in the stored trigger, left out of `input` - the verified claims of a sign-in / Run now run, or every member beside the request body of a gateway run stored in the older wrapped shape (its claims and headers among them). Empty otherwise."},"caller":{"type":"object","nullable":true,"properties":{"subject":{"type":"string"},"email":{"type":"string","nullable":true},"displayName":{"type":"string","nullable":true},"issuer":{"type":"string","nullable":true},"replayed":{"type":"boolean","description":"True when the person was carried from their last sign-in (an Identity's \"Run now\") rather than verified for this run."}},"required":["subject","email","displayName","issuer","replayed"],"description":"The person or machine client the platform verified for the run; null when nobody was (Run, Test, a schedule, a webhook)."},"executionId":{"type":"string","nullable":true,"description":"The gateway tracking id the caller was handed; null when no gateway call started the run."}},"required":["source","inputBytes","truncated","withheld","caller","executionId"]},"FlowRunDetail":{"type":"object","properties":{"received":{"$ref":"#/components/schemas/FlowRunReceived"}},"required":["received"],"additionalProperties":{"nullable":true}},"CreateFlowInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true}},"required":["name"]},"ImportFlowInput":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"graph":{"type":"object","additionalProperties":{"nullable":true}},"configurationVariables":{"type":"array","items":{"$ref":"#/components/schemas/PortableConfigurationVariable"}}},"required":["graph"]},"BotListItem":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"solutionId":{"type":"string"},"solutionTitle":{"type":"string"},"agentId":{"type":"string"},"agentName":{"type":"string"},"kind":{"type":"string","enum":["teams","slack","whatsapp","telegram","sms"],"description":"The messaging platform. Every value is modelled; only some are available in a given build — an unavailable one answers 501 CHANNEL_KIND_NOT_AVAILABLE naming the channel.","example":"teams"},"mode":{"type":"string","enum":["managed","byo","store"],"description":"Who owns the Microsoft registration. managed = Flexday.ai creates and holds it · byo = the customer registered the bot themselves and pasted its credentials in · store = a shared Flexday.ai Teams app (modelled, not yet offered). GET /api/v1/bots/options reports which are available on this deployment, and why not when they are not.","example":"managed"},"status":{"type":"string","enum":["draft","verified","live","disabled"],"description":"draft = credentials never proved · verified = the credential check passed · live = accepting traffic · disabled = taken off the air by an operator."},"conversationCount":{"type":"number"},"updatedBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","solutionId","solutionTitle","agentId","agentName","kind","mode","status","conversationCount","updatedBy","createdAt","updatedAt"]},"BotOptions":{"type":"object","properties":{"channels":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["teams","slack","whatsapp","telegram","sms"],"description":"The messaging platform. Every value is modelled; only some are available in a given build — an unavailable one answers 501 CHANNEL_KIND_NOT_AVAILABLE naming the channel.","example":"teams"},"label":{"type":"string","description":"What a customer calls it — \"Microsoft Teams\"."},"available":{"type":"boolean"}},"required":["kind","label","available"]}},"modes":{"type":"array","items":{"type":"object","properties":{"mode":{"type":"string","enum":["managed","byo","store"],"description":"Who owns the Microsoft registration. managed = Flexday.ai creates and holds it · byo = the customer registered the bot themselves and pasted its credentials in · store = a shared Flexday.ai Teams app (modelled, not yet offered). GET /api/v1/bots/options reports which are available on this deployment, and why not when they are not.","example":"managed"},"label":{"type":"string","description":"\"Flexday.ai manages it\" / \"Your own Azure registration\"."},"available":{"type":"boolean"},"reason":{"type":"string","description":"Present only when `available` is false. Plain language, safe to render verbatim, and it names the setting an administrator would change when there is one."}},"required":["mode","label","available"]}},"graphPublish":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether this deployment has a Microsoft Graph application at all, i.e. whether a workspace can connect Microsoft 365 and publish bots straight into its own Teams catalog. False ⇒ every install goes the manual route, and no Connect affordance should be offered. It says NOTHING about whether a particular workspace has connected — ask GET /api/v1/tenants/{id}/teams-graph for that."}},"required":["configured"]}},"required":["channels","modes","graphPublish"]},"BotBranding":{"type":"object","properties":{"fullName":{"type":"string","maxLength":100,"description":"Shown where there is room for more than the short name (the bot's own name)."},"shortDescription":{"type":"string","maxLength":80,"description":"The one-line blurb in the app catalog. Teams REQUIRES it and caps it at 80 characters, so a default is emitted when this is absent."},"fullDescription":{"type":"string","maxLength":4000,"description":"The long description on the app's own page."},"accentColor":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","description":"Six-digit hex. Teams paints the outline icon's backdrop with it."}},"additionalProperties":false,"description":"How the app package presents itself. Absent fields fall back to the platform's defaults, so an unbranded bot produces the same package it always did. The ICONS are uploaded separately (POST /bots/:id/icons/:slot) because they are bytes."},"BotConfig":{"type":"object","properties":{"appId":{"type":"string","minLength":1,"description":"Teams: the bot's Microsoft App ID. Non-secret — it is the inbound token audience."},"entraTenantId":{"type":"string","minLength":1,"description":"Teams: the directory id a single-tenant registration needs to mint an outbound token."},"jwksUriOverride":{"type":"string","minLength":1,"description":"Bypass issuer discovery for the INBOUND signing keys (hermetic tests, sovereign clouds)."},"greeting":{"type":"string","maxLength":4000,"description":"Sent on install, before the user has said anything."},"audienceMapping":{"type":"object","properties":{"claimPath":{"type":"string","minLength":1},"prefix":{"type":"string"}},"required":["claimPath"],"additionalProperties":false,"description":"D18: which claim on the end user's platform identity carries their audience tags."},"staticAudiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"D18: audiences every caller of this bot holds regardless of their claims."},"branding":{"$ref":"#/components/schemas/BotBranding"}},"additionalProperties":false},"Bot":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"agentId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["teams","slack","whatsapp","telegram","sms"],"description":"The messaging platform. Every value is modelled; only some are available in a given build — an unavailable one answers 501 CHANNEL_KIND_NOT_AVAILABLE naming the channel.","example":"teams"},"mode":{"type":"string","enum":["managed","byo","store"],"description":"Who owns the Microsoft registration. managed = Flexday.ai creates and holds it · byo = the customer registered the bot themselves and pasted its credentials in · store = a shared Flexday.ai Teams app (modelled, not yet offered). GET /api/v1/bots/options reports which are available on this deployment, and why not when they are not.","example":"managed"},"status":{"type":"string","enum":["draft","verified","live","disabled"],"description":"draft = credentials never proved · verified = the credential check passed · live = accepting traffic · disabled = taken off the air by an operator."},"config":{"$ref":"#/components/schemas/BotConfig"},"iconColorFileId":{"type":"string","nullable":true,"description":"The `app.files` id of the 192x192 colour icon, or null when the package uses the platform default. Present so a UI can tell 'yours' from 'the default'."},"iconOutlineFileId":{"type":"string","nullable":true,"description":"The `app.files` id of the 32x32 outline icon, or null for the platform default."},"credentialsConfigured":{"type":"boolean"},"webhookConfigured":{"type":"boolean"},"platformRef":{"type":"string","nullable":true},"registrationStatus":{"type":"string","enum":["none","provisioning","ready","error"],"description":"How far the platform got provisioning this bot's registration. none = nothing to provision (every byo bot rests here) · provisioning = the job is queued or running · ready = the registration exists and its secret is sealed · error = it failed, see registrationError. A SEPARATE axis from `status`, which is the bot's own lifecycle."},"registrationError":{"type":"string","nullable":true,"description":"Why the last provision attempt failed, in words a person can act on. Caller-safe by construction — never a secret, a token or a bearer credential."},"teamsAppId":{"type":"string","nullable":true,"description":"The id the customer's own Teams org catalog assigned this bot's package, once published there. Drives the Open in Teams deep link; null until it has been published."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","solutionId","agentId","name","description","kind","mode","status","config","iconColorFileId","iconOutlineFileId","credentialsConfigured","webhookConfigured","platformRef","registrationStatus","registrationError","teamsAppId","createdAt","updatedAt"]},"BotCredentialsInput":{"type":"object","properties":{"appId":{"type":"string","minLength":1},"secret":{"type":"string","minLength":1,"description":"Write-only. Accepted once, encrypted at rest, never returned. Omit to leave the stored secret unchanged."},"entraTenantId":{"type":"string","minLength":1}},"additionalProperties":false},"UpdateBotInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"agentId":{"type":"string","minLength":1},"config":{"allOf":[{"$ref":"#/components/schemas/BotConfig"},{"nullable":true}]},"credentials":{"$ref":"#/components/schemas/BotCredentialsInput"}},"description":"A bot's `kind` is immutable (its channel is what it IS) and its status moves through POST /:id/status. `config` is a PATCH: a key set to null is removed, `config: null` resets the bag."},"BotGoLiveWarning":{"type":"object","properties":{"code":{"type":"string","description":"The lint code, stable across releases — ALL_MODE_ON_BOT_CHANNEL, WRITE_GRANT_ON_BOT_CHANNEL or FACT_BASE_GRANT_UNSCOPED today.","example":"ALL_MODE_ON_BOT_CHANNEL"},"message":{"type":"string","description":"Plain language, rendered verbatim."}},"required":["code","message"]},"SetBotStatusInput":{"type":"object","properties":{"status":{"type":"string","enum":["draft","verified","live","disabled"],"description":"draft = credentials never proved · verified = the credential check passed · live = accepting traffic · disabled = taken off the air by an operator."}},"required":["status"],"description":"Going `live` runs the full gate (published + enabled agent, no forms, credentials present). `verified` is set by POST /:id/verify, not here."},"BotVerification":{"type":"object","properties":{"ok":{"type":"boolean"},"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Which leg — so a failure names what to go and fix."},"ok":{"type":"boolean"},"detail":{"type":"string","description":"Caller-safe; never carries the credential."}},"required":["name","ok"]}}},"required":["ok","checks"]},"BotTestSendResult":{"type":"object","properties":{"conversationId":{"type":"string"},"platformMessageId":{"type":"string","nullable":true},"deliveryId":{"type":"string","nullable":true}},"required":["conversationId","platformMessageId","deliveryId"]},"BotTestSendInput":{"type":"object","properties":{"conversationId":{"type":"string","minLength":1,"description":"Which conversation to probe. Defaults to the bot's most recent one."}}},"CreatedBot":{"type":"object","properties":{"bot":{"$ref":"#/components/schemas/Bot"},"webhookToken":{"type":"string","description":"SHOWN ONCE, and only for a bot whose registration the customer owns (byo). Stored as a sha256 hash, so it cannot be read back — keep it or rotate it. Required by the manifest download. ABSENT on a managed create: the platform wires the endpoint itself and no human holds the token."},"webhookUrl":{"type":"string","description":"The messaging endpoint to paste into the platform's bot registration. Absent on a managed create — there is nothing to paste."},"webhookPath":{"type":"string","description":"The same address without an origin."}},"required":["bot"]},"BotConversation":{"type":"object","properties":{"id":{"type":"string"},"botId":{"type":"string"},"platformConversationId":{"type":"string"},"platformUserId":{"type":"string"},"displayName":{"type":"string","nullable":true},"scope":{"type":"string","enum":["personal","group","channel"]},"consent":{"type":"string","enum":["implicit","granted","revoked"],"description":"OUTREACH consent. It gates a proactive send, never a reply to the person's own message."},"agentSessionId":{"type":"string","nullable":true},"installedAt":{"type":"string","nullable":true},"lastInboundAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","botId","platformConversationId","platformUserId","displayName","scope","consent","agentSessionId","installedAt","lastInboundAt","createdAt","updatedAt"]},"BotDelivery":{"type":"object","properties":{"id":{"type":"string"},"botId":{"type":"string"},"conversationId":{"type":"string","nullable":true},"source":{"type":"string","enum":["flow","agent","reply","test"]},"sourceRef":{"type":"string","nullable":true},"status":{"type":"string","enum":["sent","delivered","read","failed"]},"platformMessageId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","botId","conversationId","source","sourceRef","status","platformMessageId","error","createdAt"]},"CreateBotInput":{"type":"object","properties":{"agentId":{"type":"string","minLength":1,"description":"The PUBLISHED Agent this bot answers with."},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["teams","slack","whatsapp","telegram","sms"],"description":"The messaging platform. Every value is modelled; only some are available in a given build — an unavailable one answers 501 CHANNEL_KIND_NOT_AVAILABLE naming the channel.","example":"teams"},"mode":{"type":"string","enum":["managed","byo","store"],"description":"Who owns the Microsoft registration. managed = Flexday.ai creates and holds it · byo = the customer registered the bot themselves and pasted its credentials in · store = a shared Flexday.ai Teams app (modelled, not yet offered). GET /api/v1/bots/options reports which are available on this deployment, and why not when they are not.","example":"managed"},"config":{"$ref":"#/components/schemas/BotConfig"},"credentials":{"$ref":"#/components/schemas/BotCredentialsInput"}},"required":["agentId","name","kind"],"description":"Creates the bot in `draft`. The response carries the webhook token ONCE — it is stored hashed and cannot be read back."},"TeamsGraphStatus":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether THIS DEPLOYMENT has a Microsoft Graph application at all. False ⇒ a connect attempt answers 503 TEAMS_GRAPH_UNCONFIGURED and only an operator can change it."},"connected":{"type":"boolean","description":"Whether THIS WORKSPACE has a live consent. False ⇒ publishing answers 422 TEAMS_GRAPH_NOT_CONNECTED and one of its own admins can fix it."},"microsoftTenantId":{"type":"string","description":"Which Microsoft organisation consented. Present only while `connected` is true — a revoked row keeps the id for support, but reporting it beside `connected: false` would read as a connection that is somehow both."}},"required":["configured","connected"]},"BotsStats":{"type":"object","properties":{"botCount":{"type":"number"},"liveCount":{"type":"number"},"draftCount":{"type":"number","description":"Still `draft`. `verified`/`disabled` are in neither count."},"conversations30d":{"type":"number","description":"Conversations that heard from someone in the last 30 days, across visible bots."}},"required":["botCount","liveCount","draftCount","conversations30d"]},"BotStats":{"type":"object","properties":{"botId":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["teams","slack","whatsapp","telegram","sms"],"description":"The messaging platform. Every value is modelled; only some are available in a given build — an unavailable one answers 501 CHANNEL_KIND_NOT_AVAILABLE naming the channel.","example":"teams"},"status":{"type":"string","enum":["draft","verified","live","disabled"],"description":"draft = credentials never proved · verified = the credential check passed · live = accepting traffic · disabled = taken off the air by an operator."},"agentId":{"type":"string","description":"The bound Agent — where this bot's model cost actually is, which is why there is no `aiUsage` block here (a bot makes no model call itself; its turns bill to the agent)."},"conversationCount":{"type":"number"},"deliveries7d":{"type":"number"},"failedDeliveries7d":{"type":"number"},"lastInboundAt":{"type":"string","nullable":true}},"required":["botId","name","kind","status","agentId","conversationCount","deliveries7d","failedDeliveries7d","lastInboundAt"]},"FactBase":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionTitle":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true}},"required":["id","name","solutionId"]},"FactBaseIngestLimits":{"type":"object","properties":{"sampleDataMaxBytes":{"type":"number","description":"Ceiling on ONE uploaded sample-data file, in bytes."},"sampleDataFileName":{"type":"string","description":"The name sample data is STORED under in a FactBase's managed File Store. A client that uploads through the File Store uploader must use it, so both ingest doors version ONE file rather than scattering an orphan per upload."}},"required":["sampleDataMaxBytes","sampleDataFileName"]},"FactBaseFileStore":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"solutionId":{"type":"string"},"fileCount":{"type":"number"},"totalBytes":{"type":"number"}},"required":["id","name","solutionId","fileCount","totalBytes"]},"FactBaseSampleDataFromFileInput":{"type":"object","properties":{"fileId":{"type":"string","description":"A file in this Solution's Files layer."}},"required":["fileId"]},"FactBaseExport":{"type":"object","properties":{"formatVersion":{"type":"number","enum":[1]},"name":{"type":"string"},"description":{"type":"string","nullable":true},"definition":{"type":"object","additionalProperties":{"nullable":true}},"sampleData":{"type":"string","nullable":true,"description":"The stored sample rows as JSON text, or null."},"sampleDataOmitted":{"type":"object","properties":{"reason":{"type":"string"},"bytes":{"type":"number"}},"required":["reason","bytes"],"description":"Present only when sample data EXISTS and was left out, with the reason and its size."},"roles":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}},"description":"Custom roles only — reader/writer are re-derived on provision."}},"required":["formatVersion","name","description","definition","sampleData","roles"]},"DefinitionValidationResult":{"type":"object","properties":{"ok":{"type":"boolean","description":"No `error`-severity issues."},"issues":{"type":"array","items":{"type":"object","properties":{"severity":{"type":"string","enum":["error","warning"]},"code":{"type":"string"},"path":{"type":"string","description":"A dotted pointer into the definition."},"message":{"type":"string"}},"required":["severity","code","path","message"]}}},"required":["ok","issues"]},"FactBaseSequencePosition":{"type":"object","properties":{"column":{"type":"string"},"lastValue":{"type":"number","nullable":true,"description":"The last value written, or null when the sequence has not been read since it was reset."},"nextValue":{"type":"number"}},"required":["column","lastValue","nextValue"]},"FactBaseLoadResult":{"type":"object","properties":{"schema":{"type":"string"},"rowCounts":{"type":"object","additionalProperties":{"type":"number"}},"identity":{"type":"string","enum":["restart","continue"]},"sequences":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/FactBaseSequencePosition"}}},"required":["schema","rowCounts","sequences"]},"AttachmentColumnMapping":{"type":"object","properties":{"sheetName":{"type":"string"},"sourceColumn":{"type":"string"},"targetTable":{"type":"string"},"targetColumn":{"type":"string"},"tier":{"type":"string","enum":["exact","ambiguous"],"description":"`exact` is a deterministic header-name match (no model call); `ambiguous` is AI-proposed and requires confirmation before anything is written."},"confidence":{"type":"number"}},"required":["sheetName","sourceColumn","targetTable","targetColumn","tier","confidence"]},"AttachmentUnmatchedColumn":{"type":"object","properties":{"sheetName":{"type":"string"},"sourceColumn":{"type":"string"}},"required":["sheetName","sourceColumn"]},"AttachmentMappingProposal":{"type":"object","nullable":true,"properties":{"factBaseId":{"type":"string"},"sheets":{"type":"array","items":{"type":"string"}},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/AttachmentColumnMapping"}},"unmatched":{"type":"array","items":{"$ref":"#/components/schemas/AttachmentUnmatchedColumn"}}},"required":["factBaseId","sheets","mappings","unmatched"]},"AttachmentConfirmedMappingInput":{"type":"object","properties":{"sheetName":{"type":"string"},"sourceColumn":{"type":"string"},"targetTable":{"type":"string"},"targetColumn":{"type":"string"}},"required":["sheetName","sourceColumn","targetTable","targetColumn"]},"ConfirmAttachmentMappingInput":{"type":"object","properties":{"jobId":{"type":"string","description":"The propose job id."},"mappings":{"type":"array","items":{"$ref":"#/components/schemas/AttachmentConfirmedMappingInput"},"description":"Caller-reviewed subset of the proposal (exact and/or ambiguous entries) to actually apply."}},"required":["jobId","mappings"]},"FactBaseClearDataPlan":{"type":"object","properties":{"tables":{"type":"array","items":{"type":"string"},"description":"The resolved set, children before parents."},"rowCounts":{"type":"object","additionalProperties":{"type":"number"},"description":"Live rows per table, read at plan time."},"totalRows":{"type":"number"},"identity":{"type":"string","enum":["restart","continue"]},"kept":{"type":"array","items":{"type":"string"},"description":"Live tables left OUT of the set — what keeps its rows."}},"required":["tables","rowCounts","totalRows","identity","kept"]},"FactBaseClearDataInput":{"type":"object","properties":{"tables":{"type":"array","items":{"type":"string"},"description":"The tables to empty; omit for every live table."},"except":{"type":"array","items":{"type":"string"},"description":"Tables to protect. If protecting one makes the set inconsistent the call is REFUSED, never cascaded through."},"identity":{"type":"string","enum":["restart","continue"],"description":"Whether the emptied tables' identity sequences restart from 1. Defaults to 'continue'."},"confirmRowCounts":{"type":"object","additionalProperties":{"type":"number"},"description":"The plan's own rowCounts, echoed back. Omit for the preflight."}}},"ExecuteQueryResult":{"type":"object","properties":{"success":{"type":"boolean"},"queryId":{"type":"string"},"data":{"nullable":true},"meta":{"type":"object","additionalProperties":{"nullable":true}},"error":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","queryId"]},"ExecuteQueryInput":{"type":"object","properties":{"params":{"type":"object","additionalProperties":{"nullable":true},"description":"Flat key/value params; keys/shape depend on the saved query (validated at runtime)."}}},"BuilderChatAttachment":{"type":"object","properties":{"id":{"type":"string"},"mimeType":{"type":"string"},"filename":{"type":"string"}},"required":["id","mimeType","filename"]},"BuilderSimulatedItem":{"type":"object","properties":{"kind":{"type":"string","enum":["agent","doc_base","fact_base","flow","file_store","identity","ai_behaviour","integration","other"],"description":"What the placeholder stands in for: the Flexday resource it should have been (agent, doc_base, fact_base, flow, file_store, identity), `ai_behaviour` (an AI step faked with a fixed answer), `integration` (an outside system) or `other`."},"what":{"type":"string","description":"The thing, named the way the person would."},"why":{"type":"string","description":"Why it is not real."},"howToMakeReal":{"type":"string","description":"What it would take to make it real, when the builder could say."}},"required":["kind","what","why"]},"BuilderChatDetails":{"type":"object","properties":{"simulated":{"type":"array","items":{"$ref":"#/components/schemas/BuilderSimulatedItem"},"description":"The builder's placeholder declaration, on the note that told the person about it: everything in the project that was still not real when the builder finished that turn. An empty list is the note saying everything previously marked as a placeholder is now real."}}},"BuilderChatMessage":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["user","agent","question"]},"text":{"type":"string"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/BuilderChatAttachment"}},"createdAt":{"type":"string","description":"ISO 8601 — when the message was sent."},"details":{"$ref":"#/components/schemas/BuilderChatDetails"}},"required":["id","role","text","attachments","createdAt"]},"BuilderChatInput":{"type":"object","properties":{"message":{"type":"string"},"model":{"type":"string","description":"A catalog CHAT model id to run THIS build on, overriding the workspace's Builder setting. Omit for the normal setting → platform-default chain. An unknown or non-chat id is refused with UNKNOWN_MODEL."}}},"BuilderUsage":{"type":"object","properties":{"costUsd":{"type":"number","nullable":true,"description":"What the builder (its own calls: the build loop, the reply writer, the memory summariser) has spent on this owner, in USD at list prices, across every conversation. 0 when it has made no calls; null when it has made calls and none of their models has a rate card — unknown, never free."},"unpricedCalls":{"type":"integer","description":"Calls whose model has no rate card: their tokens are counted, their cost is not in `costUsd`."},"inputTokens":{"type":"integer","description":"Uncached input tokens."},"outputTokens":{"type":"integer"},"cacheCreationInputTokens":{"type":"integer"},"cacheReadInputTokens":{"type":"integer"},"calls":{"type":"integer"},"memoryTokens":{"type":"integer","nullable":true,"description":"The size, in tokens, of the request the builder sends each step for this conversation's memory (system prompt and tool definitions included), as of the last save. Null when it has not been measured yet (no conversation, or none since this figure existed)."},"memoryLimitTokens":{"type":"integer","description":"The AI model's limit for one request — what a full memory means."},"compactAtTokens":{"type":"integer","description":"The size at which the older part of the memory is summarised automatically."},"compactedAt":{"type":"string","nullable":true,"description":"ISO 8601 — when this conversation's memory was last compacted; null when never."},"compactionCount":{"type":"integer","description":"How many times this conversation's memory has been compacted."}},"required":["costUsd","unpricedCalls","inputTokens","outputTokens","cacheCreationInputTokens","cacheReadInputTokens","calls","memoryTokens","memoryLimitTokens","compactAtTokens","compactedAt","compactionCount"]},"BuilderBriefResponse":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"brief":{"type":"string","nullable":true,"description":"The person's brief, or null when there is none."},"notes":{"type":"string","nullable":true,"description":"The builder's notes, or null when there are none."},"updatedAt":{"type":"string","description":"ISO 8601 - when the owner last changed (its brief, its notes or anything else about it)."}},"required":["success","brief","notes","updatedAt"]},"BuilderBriefInput":{"type":"object","properties":{"brief":{"type":"string","nullable":true,"description":"The person's brief: what the builder must follow on every turn. Omit to leave it as it is; null or blank clears it. At most 20,000 characters (String.length) - longer is refused with 422 BRIEF_TOO_LONG and nothing is saved, never trimmed."},"notes":{"type":"string","nullable":true,"description":"The builder's own notes (design rules, decisions it saved on earlier turns), which the person may correct. Omit to leave them as they are; null or blank clears them. The same 20,000-character limit."}},"additionalProperties":false},"BuilderSimulatedDeclaration":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/BuilderSimulatedItem"},"description":"Everything the builder said was still a placeholder - not really built - as of its last finished turn, in the person's own words. Empty when nothing is: the placeholders it reported have since been made real, or it has never had one to report."},"declaredAt":{"type":"string","nullable":true,"description":"ISO 8601 - when the builder last reported its placeholder list: the time of the chat note that carried it (the placeholders, or \"everything previously marked as a placeholder is now real\"). Null when no such note is on record: the builder has not finished a turn since the list existed, every finish so far declared everything real (an empty list that stays empty is not announced), or the conversation was started over with New chat. So `items: []` with a date means the placeholders it last reported have all been made real."}},"required":["items","declaredAt"]},"SolutionExportRequiresRow":{"type":"object","properties":{"dataKey":{"type":"string"},"byResourceName":{"type":"string"},"via":{"type":"string"}},"required":["dataKey","byResourceName","via"]},"SolutionExportPlanType":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"ownsData":{"type":"boolean"},"estimatedBytes":{"type":"number"},"requires":{"type":"array","items":{"$ref":"#/components/schemas/SolutionExportRequiresRow"}},"mandatory":{"type":"string","nullable":true}},"required":["key","label","ownsData","estimatedBytes","requires","mandatory"]},"SolutionExportDestination":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"SolutionExportDeletedFile":{"type":"object","properties":{"name":{"type":"string"},"deletedAt":{"type":"string"}},"required":["name","deletedAt"]},"SolutionExportRequest":{"type":"object","properties":{"ticks":{"type":"object","additionalProperties":{"type":"boolean"}},"destinationStoreId":{"type":"string","nullable":true}}},"SolutionExportJob":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"status":{"type":"string","description":"queued | running | done | error | awaiting_input | aborted."},"error":{"type":"string","nullable":true,"description":"The failure's stable CODE, not prose."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","status","error","createdAt","updatedAt"]},"SolutionExportListItem":{"type":"object","properties":{"fileId":{"type":"string"},"fileStoreId":{"type":"string"},"fileStoreName":{"type":"string"},"name":{"type":"string"},"sizeBytes":{"type":"number"},"createdAt":{"type":"string"},"scanStatus":{"type":"string"}},"required":["fileId","fileStoreId","fileStoreName","name","sizeBytes","createdAt","scanStatus"]},"SolutionImportStagingPlan":{"type":"object","properties":{"importId":{"type":"string"},"expiresAt":{"type":"string"},"mode":{"type":"string","enum":["single","multipart"]},"upload":{"type":"object","properties":{"url":{"type":"string"},"method":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}}},"required":["url","method"]},"multipart":{"type":"object","properties":{"uploadId":{"type":"string"},"partSize":{"type":"number"},"parts":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string"},"method":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"partNumber":{"type":"number"}},"required":["url","method","partNumber"]}}},"required":["uploadId","partSize","parts"]}},"required":["importId","expiresAt","mode"]},"SolutionImportStagingInput":{"type":"object","properties":{"fileName":{"type":"string","minLength":1},"sizeBytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"The declared length, up to the staged ceiling (GET /import/limits). Verified against the stored object at /complete."}},"required":["fileName","sizeBytes"]},"SolutionImportStagingCompleteInput":{"type":"object","properties":{"uploadId":{"type":"string","description":"Echoed back from the staging plan on the multipart path."},"parts":{"type":"array","items":{"type":"object","properties":{"partNumber":{"type":"integer","minimum":0,"exclusiveMinimum":true},"etag":{"type":"string"}},"required":["partNumber"]},"description":"The staged parts, as the storage service reported them."}}},"SolutionImportDataSelection":{"type":"object","properties":{"factBases":{"type":"boolean"},"fileStores":{"type":"boolean"},"docBases":{"type":"boolean"},"history":{"type":"boolean"}},"additionalProperties":false,"description":"Which of the data a bundle carries to import. An absent key means yes."},"SolutionImportByIdInput":{"type":"object","properties":{"importId":{"type":"string"},"data":{"$ref":"#/components/schemas/SolutionImportDataSelection"}},"required":["importId"]},"SolutionImportFromFileInput":{"type":"object","properties":{"fileStoreId":{"type":"string"},"fileId":{"type":"string"},"data":{"$ref":"#/components/schemas/SolutionImportDataSelection"}},"required":["fileStoreId","fileId"]},"SolutionImportJob":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"status":{"type":"string","description":"queued | running | done | error | awaiting_input | aborted."},"error":{"type":"string","nullable":true,"description":"The failure's stable CODE, not prose."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","status","error","createdAt","updatedAt"]},"SolutionImportLimits":{"type":"object","properties":{"maxBufferedBytes":{"type":"number","description":"The buffered-route ceiling — only reached when staging is unavailable."},"maxStagedBytes":{"type":"number","description":"The staged-route ceiling."},"stagingAvailable":{"type":"boolean","description":"Whether this deployment’s storage backend can presign at all."}},"required":["maxBufferedBytes","maxStagedBytes","stagingAvailable"]},"SolutionBundleRequiresRow":{"type":"object","properties":{"dataKey":{"type":"string"},"byResourceName":{"type":"string"},"via":{"type":"string"}},"required":["dataKey","byResourceName","via"]},"SolutionBundleDataRow":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"present":{"type":"boolean"},"rowCount":{"type":"number"},"estimatedBytes":{"type":"number"},"requires":{"type":"array","items":{"$ref":"#/components/schemas/SolutionBundleRequiresRow"}},"mandatory":{"type":"string","nullable":true}},"required":["key","label","present","rowCount","estimatedBytes","requires","mandatory"]},"SolutionBundleSummary":{"type":"object","properties":{"solutionTitle":{"type":"string"},"generatedAt":{"type":"string"},"data":{"type":"array","items":{"$ref":"#/components/schemas/SolutionBundleDataRow"}}},"required":["solutionTitle","generatedAt","data"]},"SolutionImportSource":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"CreateFactBaseInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["name","content"]},"CreateGatewayInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"slug":{"type":"string"},"description":{"type":"string"}},"required":["name"]},"CreateIdentityInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"provider":{"type":"string","minLength":1,"description":"The IdP preset: `entra` (default), `oidc` (generic), and the catalog presets.","example":"oidc"},"config":{"$ref":"#/components/schemas/IdentityConfig"},"entraTenantId":{"type":"string","nullable":true},"spaClientId":{"type":"string","nullable":true},"apiAudience":{"type":"string","nullable":true},"allowedAudiences":{"type":"array","items":{"type":"string"}},"issuer":{"type":"string","nullable":true},"jwksUri":{"type":"string","nullable":true},"defaultScopes":{"type":"array","items":{"type":"string"}},"oboClientId":{"type":"string","nullable":true},"oboClientSecret":{"type":"string","nullable":true,"description":"Write-only; encrypted at rest, never returned."},"sharedSecret":{"type":"string","nullable":true,"description":"Write-only; encrypted at rest, never returned. The shared decryptable secret used by the HMAC / shared-secret-JWT / introspection kinds. Send null or \"\" to clear it."},"oidcClientSecret":{"type":"string","nullable":true,"description":"Write-only; encrypted at rest, never returned. The IdP CLIENT SECRET the Flex Gateway presents at the provider's token endpoint when it exchanges a served app's authorization code server-side — required by Google, unused by a public PKCE client. Only settable on a kind whose users sign in through an OIDC redirect (oidc_jwt, saml_federated). Send null or \"\" to clear it."},"basicPassword":{"type":"string","nullable":true,"description":"Write-only; stored as a sha256 hash (never decryptable, never returned) for a `basic` identity. Rotate by sending a new one; send null or \"\" to clear it. Use a LONG RANDOM value — it is a machine credential, and an unsalted hash offers no protection against guessing a weak one."},"allowAnonymousEndpoints":{"type":"boolean"},"kind":{"$ref":"#/components/schemas/IdentityKind"}},"required":["name"],"description":"`kind` defaults to `oidc_jwt` and `provider` to `entra`; both secrets are write-only."},"FileStoreSettings":{"type":"object","properties":{"defaultAudiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Audience tags NEW files inherit at upload (D18)."},"maxFileBytes":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"description":"Per-file size ceiling. May only LOWER the FILE_STORE_MAX_BYTES platform limit. null clears it back to the platform default."},"allowedMediaTypes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Allow-list of media types; exact (\"image/png\") or a family wildcard (\"image/*\"). null/[] clears it back to \"any type\"."},"deniedMediaTypes":{"type":"array","nullable":true,"items":{"type":"string"},"description":"Deny-list of media types, applied after the allow-list. null/[] clears it back to \"nothing denied\"."},"requireScan":{"type":"boolean","description":"Refuse an upload unless a usable malware scanner is configured. With no scanner the upload is refused BY NAME (FILE_SCANNER_UNCONFIGURED) rather than accepted and never scanned."},"retentionDays":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"description":"null clears it back to \"keep indefinitely\"."},"versionRetention":{"type":"integer","nullable":true,"minimum":0,"exclusiveMinimum":true,"description":"Keep only the newest N byte versions; older ones have their BYTES purged (rows kept). null clears it back to \"keep every version\"."},"publicUploads":{"type":"boolean"},"defaultDownloadPolicy":{"type":"string","nullable":true,"enum":["always","never","authenticated_only"],"description":"Default document-card download policy. Agent grants may only narrow it. null clears it back to unset."}}},"FileStoreLimits":{"type":"object","properties":{"maxBytes":{"type":"number","description":"Ceiling for the BUFFERED (multipart) upload route."},"maxPresignedBytes":{"type":"number","description":"Ceiling for the PRESIGNED direct-to-storage route."},"presignThresholdBytes":{"type":"number","description":"At or above this size the client should request an upload link instead of posting bytes."},"presignAvailable":{"type":"boolean","description":"Whether this deployment’s storage backend can issue direct upload links at all."}},"required":["maxBytes","maxPresignedBytes","presignThresholdBytes","presignAvailable"]},"FileStore":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"settings":{"$ref":"#/components/schemas/FileStoreSettings"},"limits":{"$ref":"#/components/schemas/FileStoreLimits"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","solutionId","name","description","status","settings","limits","createdAt","updatedAt"]},"CreateFileStoreInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"settings":{"$ref":"#/components/schemas/FileStoreSettings"}},"required":["name"]},"FileStoreListItem":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string","nullable":true},"solutionTitle":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true},"templateName":{"type":"string","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string"},"fileCount":{"type":"number"},"totalBytes":{"type":"number"},"managedBy":{"type":"string","nullable":true,"description":"The resource that system-manages this store (e.g. \"doc_base\"), else null. A managed store cannot be renamed or deleted by a user."},"updatedBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","solutionId","solutionTitle","name","description","status","fileCount","totalBytes","managedBy","updatedBy","createdAt","updatedAt"]},"UpdateFileStoreInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"settings":{"$ref":"#/components/schemas/FileStoreSettings"}}},"File":{"type":"object","properties":{"id":{"type":"string"},"fileStoreId":{"type":"string"},"folder":{"type":"string"},"name":{"type":"string"},"mediaType":{"type":"string","description":"The SERVER's content-type decision, never the client's header."},"sizeBytes":{"type":"number"},"sha256":{"type":"string"},"handle":{"type":"object","properties":{"fileStoreId":{"type":"string"},"fileId":{"type":"string"},"version":{"type":"integer"},"sha256":{"type":"string"},"name":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"integer"}},"required":["fileStoreId","fileId","version","sha256","name","mediaType","sizeBytes"],"description":"Server-minted immutable file handle for graph bindings."},"currentVersion":{"type":"number"},"audiences":{"type":"array","items":{"type":"string"}},"scanStatus":{"type":"string","enum":["pending","clean","infected","skipped","failed"]},"scanDetail":{"type":"string","nullable":true},"scannedAt":{"type":"string","nullable":true},"uploadedVia":{"type":"string","enum":["studio","gateway","flow","agent","builder","docbase"]},"endUserRef":{"type":"string","nullable":true},"uploadPending":{"type":"boolean","description":"A presigned upload is in flight: the row exists, its bytes may not. Never servable while true."},"servable":{"type":"boolean","description":"Whether the bytes may be served. False while pending, infected or failed."},"updatedBy":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","fileStoreId","folder","name","mediaType","sizeBytes","sha256","handle","currentVersion","audiences","scanStatus","scanDetail","scannedAt","uploadedVia","endUserRef","uploadPending","servable","createdAt","updatedAt"]},"UploadFileInput":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"folder":{"type":"string"},"audiences":{"type":"string","description":"JSON array or comma-separated tags. Omit to inherit settings.defaultAudiences."},"note":{"type":"string"}}},"PresignedUploadPlan":{"type":"object","properties":{"fileId":{"type":"string"},"name":{"type":"string","description":"The stored name — a collision may have derived a new one."},"folder":{"type":"string"},"version":{"type":"number"},"mode":{"type":"string","enum":["single","multipart"]},"expiresAt":{"type":"string"},"upload":{"type":"object","properties":{"url":{"type":"string"},"method":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}}},"required":["url","method"]},"multipart":{"type":"object","properties":{"uploadId":{"type":"string"},"partSize":{"type":"number"},"parts":{"type":"array","items":{"type":"object","properties":{"partNumber":{"type":"number"},"url":{"type":"string"},"method":{"type":"string"},"headers":{"type":"object","additionalProperties":{"type":"string"}}},"required":["partNumber","url","method"]}}},"required":["uploadId","partSize","parts"]}},"required":["fileId","name","folder","version","mode","expiresAt"]},"PresignUploadInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"folder":{"type":"string","nullable":true,"maxLength":512,"description":"Folder label, e.g. \"invoices/2026\". Empty ⇒ the store root."},"sizeBytes":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"The declared length. Verified against the stored object at completion."},"mediaType":{"type":"string","description":"The client’s declared type — a HINT. The head bytes of the stored object decide."},"sha256":{"type":"string","pattern":"^[0-9a-fA-F]{64}$","description":"Optional declared content hash, verified at completion when supplied."},"audiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Audience tags (lowercase slugs). Empty ⇒ unrestricted within this File Store."}},"required":["name","sizeBytes"]},"CompleteUploadInput":{"type":"object","properties":{"sha256":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"},"uploadId":{"type":"string","description":"Echoed back from a multipart plan."},"parts":{"type":"array","items":{"type":"object","properties":{"partNumber":{"type":"integer","minimum":0,"exclusiveMinimum":true},"etag":{"type":"string"}},"required":["partNumber"]},"description":"The staged parts, as the storage service reported them."}}},"UpdateFileInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"folder":{"type":"string","nullable":true,"maxLength":512,"description":"Folder label, e.g. \"invoices/2026\". Empty ⇒ the store root."}}},"FileVersion":{"type":"object","properties":{"id":{"type":"string"},"fileId":{"type":"string"},"version":{"type":"number"},"sha256":{"type":"string"},"sizeBytes":{"type":"number"},"mediaType":{"type":"string"},"note":{"type":"string","nullable":true},"scanStatus":{"type":"string","enum":["pending","clean","infected","skipped","failed"]},"bytesPurged":{"type":"boolean","description":"The bytes were reclaimed by versionRetention; the row is kept."},"createdAt":{"type":"string"}},"required":["id","fileId","version","sha256","sizeBytes","mediaType","note","scanStatus","bytesPurged","createdAt"]},"RestoreFileVersionInput":{"type":"object","properties":{"version":{"type":"integer","minimum":0,"exclusiveMinimum":true}},"required":["version"]},"SetFileAudiencesInput":{"type":"object","properties":{"audiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Audience tags (lowercase slugs). Empty ⇒ unrestricted within this File Store."}},"required":["audiences"]},"BulkFileAudiencesInput":{"type":"object","properties":{"fileIds":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":200},"audiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Audience tags (lowercase slugs). Empty ⇒ unrestricted within this File Store."}},"required":["fileIds","audiences"]},"FileStoreFolder":{"type":"object","properties":{"folder":{"type":"string"},"fileCount":{"type":"number"}},"required":["folder","fileCount"]},"CreateFolderInput":{"type":"object","properties":{"folder":{"type":"string","minLength":1,"description":"The folder path to create, e.g. \"invoices/2027\"."}},"required":["folder"]},"RenameFolderInput":{"type":"object","properties":{"from":{"type":"string","minLength":1,"description":"The folder to rename, e.g. \"invoices/2026\"."},"to":{"type":"string","minLength":1,"description":"Its new path, e.g. \"invoices/2026-archive\"."}},"required":["from","to"]},"FileAccessEntry":{"type":"object","properties":{"id":{"type":"string"},"fileId":{"type":"string"},"fileStoreId":{"type":"string"},"fileName":{"type":"string","nullable":true,"description":"The name as it was when read."},"version":{"type":"number","nullable":true,"description":"The byte revision served — or, for a `list`, how many files were returned."},"op":{"type":"string","enum":["download","presign","preview","list"]},"source":{"type":"string","enum":["studio","gateway","flow","agent"]},"actorId":{"type":"string","nullable":true},"actorName":{"type":"string","nullable":true},"endUserRef":{"type":"string","nullable":true,"description":"The gateway end user’s subject."},"sessionId":{"type":"string","nullable":true},"ip":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"bytes":{"type":"number","nullable":true},"durationMs":{"type":"number","nullable":true},"at":{"type":"string"}},"required":["id","fileId","fileStoreId","fileName","version","op","source","actorId","actorName","endUserRef","sessionId","ip","userAgent","bytes","durationMs","at"]},"TemplateListItem":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"source":{"type":"string","enum":["flagship","tenant"]},"createdBy":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true}},"required":["id","name"],"description":"Null when the creating actor is the reserved system actor (system/seed-authored)."},"versionMajor":{"type":"number"},"versionMinor":{"type":"number"},"versionPatch":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"catalogEntryId":{"type":"string","nullable":true},"catalogCurrentTemplateId":{"type":"string","nullable":true},"liveCatalogVersion":{"type":"string","nullable":true,"description":"The version of this Template's own live global-catalog release (`major.minor.patch`), set only on a published original, never on a catalog snapshot. Absent or null = not in the global catalog."}},"required":["id","name","description","source","createdBy","versionMajor","versionMinor","versionPatch","createdAt","updatedAt","catalogEntryId","catalogCurrentTemplateId"]},"Template":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"source":{"type":"string","enum":["flagship","tenant"]},"createdByActorId":{"type":"string"},"versionMajor":{"type":"number"},"versionMinor":{"type":"number"},"versionPatch":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"factBaseId":{"type":"string","nullable":true,"description":"The Template's primary owned FactBase, or null while a publish/clone job is still populating it (or genuinely empty)."},"dataDefinition":{"type":"object","nullable":true,"additionalProperties":{"nullable":true},"description":"M8 — the same primary owned FactBase's (`factBaseId`) definition, derived the same way `SolutionDetail.dataDefinition` is. Used only for the Template Builder's composer refinement-suggestion chips; null whenever there is no owned FactBase yet, or it has no definition yet."},"launchpadId":{"type":"string","nullable":true,"description":"The Template's primary owned LaunchPad, or null while a publish/clone job is still populating it (or genuinely empty)."},"previewUrl":{"type":"string","nullable":true,"description":"A short-lived, gated capability URL for previewing the Template's owned LaunchPad, minted fresh on every read. Null when the Template has no LaunchPad to preview (e.g. a Flows/Agents-only template) — the normal case, not an error."},"previewTargets":{"type":"array","items":{"type":"object","properties":{"launchpadId":{"type":"string"},"title":{"type":"string"},"slug":{"type":"string"},"previewUrl":{"type":"string"}},"required":["launchpadId","title","slug","previewUrl"]},"description":"Every owned LaunchPad that can be previewed, PRIMARY FIRST then creation order, each with its own short-lived gated preview URL (the token is bound to that LaunchPad's slug, so one entry cannot serve another). previewTargets[0].previewUrl always equals previewUrl. Empty when the Template owns no LaunchPad."},"canEdit":{"type":"boolean","description":"L7 — whether the caller can edit this Template's owned resources, computed server-side from the same predicate requireTemplatePermission enforces. Never re-derive this from `source` + role client-side; there is no `tenantId` on this DTO to derive it from."},"editRefusalReason":{"type":"string","nullable":true,"description":"Mirrors the 403 the Builder would hit on first write. Null when `canEdit` is true."},"canDelete":{"type":"boolean","description":"Whether the CALLER may delete this Template. STRICTER than `canEdit`: deleting the row needs admin access, and a flagship template can never be deleted from a workspace. Gate a Delete control on this, never on `canEdit`."},"deleteRefusalReason":{"type":"string","nullable":true,"description":"Why `canDelete` is false. Null when it is true."},"canRename":{"type":"boolean","description":"FAI-1025 — whether the caller may rename this Template / edit its description. STRICTER than BOTH `canEdit` (member+) and `canDelete` (currently member): the row's own identity is `members:manage`, admin+. Never re-derive this from `source` + role client-side; there is no `tenantId` on this DTO to derive it from."},"renameRefusalReason":{"type":"string","nullable":true,"description":"Mirrors the 403 the PATCH would answer. Null when `canRename` is true."},"catalogReleaseId":{"type":"string","nullable":true,"description":"Global catalog as immutable snapshots: non-null means this Template row IS a frozen catalog copy, owned by the default workspace and never editable."},"catalogEntryId":{"type":"string","nullable":true,"description":"The stable catalog entry this snapshot belongs to (its live Template's own id) — use `/templates/catalog/{catalogEntryId}` for a link that always opens the current version. Null for a non-snapshot Template."},"catalogCurrentTemplateId":{"type":"string","nullable":true,"description":"That entry's CURRENT live snapshot id, or null for a non-snapshot Template or a withdrawn entry. This Template is the latest version exactly when this equals its own `id`."},"globalCatalog":{"type":"object","nullable":true,"properties":{"canPublish":{"type":"boolean"},"canWithdraw":{"type":"boolean"},"reason":{"type":"string","nullable":true},"liveRelease":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"version":{"type":"string"},"publishedAt":{"type":"string"}},"required":["id","version","publishedAt"]}},"required":["canPublish","canWithdraw","reason","liveRelease"],"description":"Whether the caller may publish a new catalog release of this Template or withdraw its current one. Null/absent = no such action applies to this caller (only the default workspace's own Templates, viewed from that workspace, get one) — hide the control. Both flags false = show them disabled with `reason`. `liveRelease` names the entry's current live release, if any. Server-resolved; never re-derive client-side."}},"required":["id","name","description","source","createdByActorId","versionMajor","versionMinor","versionPatch","createdAt","updatedAt","factBaseId","dataDefinition","launchpadId","previewUrl","previewTargets","canEdit","editRefusalReason","canDelete","deleteRefusalReason","catalogReleaseId","catalogEntryId","catalogCurrentTemplateId"]},"PublishPreflightFinding":{"type":"object","properties":{"severity":{"type":"string","enum":["error","warning"]},"code":{"type":"string"},"resource":{"type":"object","properties":{"kind":{"type":"string","enum":["fact_base","configuration"]},"id":{"type":"string"},"name":{"type":"string"}},"required":["kind","id","name"]},"path":{"type":"string","nullable":true},"message":{"type":"string"}},"required":["severity","code","resource","path","message"]},"PublishPreflightReport":{"type":"object","properties":{"ok":{"type":"boolean","description":"True when there is no error-severity finding."},"wipe":{"type":"boolean","description":"Which wipe toggle this report was computed for."},"findings":{"type":"array","items":{"$ref":"#/components/schemas/PublishPreflightFinding"}}},"required":["ok","wipe","findings"]},"ReleasedTemplateVersion":{"type":"object","properties":{"id":{"type":"string"},"resourceType":{"type":"string","enum":["template"]},"resourceId":{"type":"string"},"version":{"type":"number"},"state":{"type":"string"},"label":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","resourceType","resourceId","version","state","label","createdAt","updatedAt"]},"TemplateCatalogRelease":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"sourceTemplateId":{"type":"string"},"snapshotTemplateId":{"type":"string","nullable":true},"snapshotRemovedAt":{"type":"string","nullable":true},"versionMajor":{"type":"number"},"versionMinor":{"type":"number"},"versionPatch":{"type":"number"},"releaseNote":{"type":"string","nullable":true},"status":{"type":"string","enum":["building","live","superseded","withdrawn","failed"]},"retiredAt":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdByActorId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","tenantId","sourceTemplateId","snapshotTemplateId","snapshotRemovedAt","versionMajor","versionMinor","versionPatch","releaseNote","status","retiredAt","error","createdByActorId","createdAt","updatedAt"]},"TemplateBuilderChatAttachment":{"type":"object","properties":{"id":{"type":"string"},"mimeType":{"type":"string"},"filename":{"type":"string"}},"required":["id","mimeType","filename"]},"TemplateBuilderChatMessage":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string","enum":["user","agent","question"]},"text":{"type":"string"},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/TemplateBuilderChatAttachment"}},"createdAt":{"type":"string"},"details":{"$ref":"#/components/schemas/BuilderChatDetails"}},"required":["id","role","text","attachments","createdAt"]},"TemplateBuilderChatInput":{"type":"object","properties":{"message":{"type":"string"}}},"IntegrationFieldChoice":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]},"IntegrationField":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["string","text","integer","boolean","choice","string_list","string_map"]},"required":{"type":"boolean"},"templatable":{"type":"boolean"},"maxLength":{"type":"integer"},"min":{"type":"integer"},"max":{"type":"integer"},"choices":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationFieldChoice"}},"keySource":{"type":"string","enum":["connection.allowedCustomFields"]},"help":{"type":"string"},"placeholder":{"type":"string"},"advanced":{"type":"boolean"}},"required":["key","label","type"]},"IntegrationStepPolicy":{"type":"object","properties":{"maxAttempts":{"type":"integer"},"backoffMs":{"type":"integer"},"timeoutMs":{"type":"integer"},"onFailure":{"type":"string","enum":["fail","continue","error_branch"]}},"required":["maxAttempts","backoffMs","timeoutMs","onFailure"]},"IntegrationAction":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"effect":{"type":"string","enum":["read","write"]},"fields":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationField"}},"outputFields":{"type":"array","items":{"type":"string"}},"defaultPolicy":{"$ref":"#/components/schemas/IntegrationStepPolicy"},"supportsReconciliation":{"type":"boolean"},"idempotent":{"type":"boolean"}},"required":["key","label","description","effect","fields","outputFields","defaultPolicy","supportsReconciliation"]},"IntegrationProvider":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"authKinds":{"type":"array","items":{"type":"string"}},"connectionFields":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationField"}},"actions":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationAction"}},"docsUrl":{"type":"string"}},"required":["key","label","description","authKinds","connectionFields","actions"]},"CreateAgentSessionInput":{"type":"object","properties":{"channel":{"type":"string","enum":["test","api"]},"draft":{"type":"boolean"},"endUserRef":{"type":"string","nullable":true}}},"AgentTurn":{"type":"object","properties":{"metadata":{"$ref":"#/components/schemas/AgentTurnMetadata"}},"required":["metadata"]},"AgentSendMessageInput":{"type":"object","properties":{"text":{"type":"string","minLength":1,"description":"The user message."},"previewAsAudiences":{"type":"array","items":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z0-9][a-z0-9-]*$"},"maxItems":32,"description":"Preview this turn's doc_base_search / file_store retrieval as an end-user holding ONLY these audiences (FAI-902 — an explicit UNTRUSTED AccessContext, the same shape DocBase Search's own previewAsAudiences already sends). Empty array ⇒ preview as anonymous. Test (Playground) channel only, and gated on members:manage; a turn run this way also refuses every side-effecting tool (send_email/run_flow/run_agent/handoff/channel_message/http_request/memory) rather than executing it. Ignored when resuming an already-paused turn — that turn keeps the scope it started with."}},"required":["text"]},"SubmitAgentFormInput":{"type":"object","properties":{"requestId":{"type":"string","minLength":1},"values":{"type":"object","additionalProperties":{"nullable":true}}},"required":["requestId","values"],"additionalProperties":false},"AgentTurnFeedback":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"turnId":{"type":"string"},"rating":{"type":"string","enum":["up","down"]},"comment":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","sessionId","turnId","rating","comment","createdAt","updatedAt"]},"SubmitAgentFeedbackInput":{"type":"object","properties":{"rating":{"type":"string","enum":["up","down"],"description":"up | down."},"comment":{"type":"string","nullable":true,"maxLength":1000,"description":"Optional free text. Blank is stored as absent."}},"required":["rating"],"additionalProperties":false},"AgentDelegationToolStep":{"type":"object","properties":{"name":{"type":"string","description":"The child tool that ran, e.g. `search_docs_1`."},"ok":{"type":"boolean","description":"False for a failed call AND for one with no recorded result."},"summary":{"type":"string","description":"The tool's own operator-facing summary, never its content."}},"required":["name","ok"]},"AgentDelegationSummary":{"type":"object","properties":{"id":{"type":"string","description":"The opaque delegation id — the trace handle, not a session id."},"childAgentId":{"type":"string"},"childAgentName":{"type":"string","nullable":true,"description":"Null when the child Agent has since been deleted."},"childVersion":{"type":"number","description":"The published child version this execution was pinned to."},"status":{"type":"string"},"outcome":{"type":"string"},"errorCode":{"type":"string","description":"A closed, sanitized code — never a raw error message."},"depth":{"type":"number"},"createdAt":{"type":"string"},"startedAt":{"type":"string"},"finishedAt":{"type":"string"},"durationMs":{"type":"number"},"usage":{"type":"object","properties":{"tokensIn":{"type":"number"},"tokensOut":{"type":"number"},"toolCalls":{"type":"number"}},"required":["tokensIn","tokensOut","toolCalls"]},"toolTrail":{"type":"array","items":{"$ref":"#/components/schemas/AgentDelegationToolStep"}}},"required":["id","childAgentId","childAgentName","childVersion","status","depth","createdAt","usage","toolTrail"]},"AgentPlaygroundHistoryRow":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string","nullable":true},"preview":{"type":"string","nullable":true,"description":"Latest visible user/assistant text, truncated."},"status":{"type":"string"},"canResume":{"type":"boolean"},"pinned":{"type":"boolean","description":"FAI-1413: pinned by the caller to the top of their rail. Pinning never changes updatedAt."},"version":{"type":"integer","nullable":true,"description":"Null for a draft session; the pinned published version otherwise. Playground is an authoring surface — no deployed DTO carries this."},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","title","preview","status","canResume","pinned","version","createdAt","updatedAt"]},"CreateAgentEvalSetInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"isDefault":{"type":"boolean"}},"required":["name"]},"UpdateAgentEvalSetInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"isDefault":{"type":"boolean"}}},"AgentEvalCaseInput":{"type":"object","properties":{"name":{"type":"string","minLength":1},"input":{"type":"object","additionalProperties":{"nullable":true}},"assertions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["name","input","assertions"]},"RunAgentEvalInput":{"type":"object","properties":{"target":{"type":"string","enum":["draft","published"]}}},"AgentAnalytics":{"type":"object","properties":{"range":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"bucket":{"type":"string","enum":["day","week","month"]}},"required":["from","to","bucket"]},"filter":{"type":"object","properties":{"role":{"type":"string","nullable":true},"region":{"type":"string","nullable":true}},"required":["role","region"]},"sessions":{"type":"object","properties":{"total":{"type":"integer","description":"EVERY session row, including ones nobody spoke in — a row is created when a chat panel mounts, so this counts page views as well as conversations. Kept for completeness; `engaged` is the figure to show."},"engaged":{"type":"integer","description":"Sessions carrying at least one user message — the \"sessions\" figure a UI should display."},"byBucket":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"count":{"type":"integer"}},"required":["bucket","count"]},"description":"ENGAGED sessions per bucket, by when the session started. Matches `engaged`, not `total`."}},"required":["total","engaged","byBucket"]},"turns":{"type":"object","properties":{"total":{"type":"integer","description":"User messages — the \"queries\" figure."},"byBucket":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"count":{"type":"integer"}},"required":["bucket","count"]}},"avgPerSession":{"type":"number"}},"required":["total","byBucket","avgPerSession"]},"users":{"type":"object","properties":{"available":{"type":"boolean","description":"False when no session carried an end-user identity; every count below is then null."},"total":{"type":"integer","nullable":true},"repeatRate":{"type":"number","nullable":true,"description":"Share of identified users active on 2+ DISTINCT DAYS in the range. NULL when there are no users, never 0. Range-scoped by design, so values from different ranges are not comparable."},"repeatUsers":{"type":"integer","description":"The rate's numerator, so a UI can show \"8 of 13\" rather than a bare percentage."},"byDay":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"daily":{"type":"integer","description":"Kept though the dashboard plots `weekly` — it makes a 1/7/30-day window toggle a pure UI change."},"weekly":{"type":"integer","description":"TRAILING-7-DAY rolling unique count. Rolling, not calendar-week, so it stays comparable to the MAU line."},"monthly":{"type":"integer","description":"TRAILING-30-DAY rolling unique count, not calendar-month. A property of the metric, so it does not change with the viewing range."}},"required":["bucket","daily","weekly","monthly"]},"description":"Daily active-user series (DAU/WAU/MAU). Empty when no session carried an identity."}},"required":["available","total","repeatRate","repeatUsers","byDay"],"description":"People metrics. Meaningful only where the Solution has sign-in wired."},"tools":{"type":"array","items":{"type":"object","properties":{"toolName":{"type":"string"},"calls":{"type":"integer"},"failures":{"type":"integer"},"avgLatencyMs":{"type":"integer"}},"required":["toolName","calls","failures","avgLatencyMs"]}},"knowledge":{"type":"array","items":{"type":"object","properties":{"resourceKind":{"type":"string"},"resourceId":{"type":"string"},"name":{"type":"string","nullable":true,"description":"Null for a resource deleted since it was used — the usage still happened."},"calls":{"type":"integer"}},"required":["resourceKind","resourceId","name","calls"]}},"citedDocuments":{"type":"array","items":{"type":"object","properties":{"documentId":{"type":"string"},"documentName":{"type":"string","nullable":true,"description":"As denormalized at answer time; null if the citation carried no name."},"citations":{"type":"integer"}},"required":["documentId","documentName","citations"]},"description":"Documents the agent CITED in an answer — distinct from `knowledge`, which counts the Doc Base searched."},"guardrails":{"type":"object","properties":{"turnsChecked":{"type":"integer"},"turnsFired":{"type":"integer","description":"Turns with at least one event — a turn tripping three layers counts once."},"rate":{"type":"number"},"byLayer":{"type":"array","items":{"type":"object","properties":{"layer":{"type":"string"},"action":{"type":"string"},"detail":{"type":"string","nullable":true,"description":"What fired WITHIN the layer: `blocked_topic` → the topic handle; `pii` → the whole sorted combination of kinds found (`credit_card + ssn`), never one kind, because one event covers every kind in the message; `blocked_pattern` → the regex source that matched. NULL when the layer records no sub-identity (rate, length, moderation) or the row predates one — those collapse into a single per-action row."},"count":{"type":"integer"}},"required":["layer","action","detail","count"]}}},"required":["turnsChecked","turnsFired","rate","byLayer"]},"feedback":{"type":"object","properties":{"up":{"type":"integer"},"down":{"type":"integer"},"rated":{"type":"integer"},"coverage":{"type":"number"},"score":{"type":"number","nullable":true,"description":"up ÷ rated. NULL when nothing is rated — never 0, which would read as unanimously negative."}},"required":["up","down","rated","coverage","score"]},"dimensions":{"type":"object","properties":{"role":{"type":"object","properties":{"available":{"type":"boolean"},"values":{"type":"array","items":{"type":"string"}}},"required":["available","values"]},"region":{"type":"object","properties":{"available":{"type":"boolean"},"values":{"type":"array","items":{"type":"string"}}},"required":["available","values"]}},"required":["role","region"]}},"required":["range","filter","sessions","turns","users","tools","knowledge","citedDocuments","guardrails","feedback","dimensions"]},"FormSubmission":{"type":"object","properties":{"id":{"type":"string"},"solutionId":{"type":"string"},"producer":{"type":"string","enum":["agent","flow"]},"channel":{"type":"string","enum":["studio","gateway","api"]},"label":{"type":"string","nullable":true},"spec":{"type":"object","additionalProperties":{"nullable":true}},"values":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"fileId":{"type":"string"},"name":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"number"}},"required":["fileId","name","mediaType","sizeBytes"]},{"type":"array","items":{"type":"object","properties":{"fileId":{"type":"string"},"name":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"number"}},"required":["fileId","name","mediaType","sizeBytes"]}},{"nullable":true},{"nullable":true}]}},"submittedBy":{"type":"object","properties":{"kind":{"type":"string","enum":["end_user","actor","anonymous"]},"ref":{"type":"string"}},"required":["kind"]},"submittedAt":{"type":"string"}},"required":["id","solutionId","producer","channel","label","spec","values","submittedBy","submittedAt"]},"SolutionGrant":{"type":"object","properties":{"userId":{"type":"string"},"userName":{"type":"string","nullable":true},"userEmail":{"type":"string","nullable":true},"role":{"type":"string","enum":["viewer","editor","manager"]},"tenantRole":{"type":"string","nullable":true},"expiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"grantedBy":{"type":"string","nullable":true}},"required":["userId","userName","userEmail","role","tenantRole","expiresAt","createdAt","grantedBy"]},"SolutionGrantCandidate":{"type":"object","properties":{"userId":{"type":"string"},"userName":{"type":"string","nullable":true},"userEmail":{"type":"string","nullable":true},"tenantRole":{"type":"string"},"maxGrant":{"type":"string","enum":["viewer","editor","manager"]}},"required":["userId","userName","userEmail","tenantRole","maxGrant"]},"SolutionAccessExplanation":{"type":"object","properties":{"userId":{"type":"string"},"visible":{"type":"boolean"},"branch":{"type":"string","enum":["gateway","job","impersonation","tenant_open","admin","grant","none"]},"reason":{"type":"string"},"grant":{"type":"string","nullable":true,"enum":["viewer","editor","manager"]},"grantExpiresAt":{"type":"string","nullable":true},"grantExpired":{"type":"boolean"},"tenantRole":{"type":"string","nullable":true},"ceiling":{"type":"string","nullable":true,"enum":["viewer","editor","manager"]},"effective":{"type":"string","nullable":true,"enum":["viewer","editor","manager"]}},"required":["userId","visible","branch","reason","grant","grantExpiresAt","grantExpired","tenantRole","ceiling","effective"]},"ConfigurationOwner":{"type":"object","properties":{"solutionId":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true}},"required":["solutionId","templateId"]},"ConfigurationValue":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"nullable":true},{"type":"array","items":{"nullable":true}},{"type":"object","additionalProperties":{"nullable":true}},{"nullable":true}],"description":"Any JSON value, including null. Its type must match the variable’s declared type; `json` is the only type that accepts null."},"ConfigurationPresenceView":{"oneOf":[{"type":"object","properties":{"present":{"type":"boolean","enum":[false]}},"required":["present"]},{"type":"object","properties":{"present":{"type":"boolean","enum":[true]},"value":{"$ref":"#/components/schemas/ConfigurationValue"},"withheld":{"type":"boolean","enum":[true]},"backend":{"type":"string","enum":["platform","azure-key-vault","aws-kms","aws-secrets-manager"]},"sealedAt":{"type":"string"}},"required":["present"]}],"description":"A stored value as a READ returns it. `{present:false}` is absent. `{present:true, value}` is a non-secret value. `{present:true, withheld:true, backend, sealedAt}` is a secret: it is set, and its value is not returned by any call."},"ConfigurationVariable":{"type":"object","properties":{"id":{"type":"string"},"owner":{"$ref":"#/components/schemas/ConfigurationOwner"},"key":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","json","secret"]},"displayName":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"required":{"type":"boolean"},"defaultValue":{"$ref":"#/components/schemas/ConfigurationPresenceView"},"overrideValue":{"$ref":"#/components/schemas/ConfigurationPresenceView"},"source":{"type":"string","enum":["override","default","unset"]},"effectiveValue":{"$ref":"#/components/schemas/ConfigurationPresenceView"},"ready":{"type":"boolean"},"revision":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","owner","key","type","displayName","description","required","defaultValue","overrideValue","source","effectiveValue","ready","revision","createdAt","updatedAt"]},"ConfigurationReadiness":{"type":"object","properties":{"ready":{"type":"boolean"},"missingKeys":{"type":"array","items":{"type":"string"}}},"required":["ready","missingKeys"]},"ConfigurationCapabilities":{"type":"object","properties":{"authoring":{"type":"boolean","description":"May this deployment define variables and set values?"},"secrets":{"type":"boolean","description":"May this deployment set secret values? Requires `authoring`."}},"required":["authoring"]},"ConfigurationPresence":{"oneOf":[{"type":"object","properties":{"present":{"type":"boolean","enum":[false]}},"required":["present"]},{"type":"object","properties":{"present":{"type":"boolean","enum":[true]},"value":{"$ref":"#/components/schemas/ConfigurationValue"}},"required":["present","value"]}]},"ConfigurationUsage":{"type":"object","properties":{"resourceType":{"type":"string","enum":["flow","agent"]},"resourceId":{"type":"string"},"resourceName":{"type":"string"},"origin":{"type":"string","enum":["draft","published"]},"version":{"type":"integer","nullable":true},"field":{"type":"string"}},"required":["resourceType","resourceId","resourceName","origin","version","field"]},"VisibleConfigurationVariable":{"allOf":[{"$ref":"#/components/schemas/ConfigurationVariable"},{"type":"object","properties":{"solutionId":{"type":"string"},"solutionTitle":{"type":"string"}},"required":["solutionId","solutionTitle"]}]},"ConfigurationVariableStats":{"type":"object","properties":{"variables":{"type":"integer"},"secrets":{"type":"integer"},"requiredMissing":{"type":"integer","description":"Required variables with no effective value, across every visible Solution."},"solutions":{"type":"integer"}},"required":["variables","secrets","requiredMissing","solutions"]},"VariableProposalEntry":{"type":"object","properties":{"key":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","json","secret"]},"label":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"required":{"type":"boolean"},"reason":{"type":"string","nullable":true},"action":{"type":"string","enum":["create","set_value"]},"value":{"allOf":[{"$ref":"#/components/schemas/ConfigurationValue"},{"description":"The proposed value. Present only on a NON-secret entry the builder filled in; a secret entry never has one."}]}},"required":["key","type","label","description","required","reason","action"]},"VariableProposalEntryOutcome":{"type":"object","properties":{"key":{"type":"string"},"type":{"type":"string","enum":["text","number","boolean","json","secret"]},"result":{"type":"string","enum":["created","value_set","skipped","failed"]},"reason":{"type":"string"}},"required":["key","type","result"]},"VariableProposal":{"type":"object","properties":{"id":{"type":"string"},"owner":{"type":"object","properties":{"solutionId":{"type":"string","nullable":true},"templateId":{"type":"string","nullable":true}},"required":["solutionId","templateId"]},"status":{"type":"string","enum":["pending","completing","completed","dismissed","superseded"]},"entries":{"type":"array","items":{"$ref":"#/components/schemas/VariableProposalEntry"}},"outcome":{"type":"object","nullable":true,"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/VariableProposalEntryOutcome"}},"reason":{"type":"string"}}},"createdAt":{"type":"string"},"completedAt":{"type":"string","nullable":true}},"required":["id","owner","status","entries","outcome","createdAt","completedAt"]},"CompleteVariableProposalInput":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"include":{"type":"boolean"},"label":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"required":{"type":"boolean"},"value":{"$ref":"#/components/schemas/ConfigurationValue"},"secretValue":{"type":"string","description":"A secret entry’s plaintext. Sealed by the tenant’s secret store and never returned, logged or stored anywhere else."}},"required":["key","include"],"additionalProperties":false},"minItems":1}},"required":["entries"],"additionalProperties":false},"TenantContext":{"type":"object","properties":{"tenantId":{"type":"string","description":"The resolved tenant's uuid."},"slug":{"type":"string","description":"The resolved tenant's slug.","example":"acme"},"role":{"type":"string","nullable":true,"description":"The caller's effective membership role in this tenant, or null when no principal is resolvable (auth off)."},"isPlatformAdmin":{"type":"boolean","description":"True when the caller reached this tenant as a Flexday AI platform admin."}},"required":["tenantId","slug","role","isPlatformAdmin"]},"DeploymentFeatures":{"type":"object","properties":{"templates":{"type":"boolean","description":"True when this deployment serves Templates (the Templates switch). False ⇒ every Templates route 404s and the Studio offers no Templates entry point."}},"required":["templates"]},"ExecutionProjection":{"type":"object","properties":{"executionId":{"type":"string"},"runId":{"type":"string","nullable":true,"description":"The Flow run this execution started - the run's own {{run.id}}. Null only when no run row exists for it (yet)."},"interactionContractVersion":{"type":"number","enum":[1]},"status":{"type":"string","enum":["queued","running","awaiting_input","succeeded","failed","timed_out","cancelled"]},"cards":{"type":"array","items":{"$ref":"#/components/schemas/FlowInteractionProjection"},"description":"Durable interactions for this execution, oldest first. Empty unless the run presented a card. Their action URLs name the gateway that started the execution, at its own address."},"result":{"nullable":true,"description":"DEPRECATED since 2026-10-05, removed on 2026-12-01: read `data` (the Respond body) and `httpStatus` (its status code) instead. The stored Respond envelope `{body, statusHint}` (null when no Respond step answered), present once a Respond step has answered or the run is over. A reply carrying it sends `Deprecation` and `Sunset` headers.","deprecated":true},"error":{"type":"object","nullable":true,"properties":{"code":{"type":"string","enum":["FLOW_FAILED","FLOW_CANCELLED","FLOW_TIMED_OUT"],"description":"`FLOW_FAILED` - a step failed, or the run failed outside any one step. `FLOW_TIMED_OUT` - a step ran past its own time limit, or nobody answered a Form before its deadline (the execution's `status` is still `failed`). `FLOW_CANCELLED` - the run was cancelled."},"step":{"type":"string","nullable":true,"description":"The name of the step that failed, as the Flow names it. Null when the run ended outside any one step (a cancel, a refusal before the first step)."},"message":{"type":"string","description":"Why, in a sentence safe to show the caller: a reason the platform wrote for a person (for example \"The service answered with HTTP 503.\"), the text of a Terminate step, or a generic sentence (\"The step failed.\") when the reason could name something internal. Never a URL, a file path, a table or a host."}},"required":["code","step","message"],"description":"Why the run did not succeed - present beside `data`. Null unless the run failed or was cancelled (a run that succeeded, or one whose Respond step answered while it keeps working), and for an execution an older release finished. A failed or timed-out run's `status` is `failed`, a cancelled run's `cancelled`; `code` tells them apart."},"data":{"nullable":true,"description":"The Flow's Respond body - the same `data` a sync call returns. Null when no Respond step answered."},"httpStatus":{"type":"integer","description":"The status code a sync call to the same Flow answers: the Respond step's own status (default 200). With no Respond step, 502 for a run that failed (the sync FLOW_FAILED) and 200 otherwise."},"responded":{"type":"boolean","description":"True once a Respond step has answered. A Flow can answer and keep working: `status` then stays `running` (no new status value - older clients switch on it) while `responded: true` says `data` is already the answer."}},"required":["executionId","runId","interactionContractVersion","status","cards"]},"GatewayErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"ExecutionCancelProjection":{"type":"object","properties":{"executionId":{"type":"string"},"interactionContractVersion":{"type":"number","enum":[1]},"status":{"type":"string","enum":["cancelling","succeeded","failed","timed_out","cancelled"]}},"required":["executionId","interactionContractVersion","status"]},"FlowFormSubmissionResult":{"type":"object","properties":{"status":{"type":"string","enum":["accepted","awaiting_input","closed"]},"card":{"nullable":true,"description":"The form card as it now stands: closed on accept, re-asked with per-field errors otherwise."},"version":{"type":"integer","description":"The new version after a re-ask. Send it as `expectedVersion` on the next attempt."},"reason":{"type":"string","description":"Why the form closed without an answer."}},"required":["status"]},"FlowFormSubmissionBody":{"type":"object","properties":{"values":{"nullable":true,"description":"The submitted values, keyed by field id. Hidden fields are dropped; unknown keys are rejected."},"expectedVersion":{"type":"integer","minimum":0,"description":"The card's current version (its re-ask count). REQUIRED: a submission built against a superseded question must not land on the current one."},"uploadBindings":{"nullable":true,"description":"Per file field, which upload endpoint each file id came through. The server re-derives the upload scope from that exact endpoint — a File Store id alone is never sufficient."}},"required":["expectedVersion"]},"FlowCardPreviewResult":{"type":"object","properties":{"preview":{"nullable":true,"description":"Inert preview data: text, table rows or metadata. Never markup, never a URL and never inline bytes."},"canDownload":{"type":"boolean","description":"Re-resolved LIVE for this caller against the File Store's current policy. A presentation control, not DRM."},"file":{"type":"object","properties":{"name":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"integer"}},"required":["name","mediaType","sizeBytes"],"description":"Display metadata for the document. Not authority."}},"required":["canDownload","file"]}},"parameters":{}},"paths":{"/api/v1/tenants":{"post":{"tags":["Tenants"],"summary":"Provision a new tenant (the caller becomes its owner)","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantInput"}}}},"responses":{"201":{"description":"The provisioned (active) tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["success","tenant"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_TENANT_SLUG","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"get":{"tags":["Tenants"],"summary":"The caller's tenant memberships","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Tenants the caller belongs to.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenants":{"type":"array","items":{"$ref":"#/components/schemas/TenantMembership"}}},"required":["success","tenants"]}}}}}}},"/api/v1/tenants/{id}":{"get":{"tags":["Tenants"],"summary":"Get one tenant the caller is a member of","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/TenantMembership"}},"required":["success","tenant"]}}}},"403":{"description":"NOT_A_TENANT_MEMBER","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Tenants"],"summary":"Rename a tenant (slug immutable)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTenantInput"}}}},"responses":{"200":{"description":"The updated tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["success","tenant"]}}}},"403":{"description":"NOT_A_TENANT_MEMBER","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/suspend":{"post":{"tags":["Tenants"],"summary":"Suspend a tenant (owner only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The suspended tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["success","tenant"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/resume":{"post":{"tags":["Tenants"],"summary":"Resume a suspended tenant (owner only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The resumed (active) tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["success","tenant"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/ai-settings":{"get":{"tags":["Tenants"],"summary":"The tenant AI model settings (use-case → catalog id); members:manage","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The settings.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"settings":{"$ref":"#/components/schemas/AiSettingsMap"}},"required":["success","settings"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Tenants"],"summary":"Replace the tenant AI model settings (validated against the catalog); members:manage","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSettingsInput"}}}},"responses":{"200":{"description":"The saved settings.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"settings":{"$ref":"#/components/schemas/AiSettingsMap"}},"required":["success","settings"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/ai-settings/effective":{"get":{"tags":["Tenants"],"summary":"The tenant overrides + the RESOLVED effective use-case → model map; any member (resource:read)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The overrides + effective resolution.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"settings":{"$ref":"#/components/schemas/AiSettingsMap"},"effective":{"type":"array","items":{"$ref":"#/components/schemas/EffectiveModelEntry"}}},"required":["success","settings","effective"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/members":{"get":{"tags":["Tenants"],"summary":"List a tenant's members","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The members.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"members":{"type":"array","items":{"$ref":"#/components/schemas/TenantMember"}}},"required":["success","members"]}}}},"403":{"description":"NOT_A_TENANT_MEMBER","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/members/{userId}":{"patch":{"tags":["Tenants"],"summary":"Change a member's role (admin+; owner grants/revokes owner)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The member's user (actor) id."},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberRoleInput"}}}},"responses":{"200":{"description":"The updated member.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"member":{"$ref":"#/components/schemas/TenantMember"}},"required":["success","member"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"LAST_OWNER_REMOVAL","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"delete":{"tags":["Tenants"],"summary":"Remove a member (soft; admin+, owner to remove an owner)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The member's user (actor) id."},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"LAST_OWNER_REMOVAL","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/tenants/{id}/invitations":{"get":{"tags":["Tenants"],"summary":"List a tenant's invitations (admin+)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The invitations.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"invitations":{"type":"array","items":{"$ref":"#/components/schemas/TenantInvitation"}}},"required":["success","invitations"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Tenants"],"summary":"Invite a user by email (admin+)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInvitationInput"}}}},"responses":{"201":{"description":"The created invitation (with the one-time token/link).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"invitation":{"$ref":"#/components/schemas/CreatedTenantInvitation"}},"required":["success","invitation"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/invitations/{invitationId}/revoke":{"post":{"tags":["Tenants"],"summary":"Revoke a pending invitation (admin+)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The invitation id (ULID)."},"required":true,"name":"invitationId","in":"path"}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"INVITATION_INVALID","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"409":{"description":"INVITATION_ALREADY_ACCEPTED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/tenants/{id}/identity-config":{"put":{"tags":["Tenants"],"summary":"Set the per-tenant token-validation config (owner only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTenantIdentityConfigInput"}}}},"responses":{"200":{"description":"The updated identity config.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identityConfig":{"$ref":"#/components/schemas/TenantIdentityConfig"}},"required":["success","identityConfig"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/offboard":{"post":{"tags":["Tenants"],"summary":"Begin offboarding a tenant (owner only; double-confirm) - schedules purge after retention","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffboardTenantInput"}}}},"responses":{"200":{"description":"Offboarding started; a final export is produced and a purge scheduled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"},"exportId":{"type":"string"},"purgeAfter":{"type":"string","nullable":true},"jobsCancelled":{"type":"number"}},"required":["success","tenant","exportId","purgeAfter","jobsCancelled"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"TENANT_NOT_ACTIVE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/tenants/{id}/restore":{"post":{"tags":["Tenants"],"summary":"Restore an offboarding tenant to active (owner only; during retention)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The restored tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["success","tenant"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"TENANT_NOT_OFFBOARDING","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/tenants/{id}/export":{"post":{"tags":["Tenants"],"summary":"Start a tenant data export (owner only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"202":{"description":"Export job started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"},"exportId":{"type":"string"}},"required":["success","jobId","exportId"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/exports/{exportId}/link":{"get":{"tags":["Tenants"],"summary":"Mint a short-lived signed download link for an export (admin+)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The export id (ULID)."},"required":true,"name":"exportId","in":"path"}],"responses":{"200":{"description":"A signed, short-lived download path.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"token":{"type":"string"},"path":{"type":"string"}},"required":["success","token","path"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/exports/{exportId}/download":{"get":{"tags":["Tenants"],"summary":"Download an export bundle (signed token OR admin+ membership)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The export id (ULID)."},"required":true,"name":"exportId","in":"path"},{"schema":{"type":"string","description":"Short-lived signed download token (alternative to admin membership)."},"required":false,"name":"token","in":"query"}],"responses":{"200":{"description":"The export bundle (manifest + files).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"manifest":{"type":"object","additionalProperties":{"nullable":true}},"files":{"type":"object","additionalProperties":{"type":"string"}}},"required":["success","manifest","files"]}}}},"403":{"description":"EXPORT_DOWNLOAD_FORBIDDEN","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/support-access":{"put":{"tags":["Tenants"],"summary":"Set the support-access (staff impersonation) consent switch (owner only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportAccessInput"}}}},"responses":{"200":{"description":"The updated tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["success","tenant"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/support-sessions":{"get":{"tags":["Tenants"],"summary":"Active + recent Flexday AI support (impersonation) sessions against this tenant (admin+)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The sessions, active first.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/SupportSession"}}},"required":["success","sessions"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/auto-join-domains":{"put":{"tags":["Tenants"],"summary":"Set the verified-email auto-join domain allow-list (owner only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The tenant's UUID.","example":"aefc68cc-82d0-4b20-80f9-dcc1dfeca22a"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoJoinDomainsInput"}}}},"responses":{"200":{"description":"The updated tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"$ref":"#/components/schemas/Tenant"}},"required":["success","tenant"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{slug}/auth":{"get":{"tags":["Auth"],"summary":"A tenant's PUBLIC login binding descriptor (unauthenticated; no secrets)","responses":{"200":{"description":"The non-secret binding descriptor for the tenant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"binding":{"$ref":"#/components/schemas/TenantBindingDescriptor"}},"required":["success","binding"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/auth/default":{"get":{"tags":["Auth"],"summary":"The deployment-default PUBLIC login binding descriptor (unauthenticated; no secrets)","responses":{"200":{"description":"The non-secret deployment-default binding descriptor.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"binding":{"$ref":"#/components/schemas/BindingDescriptor"}},"required":["success","binding"]}}}}}}},"/api/v1/auth/platform":{"get":{"tags":["Auth"],"summary":"The Flexday AI STAFF PUBLIC login binding descriptor (unauthenticated; no secrets)","responses":{"200":{"description":"The non-secret platform (staff) binding descriptor.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"binding":{"$ref":"#/components/schemas/BindingDescriptor"}},"required":["success","binding"]}}}}}}},"/api/v1/auth/discover":{"post":{"tags":["Auth"],"summary":"Email-first Home Realm Discovery - resolve which IdP to sign in against (unauthenticated; domain-based; no secrets)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscoverLoginInput"}}}},"responses":{"200":{"description":"The resolved login routing.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"result":{"$ref":"#/components/schemas/DiscoverLoginResult"}},"required":["success","result"]}}}}}}},"/api/v1/admin/me":{"get":{"tags":["Admin"],"summary":"The caller's platform role + resolved capabilities (for UI gating)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The caller platform identity, plus the deployment address templates the console renders.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"role":{"type":"string","enum":["super","support","read_only"]},"capabilities":{"type":"array","items":{"type":"string"}},"hosts":{"$ref":"#/components/schemas/PublicAddressTemplates"}},"required":["success","role","capabilities","hosts"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/admins":{"get":{"tags":["Admin"],"summary":"List platform administrators","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The platform admins.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"admins":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","admins"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"post":{"tags":["Admin"],"summary":"Grant platform-admin to an actor at an explicit role","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantPlatformAdminInput"}}}},"responses":{"201":{"description":"Granted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"admin":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","admin"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/admins/{actorId}":{"patch":{"tags":["Admin"],"summary":"Change a platform admin's role (super only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The platform-admin actor id (ULID)."},"required":true,"name":"actorId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPlatformAdminRoleInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"admin":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","admin"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"LAST_PLATFORM_SUPER","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"delete":{"tags":["Admin"],"summary":"Revoke platform-admin from an actor","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The platform-admin actor id (ULID)."},"required":true,"name":"actorId","in":"path"}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"409":{"description":"LAST_PLATFORM_ADMIN / LAST_PLATFORM_SUPER","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants":{"post":{"tags":["Admin"],"summary":"Create a tenant → provision its identity → assign the owner","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/CreateTenantInput"},{"properties":{"name":{"type":"string","minLength":1,"description":"The tenant display name."},"slug":{"type":"string","minLength":1,"description":"Optional explicit slug (else derived from the name)."},"identity":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["pooled"]}},"required":["kind"],"description":"The shared Flexday pool (standard, non-enterprise): no dedicated IdP, tenancy resolved by membership."},{"type":"object","properties":{"kind":{"type":"string","enum":["cognito"]},"region":{"type":"string","description":"Data-residency region for the dedicated pool."}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","enum":["oidc"]},"issuer":{"type":"string","format":"uri","description":"The customer IdP's OIDC issuer."},"jwksUri":{"type":"string","format":"uri"},"audience":{"type":"string","minLength":1,"description":"The audience (client id) the IdP mints for."},"claimMap":{"type":"object","properties":{"subject":{"type":"array","items":{"type":"string"},"minItems":1},"email":{"type":"array","items":{"type":"string"}},"displayName":{"type":"array","items":{"type":"string"}}},"required":["subject"]}},"required":["kind","issuer","audience"]},{"type":"object","properties":{"kind":{"type":"string","enum":["saml"]},"issuer":{"type":"string","minLength":1,"description":"Issuer of the provider SAML federates through."},"audience":{"type":"string"},"federationVia":{"type":"string","minLength":1,"description":"The OIDC-issuing provider SAML federates through (cognito|entra-external)."},"metadataUrl":{"type":"string","format":"uri"},"claimMap":{"type":"object","properties":{"subject":{"type":"array","items":{"type":"string"},"minItems":1},"email":{"type":"array","items":{"type":"string"}},"displayName":{"type":"array","items":{"type":"string"}}},"required":["subject"]}},"required":["kind","issuer","federationVia"]}],"description":"The tenant's identity: the shared Flexday AI pool (pooled), a dedicated Flexday AI-provisioned Cognito pool (cognito), or BYO-SSO (oidc/saml)."},"owner":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"The customer owner email (assigned on-behalf)."},"displayName":{"type":"string"}},"required":["email"],"description":"The initial owner - owners cannot be invited, only provisioned here."}},"required":["name","identity","owner"]}]}}}},"responses":{"201":{"description":"The provisioned tenant + its non-secret login descriptor + the seated owner.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"type":"object","additionalProperties":{"nullable":true}},"binding":{"type":"object","additionalProperties":{"nullable":true}},"owner":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","tenant","binding","owner"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"409":{"description":"DUPLICATE_TENANT_SLUG / BINDING_ISSUER_TAKEN / OWNER_ALREADY_ASSIGNED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"503":{"description":"TENANT_IDP_PROVISION_FAILED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"get":{"tags":["Admin"],"summary":"List / search tenants (all statuses)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Case-insensitive slug/name filter."},"required":false,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Tenants.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenants":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","tenants"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}":{"get":{"tags":["Admin"],"summary":"Tenant detail - status, quota, usage, job health, public addresses","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The tenant detail.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","tenant"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/quotas":{"patch":{"tags":["Admin"],"summary":"Adjust a tenant's quota ceilings","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdjustTenantQuotaInput"}}}},"responses":{"200":{"description":"The updated quota.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"quota":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","quota"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/suspend":{"post":{"tags":["Admin"],"summary":"Suspend a tenant (platform authority)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Suspended.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","tenant"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/resume":{"post":{"tags":["Admin"],"summary":"Resume a suspended tenant (platform authority)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Resumed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","tenant"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/export":{"post":{"tags":["Admin"],"summary":"Trigger a tenant export","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"202":{"description":"Export job started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"},"exportId":{"type":"string"}},"required":["success","jobId","exportId"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/usage":{"get":{"tags":["Admin"],"summary":"A tenant's metering series (cost attribution)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Usage series.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"type":"object","additionalProperties":{"nullable":true}},"usage":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","tenant","usage"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/plans":{"get":{"tags":["Admin"],"summary":"List the plan catalog (flags + default quotas)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The plans.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"plans":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","plans"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/plan":{"patch":{"tags":["Admin"],"summary":"Change a tenant's plan (re-applies its quota defaults)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetTenantPlanInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"planId":{"type":"string"}},"required":["success","planId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/impersonate":{"post":{"tags":["Admin"],"summary":"Start an impersonation session: returns a SINGLE-USE handoff code + studio URL (never the token; read-only by default, role ≤ admin, TTL ≤ 1h, reason required)","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonateInput"}}}},"responses":{"201":{"description":"The handoff (code + studio URL). The JWT is minted only at redemption.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"handoff":{"$ref":"#/components/schemas/ImpersonationHandoff"}},"required":["success","handoff"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/offboard":{"post":{"tags":["Admin"],"summary":"Offboard a tenant (soft-delete + retention window) - platform authority","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminConfirmSlugInput"}}}},"responses":{"200":{"description":"Offboarding started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"type":"object","additionalProperties":{"nullable":true}},"exportId":{"type":"string"},"purgeAfter":{"type":"string","nullable":true},"jobsCancelled":{"type":"number"}},"required":["success","tenant","exportId","purgeAfter","jobsCancelled"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"TENANT_NOT_ACTIVE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/restore":{"post":{"tags":["Admin"],"summary":"Restore an offboarding tenant during its retention window","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Restored.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenant":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","tenant"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"TENANT_NOT_OFFBOARDING","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/purge":{"post":{"tags":["Admin"],"summary":"Force-purge an offboarding tenant (destructive, super only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminConfirmSlugInput"}}}},"responses":{"202":{"description":"Purge job started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"}},"required":["success","jobId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"TENANT_NOT_OFFBOARDING","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/purge-status":{"get":{"tags":["Admin"],"summary":"A tenant's purge job status + scheduled retention window","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The purge status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"purge":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","purge"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/audit":{"get":{"tags":["Admin"],"summary":"Cross-tenant audit-log search (platform plane)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Filter to one tenant (uuid)."},"required":false,"name":"tenantId","in":"query"},{"schema":{"type":"string","description":"Filter to one actor (ULID)."},"required":false,"name":"actorId","in":"query"},{"schema":{"type":"string","description":"Filter to one action (e.g. impersonation_started)."},"required":false,"name":"action","in":"query"},{"schema":{"type":"string","description":"Filter to one audited table."},"required":false,"name":"tableName","in":"query"},{"schema":{"type":"string","description":"ISO lower bound (inclusive)."},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","description":"ISO upper bound (inclusive)."},"required":false,"name":"to","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Audit entries + next cursor.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"entries":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"nextCursor":{"type":"string","nullable":true}},"required":["success","entries","nextCursor"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/jobs":{"get":{"tags":["Admin"],"summary":"Cross-tenant jobs monitor (filter + status rollup, paginated)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Filter by job status (queued|running|done|error|aborted|awaiting_input)."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","description":"Filter by job type (build|flow-run|profile|…)."},"required":false,"name":"type","in":"query"},{"schema":{"type":"string","description":"Filter to one tenant (uuid)."},"required":false,"name":"tenantId","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Jobs + per-status counts + next cursor.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobs":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"byStatus":{"type":"object","additionalProperties":{"type":"number"}},"nextCursor":{"type":"string","nullable":true}},"required":["success","jobs","byStatus","nextCursor"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/jobs/{id}":{"get":{"tags":["Admin"],"summary":"One job across tenants (detail)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The job id (ULID)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The job.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"job":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","job"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/jobs/{id}/stream":{"get":{"tags":["Admin"],"summary":"Live SSE tail of a job (replay-from-cursor then follow)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The job id (ULID)."},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Replay cursor (event id)."},"required":false,"name":"since","in":"query"}],"responses":{"200":{"description":"text/event-stream of job events."},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/jobs/{id}/cancel":{"post":{"tags":["Admin"],"summary":"Cancel a live job (cooperative abort + terminal event)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The job id (ULID)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"job":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","job"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"JOB_NOT_ACTIVE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/jobs/{id}/retry":{"post":{"tags":["Admin"],"summary":"Retry a finished job (re-enqueue its queued counterpart)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The job id (ULID)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Re-queued.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"job":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","job"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"JOB_NOT_ACTIVE / JOB_NOT_RETRYABLE / JOB_ALREADY_LIVE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/members":{"get":{"tags":["Admin"],"summary":"A tenant's active members + roles (platform read)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Members.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"members":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","members"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/owner":{"post":{"tags":["Admin"],"summary":"Reset / transfer a tenant's owner on-behalf","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSetOwnerInput"}}}},"responses":{"200":{"description":"The seated owner.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"owner":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","owner"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/tenants/{id}/owner/reinvite":{"post":{"tags":["Admin"],"summary":"Re-send the current owner's provider invite / credentials","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Re-invite outcome.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"email":{"type":"string"},"resent":{"type":"boolean"},"reason":{"type":"string"}},"required":["success","email","resent"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"NO_OWNER / OWNER_EMAIL_UNKNOWN","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/search":{"get":{"tags":["Admin"],"summary":"Global search - tenants + users (typed hits)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The search term (tenant slug/name · user email/name)."},"required":true,"name":"q","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Typed hits.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenants":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"users":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","tenants","users"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/impersonations":{"get":{"tags":["Admin"],"summary":"Active impersonation sessions (not revoked / expired)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Active sessions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"sessions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","sessions"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/impersonations/{id}":{"delete":{"tags":["Admin"],"summary":"Revoke an impersonation session (immediate - blocks the token)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The impersonation session id (ULID)."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Revoked (revoked=false if it was already inactive).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"revoked":{"type":"boolean"}},"required":["success","revoked"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/impersonation/redeem":{"post":{"tags":["Impersonation"],"summary":"Redeem a single-use impersonation handoff code for the platform-issued JWT (public, per-IP rate-limited, single winner)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemImpersonationInput"}}}},"responses":{"200":{"description":"The grant. The code is burned - a second redemption fails.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"grant":{"$ref":"#/components/schemas/ImpersonationGrant"}},"required":["success","grant"]}}}},"401":{"description":"IMPERSONATION_CODE_INVALID - unknown, expired, already-redeemed, or revoked (deliberately indistinguishable).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/impersonation/end":{"post":{"tags":["Impersonation"],"summary":"End the current impersonation session (authenticated by the impersonation JWT itself; revokes its own jti, idempotent)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Ended - the token is refused on the next request.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"ended":{"type":"boolean"}},"required":["success","ended"]}}}},"401":{"description":"IMPERSONATION_TOKEN_REQUIRED - the bearer is not an impersonation grant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/billing":{"get":{"tags":["Admin"],"summary":"Billing provider status + plan price catalog (billing-ready seam)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The billing driver status + plan prices.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"provider":{"type":"object","properties":{"driver":{"type":"string"},"configured":{"type":"boolean"}},"required":["driver","configured"]},"plans":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","provider","plans"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/binding":{"put":{"tags":["Admin"],"summary":"Create or replace a tenant's auth binding (platform:tenants:lifecycle)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUpsertBindingInput"}}}},"responses":{"200":{"description":"The tenant binding descriptor after the change.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"binding":{"allOf":[{"$ref":"#/components/schemas/TenantBindingDescriptor"},{"allOf":[{"$ref":"#/components/schemas/BindingDescriptor"},{"type":"object","nullable":true,"properties":{"status":{"type":"string","enum":["active","unavailable"]}},"required":["status"]}]}]}},"required":["success","binding"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"BINDING_ISSUER_TAKEN","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/binding/promote-silo":{"post":{"tags":["Admin"],"summary":"Promote a tenant pooled → silo (a dedicated pool) (platform:tenants:lifecycle)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPromoteSiloInput"}}}},"responses":{"200":{"description":"The tenant binding descriptor after the change.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"binding":{"allOf":[{"$ref":"#/components/schemas/TenantBindingDescriptor"},{"allOf":[{"$ref":"#/components/schemas/BindingDescriptor"},{"type":"object","nullable":true,"properties":{"status":{"type":"string","enum":["active","unavailable"]}},"required":["status"]}]}]}},"required":["success","binding"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"BINDING_ISSUER_TAKEN","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/binding/demote-pooled":{"post":{"tags":["Admin"],"summary":"Demote a tenant silo → pooled (drop its own binding) (platform:tenants:lifecycle)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminDemotePooledInput"}}}},"responses":{"200":{"description":"The tenant binding descriptor after the change.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"binding":{"allOf":[{"$ref":"#/components/schemas/TenantBindingDescriptor"},{"allOf":[{"$ref":"#/components/schemas/BindingDescriptor"},{"type":"object","nullable":true,"properties":{"status":{"type":"string","enum":["active","unavailable"]}},"required":["status"]}]}]}},"required":["success","binding"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/ai/models":{"get":{"tags":["AI"],"summary":"The declared model catalog (chat + embedding) — the ONE source UIs populate selects from","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"models":{"type":"array","items":{"$ref":"#/components/schemas/ModelCatalogEntry"}}},"required":["success","models"]}}}}}}},"/api/v1/admin/ai/models":{"get":{"tags":["Admin"],"summary":"The platform model catalog (chat + embedding) — read-only staff view","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"models":{"type":"array","items":{"$ref":"#/components/schemas/ModelCatalogEntry"}}},"required":["success","models"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/admin/tenants/{id}/ai-settings":{"get":{"tags":["Admin"],"summary":"A tenant's AI overrides + resolved effective use-case → model map (platform:read)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The overrides + effective resolution.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"settings":{"$ref":"#/components/schemas/AiSettingsMap"},"effective":{"type":"array","items":{"$ref":"#/components/schemas/EffectiveModelEntry"}}},"required":["success","settings","effective"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Admin"],"summary":"Replace a tenant's AI overrides on-behalf (validated against the catalog); platform:plans:write","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The target tenant's UUID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSettingsInput"}}}},"responses":{"200":{"description":"The saved overrides + effective resolution.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"settings":{"$ref":"#/components/schemas/AiSettingsMap"},"effective":{"type":"array","items":{"$ref":"#/components/schemas/EffectiveModelEntry"}}},"required":["success","settings","effective"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/admin/release/flow-interactions":{"get":{"tags":["Admin"],"summary":"Deployed-component readiness for the Flow interaction stack (observational)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"studioAsset","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"generatedAppRuntime","in":"query"}],"responses":{"200":{"description":"Per-component contract/version state, the deployed node catalog, the entitlement projection and the release matrix. Always 200: a not-ready deployment is an answer, not a failed request.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"readiness":{"type":"object","properties":{"ready":{"type":"boolean"},"contractVersion":{"type":"integer"},"components":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"source":{"type":"string","enum":["observed","reported"]},"status":{"type":"string","enum":["ok","mismatch","unavailable","unknown"]},"blocking":{"type":"boolean"},"observed":{"type":"string","nullable":true},"expected":{"type":"string"},"detail":{"type":"string"}},"required":["id","label","source","status","blocking","observed","expected","detail"]}},"blocking":{"type":"array","items":{"type":"string"}},"nodeCatalog":{"type":"object","properties":{"nodeTypes":{"type":"array","items":{"type":"string"}},"interactionNodes":{"type":"boolean"},"interactionNodeTypes":{"type":"array","items":{"type":"string"}},"entitlementGated":{"type":"boolean"}},"required":["nodeTypes","interactionNodes","interactionNodeTypes","entitlementGated"]},"entitlements":{"type":"object","properties":{"retired":{"type":"array","items":{"type":"string"}},"rolloutGates":{"type":"array","items":{"type":"string"}}},"required":["retired","rolloutGates"]},"releaseMatrix":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"surface":{"type":"string"},"form":{"type":"boolean"},"viewPort":{"type":"boolean"},"evidence":{"type":"string"},"channel":{"type":"string","enum":["studio","gateway","headless"]}},"required":["id","surface","form","viewPort","evidence","channel"]}}},"required":["ready","contractVersion","components","blocking","nodeCatalog","entitlements","releaseMatrix"]}},"required":["success","readiness"]}}}},"403":{"description":"NOT_PLATFORM_ADMIN / INSUFFICIENT_PLATFORM_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/audit":{"get":{"tags":["Audit"],"summary":"The tenant's audit trail (admin+; impersonation markers included)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Filter to one actor id."},"required":false,"name":"actorId","in":"query"},{"schema":{"type":"string","description":"Filter to one action (create|update|delete|…)."},"required":false,"name":"action","in":"query"},{"schema":{"type":"string","description":"ISO lower bound on `at`."},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","description":"ISO upper bound on `at`."},"required":false,"name":"to","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"A page of audit entries.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"entries":{"type":"array","items":{"$ref":"#/components/schemas/AuditEntry"}},"nextCursor":{"type":"string","nullable":true}},"required":["success","entries","nextCursor"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/entitlements":{"get":{"tags":["Usage"],"summary":"The tenant's plan + resolved feature entitlements (any member)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The tenant plan + feature flags.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"planId":{"type":"string"},"planName":{"type":"string"},"features":{"type":"object","additionalProperties":{"type":"boolean"}}},"required":["success","planId","planName","features"]}}}}}}},"/api/v1/usage/metering":{"get":{"tags":["Usage"],"summary":"The tenant's metering series + quota (owner/admin)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The metering series + quota.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"usage":{"type":"array","items":{"$ref":"#/components/schemas/TenantMeterRow"}},"quota":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","usage","quota"]}}}},"403":{"description":"INSUFFICIENT_ROLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/search":{"get":{"tags":["Search"],"summary":"Search every resource, person and template the caller can see","description":"One box over the whole workspace. Results are narrowed by the same boundaries the corresponding list pages use — Solution-access RLS for resources, tenant membership for people — so search can never reveal something its owning page would hide.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The search text. Under 2 characters returns no hits."},"required":true,"name":"q","in":"query"},{"schema":{"type":"string","description":"Comma-separated kinds to restrict to. One of: solution, launchpad, fact_base, data_portrait, doc_base, document, file_store, file, flow, agent, bot, gateway, identity, connection, template, person."},"required":false,"name":"kinds","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":25,"description":"Max hits PER KIND (default 5)."},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Ranked hits, best match first, capped per kind.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"query":{"type":"string"},"hits":{"type":"array","items":{"$ref":"#/components/schemas/SearchHit"}},"truncatedKinds":{"type":"array","items":{"type":"string","enum":["solution","launchpad","fact_base","data_portrait","doc_base","document","file_store","file","flow","agent","bot","gateway","identity","connection","template","person"]},"description":"Kinds that filled the per-kind cap."}},"required":["success","query","hits","truncatedKinds"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/invitations/accept":{"post":{"tags":["Tenants"],"summary":"Accept a tenant invitation (authenticated; matches token hash + email)","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationInput"}}}},"responses":{"200":{"description":"Accepted - membership created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"accepted":{"$ref":"#/components/schemas/AcceptInvitationResult"}},"required":["success","accepted"]}}}},"404":{"description":"INVITATION_INVALID","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"409":{"description":"INVITATION_EMAIL_MISMATCH / INVITATION_INVALID","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"422":{"description":"INVITATION_EXPIRED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/identities":{"get":{"tags":["Identity"],"summary":"Global list of every named Identity across Solutions (no secrets) - searchable, filterable, paginated","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"The identities.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identities":{"type":"array","items":{"$ref":"#/components/schemas/IdentityListItem"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","identities","total","limit","offset","counts"]}}}}}}},"/api/v1/identities/{id}":{"get":{"tags":["Identity"],"summary":"Get one Identity (OBO secret masked → oboConfigured)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The identity.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identity":{"$ref":"#/components/schemas/Identity"}},"required":["success","identity"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"tags":["Identity"],"summary":"Update an Identity (OBO secret write-only; omit to leave unchanged)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateIdentityInput"}}}},"responses":{"200":{"description":"The updated identity.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identity":{"$ref":"#/components/schemas/Identity"}},"required":["success","identity"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Identity’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Identity"],"summary":"Delete an Identity (connected gateways are SET NULL)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Identity’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/identities/{id}/test-authorization":{"post":{"tags":["Identity"],"summary":"Test this Identity's authorization rules against a synthesized persona (never a real token)","description":"Answers \"would this caller be let through?\" for a real roster member or an operator-typed persona, without waiting on a real sign-in — and can optionally run one saved Fact Base query exactly as that persona would run it. Gated at members:manage (stricter than validate-token) because the optional run executes a real query.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestAuthorizationInput"}}}},"responses":{"200":{"description":"The rules report (and query result, if requested).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"result":{"$ref":"#/components/schemas/TestAuthorizationResult"}},"required":["success","result"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/identities/{id}/validate-token":{"post":{"tags":["Identity"],"summary":"Check a token against this Identity (debugging; the token is never logged or stored)","description":"Runs the SAME verification the Flex Gateway runs, so \"why is my endpoint 401ing?\" is answerable without deploying an app. Always 200: `{ valid: false, error }` is the ANSWER, not a failed request.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateIdentityTokenInput"}}}},"responses":{"200":{"description":"The verification result.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"result":{"$ref":"#/components/schemas/ValidateIdentityTokenResult"}},"required":["success","result"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/identities/{id}/keys":{"get":{"tags":["Identity"],"summary":"List an api_key Identity's keys (prefix + lifecycle only — never the key)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The keys.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"keys":{"type":"array","items":{"$ref":"#/components/schemas/IdentityApiKey"}}},"required":["success","keys"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}},"409":{"description":"409 WRONG_IDENTITY_KIND — the identity's kind is not `api_key`, so a key here would never be checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}}}},"post":{"tags":["Identity"],"summary":"Mint an API key — the raw key is returned ONCE and never again","description":"Creates a key for an `api_key` Identity. The response is the only time the raw key exists outside the caller: the database stores a sha256 hash, nothing logs it, and there is no endpoint that can return it later.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIdentityApiKeyInput"}}}},"responses":{"201":{"description":"The new key, including its one-time raw value.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"key":{"$ref":"#/components/schemas/CreatedIdentityApiKey"}},"required":["success","key"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Identity’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}},"409":{"description":"409 WRONG_IDENTITY_KIND — the identity's kind is not `api_key`, so a key here would never be checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}}}}},"/api/v1/identities/{id}/keys/{keyId}/revoke":{"post":{"tags":["Identity"],"summary":"Revoke a key (takes effect immediately — no gateway restart)","description":"Marks the key revoked. The gateway filters revoked keys in its lookup SQL and the config cache is busted on the same call, so the key stops working at once. Idempotent — re-revoking keeps the original revocation time.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The API key's ULID.","example":"01JL0Y…"},"required":true,"name":"keyId","in":"path"}],"responses":{"200":{"description":"The revoked key.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"key":{"$ref":"#/components/schemas/IdentityApiKey"}},"required":["success","key"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Identity’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}},"409":{"description":"409 WRONG_IDENTITY_KIND — the identity's kind is not `api_key`, so a key here would never be checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}}}}},"/api/v1/identities/{id}/keys/{keyId}":{"delete":{"tags":["Identity"],"summary":"Delete a key outright (prefer revoke, which preserves the audit trail)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The API key's ULID.","example":"01JL0Y…"},"required":true,"name":"keyId","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Identity’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}},"409":{"description":"409 WRONG_IDENTITY_KIND — the identity's kind is not `api_key`, so a key here would never be checked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityApiKeyError"}}}}}}},"/api/v1/identities/{id}/members":{"get":{"tags":["Identity"],"summary":"List every verified subject seen under this Identity, with their claimed + granted tags","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The roster.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"members":{"type":"array","items":{"$ref":"#/components/schemas/IdentityMemberRosterEntry"}}},"required":["success","members"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityMemberError"}}}}}},"post":{"tags":["Identity"],"summary":"Grant one audience tag to one verified subject","description":"ADDITIVE — the tag is unioned with whatever the subject's login claims already resolve to, on every future session/request. Never a replacement. Idempotent: granting the same (subject, tag) twice returns the existing grant.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantIdentityMemberInput"}}}},"responses":{"201":{"description":"The grant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"member":{"$ref":"#/components/schemas/IdentityMemberGrant"}},"required":["success","member"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityMemberError"}}}}}}},"/api/v1/identities/{id}/members/{memberId}":{"delete":{"tags":["Identity"],"summary":"Revoke one grant","description":"Removes ONLY this admin-granted tag. A subject's claim-derived tags are untouched — they come from their login, not from this table.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The grant's ULID.","example":"01JL0Z…"},"required":true,"name":"memberId","in":"path"}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityMemberError"}}}}}}},"/api/v1/identities/{id}/credentials":{"get":{"tags":["Identity"],"summary":"List who has connected an external application under this Identity, and when","description":"Presence and timestamps only — the stored credential itself is never returned by any route, and none exists to return it. Readable by any tenant member, like the member roster: seeing that somebody connected is not the sensitive operation, revoking is.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The connections.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"credentials":{"type":"array","items":{"$ref":"#/components/schemas/IdentityEndUserCredential"}}},"required":["success","credentials"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityCredentialError"}}}}}}},"/api/v1/identities/{id}/credentials/{credentialId}":{"delete":{"tags":["Identity"],"summary":"Disconnect one person's external application","description":"The operator door — offboarding, support, or somebody who can no longer reach the app themselves. The person's own door is the gateway's DELETE _auth/connect/{provider}. 200 whether or not a row existed: this is a state to reach, not an event that can fail. NOTE the bound — an access token already minted stays valid at the provider until it expires (at most an hour), so a faster cut means revoking at the provider as well.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The credential row's ULID.","example":"01JL0Z…"},"required":true,"name":"credentialId","in":"path"}],"responses":{"200":{"description":"Disconnected.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"disconnected":{"type":"boolean"}},"required":["success","disconnected"]}}}},"403":{"description":"INSUFFICIENT_ROLE — disconnecting is admin+.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityCredentialError"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityCredentialError"}}}}}}},"/api/v1/identities/{id}/members/{subject}/impersonate":{"post":{"tags":["Identity"],"summary":"Mint a member-impersonation credential (off by default; see impersonation-settings)","description":"Mints a real, short-lived, gateway-verified credential letting the caller act as this REAL roster member in the deployed app. Requires the Identity's impersonation opt-in to be ON, a non-blank reason, and gates at tenant members:manage PLUS Solution manager (the `impersonate` action) — a stricter floor than viewing the roster, because this mints a live credential rather than reading config.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"The verified subject to impersonate — must already be a real roster row."},"required":true,"name":"subject","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartMemberImpersonationInput"}}}},"responses":{"200":{"description":"The minted credential.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"result":{"$ref":"#/components/schemas/StartMemberImpersonationResult"}},"required":["success","result"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/identities/{id}/impersonation-sessions":{"get":{"tags":["Identity"],"summary":"List every member-impersonation session minted for this Identity","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The sessions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/MemberImpersonationSession"}}},"required":["success","sessions"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/identities/{id}/impersonation-sessions/{sessionId}":{"delete":{"tags":["Identity"],"summary":"Revoke one member-impersonation session (idempotent)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The impersonation session id."},"required":true,"name":"sessionId","in":"path"}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/identities/{id}/impersonation-settings":{"put":{"tags":["Identity"],"summary":"Turn this Identity's member-impersonation opt-in on or off","description":"Turning this OFF kills every live impersonation session under this Identity on its very next gateway request (checked fresh, never cached). Deliberately NOT part of the Identity's generic `config` — no AI builder tool can reach this field.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberImpersonationSettingsInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"allowMemberImpersonation":{"type":"boolean"}},"required":["success","allowMemberImpersonation"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/identities/{id}/member-invites":{"get":{"tags":["Identity"],"summary":"List every pending (not-yet-applied) email invite for this Identity","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The pending list.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"invites":{"type":"array","items":{"$ref":"#/components/schemas/IdentityMemberInvite"}}},"required":["success","invites"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityMemberInviteError"}}}}}},"post":{"tags":["Identity"],"summary":"Invite one email to hold one tag, applied at their first verified sign-in","description":"For someone who has never signed in under this identity, so no verified subject exists yet to grant against. Materialized into a real grant automatically the moment that email verifies for a first session — never before.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIdentityMemberInviteInput"}}}},"responses":{"201":{"description":"The pending invite.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"invite":{"$ref":"#/components/schemas/IdentityMemberInvite"}},"required":["success","invite"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityMemberInviteError"}}}}}}},"/api/v1/identities/{id}/member-invites/{inviteId}":{"delete":{"tags":["Identity"],"summary":"Cancel one pending invite before it applies","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The pending invite's ULID.","example":"01JL0Z…"},"required":true,"name":"inviteId","in":"path"}],"responses":{"200":{"description":"Cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityMemberInviteError"}}}}}}},"/api/v1/identities/{id}/members/bulk":{"post":{"tags":["Identity"],"summary":"Grant tags from a CSV/JSON export of {email, tag} rows","description":"Every row is applied independently — never all-or-nothing. A row whose email has already signed in under this identity is granted immediately; a row for an email never seen before becomes a pending invite instead. The response separates granted vs. pending vs. malformed rows so nothing is silently lost.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkGrantMembersInput"}}}},"responses":{"200":{"description":"The outcome, per row.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"result":{"$ref":"#/components/schemas/BulkGrantOutcome"}},"required":["success","result"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityMemberInviteError"}}}}}}},"/api/v1/identities/{id}/eligible-flows":{"get":{"tags":["Identity"],"summary":"List every Flow that could be picked to resolve this Identity's tags, and why the others cannot","description":"`flows` is filtered to the same Solution/Template as the Identity, published, enabled, containing a \"Set access tags\" node targeting THIS Identity, with no interaction node and no webhook trigger of its own (a webhook-triggered Flow mints an independent public URL that could write tags for any subject the caller names). `ineligible` lists every other Flow of that owner that carries a \"Set access tags\" step at all (published or draft), with the one thing standing between it and `flows` — a Flow with no such step is not a tag-assignment Flow and is left out of both.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Eligible Flows, and the reasons the rest are not.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flows":{"type":"array","items":{"$ref":"#/components/schemas/EligibleTagAssignmentFlow"}},"ineligible":{"type":"array","items":{"$ref":"#/components/schemas/IneligibleTagAssignmentFlow"}},"untaggedDocumentCount":{"type":"integer","minimum":0,"description":"How many documents in this Identity's Solution carry no audience tags at all (D7) — they stay visible to everyone regardless of anything this feature resolves. 0 for a Template-owned Identity."}},"required":["success","flows","ineligible","untaggedDocumentCount"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}}}}},"/api/v1/identities/{id}/tag-assignment":{"put":{"tags":["Identity"],"summary":"Set (or clear) the Flow that resolves this Identity's subjects' tags","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetTagAssignmentFlowInput"}}}},"responses":{"200":{"description":"The updated identity.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identity":{"$ref":"#/components/schemas/Identity"}},"required":["success","identity"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}},"409":{"description":"The chosen Flow is not owned by the same Solution/Template, or is not published/enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}},"422":{"description":"The chosen Flow has no set_identity_tags node targeting this Identity, contains an interaction node, or has its own webhook trigger (which would mint an independent public URL that could write tags for any subject).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}}}}},"/api/v1/identities/{id}/tag-reevaluation":{"put":{"tags":["Identity"],"summary":"Set (or clear) the SEPARATE Flow the \"Run now\" action uses for someone already signed in","description":"Independent of PUT .../tag-assignment (the sign-in-time Flow) — this Flow is never run automatically, only on demand via POST .../tag-assignment/re-evaluate. Same eligibility re-check.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetTagAssignmentFlowInput"}}}},"responses":{"200":{"description":"The updated identity.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identity":{"$ref":"#/components/schemas/Identity"}},"required":["success","identity"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}},"409":{"description":"The chosen Flow is not owned by the same Solution/Template, or is not published/enabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}},"422":{"description":"The chosen Flow has no set_identity_tags node targeting this Identity, contains an interaction node, or has its own webhook trigger (which would mint an independent public URL that could write tags for any subject).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}}}}},"/api/v1/identities/{id}/tag-assignment/re-evaluate":{"post":{"tags":["Identity"],"summary":"Run the \"existing members\" Flow now, for one person, instead of waiting for their next gateway request","description":"Runs `tagReEvaluationFlowId` — the SEPARATE Flow set via PUT .../tag-reevaluation, never the sign-in one. Synchronous — waits for the Flow to finish (same timeout the gateway itself uses) and returns what changed. UNLIKE the gateway's own trigger, a failure here is a real error, not a silent no-op: an admin who asked for this wants to know why.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Identity's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReEvaluateTagsInput"}}}},"responses":{"200":{"description":"The outcome.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"outcome":{"$ref":"#/components/schemas/TagAssignmentOutcome"}},"required":["success","outcome"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}},"409":{"description":"No \"existing members\" Flow is configured on this Identity.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}},"422":{"description":"The Flow run failed, timed out, or returned something unusable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityTagAssignmentError"}}}}}}},"/api/v1/identity-providers":{"get":{"tags":["Identity"],"summary":"The IdP preset catalog — every supported identity provider, as data","description":"The single source of truth for the provider picker and the per-provider Identity form: issuer templates, the fields each vendor needs (with help text), default algorithms and claim maps, the browser sign-in flow, and the per-vendor quirks. Read-only and non-secret.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"providers":{"type":"array","items":{"$ref":"#/components/schemas/IdentityProviderPreset"}}},"required":["success","providers"]}}}}}}},"/api/v1/connections":{"get":{"tags":["Connections"],"summary":"Global list of connections across all Solutions (no secrets) - searchable, filterable, paginated","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"The connections.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connections":{"type":"array","items":{"$ref":"#/components/schemas/Connection"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","connections","total","limit","offset","counts"]}}}}}}},"/api/v1/connections/{id}":{"get":{"tags":["Connections"],"summary":"Connection detail (no secret)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Connection's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The connection.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connection":{"$ref":"#/components/schemas/Connection"}},"required":["success","connection"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"patch":{"tags":["Connections"],"summary":"Update name/meta, and rotate the secret if `secret` is present","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Connection's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateConnectionInput"}}}},"responses":{"200":{"description":"The updated connection.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connection":{"$ref":"#/components/schemas/Connection"}},"required":["success","connection"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Connection’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"delete":{"tags":["Connections"],"summary":"Delete a connection","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Connection's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Connection’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/solutions/{id}/connections":{"get":{"tags":["Solutions"],"summary":"List the connections this Solution OWNS (no secrets)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The Solution's connections.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connections":{"type":"array","items":{"$ref":"#/components/schemas/Connection"}},"total":{"type":"number"}},"required":["success","connections","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"post":{"tags":["Solutions"],"summary":"Create a connection owned by this Solution (secret write-only)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConnectionInput"}}}},"responses":{"201":{"description":"The created connection (no secret).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connection":{"$ref":"#/components/schemas/Connection"}},"required":["success","connection"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"DUPLICATE_CONNECTION — the owner already has the same normalized name, kind, and configuration.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/gateways":{"get":{"tags":["Flex Gateway"],"summary":"Global Flex Gateway list - searchable, filterable, paginated","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"The gateways.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"apis":{"type":"array","items":{"$ref":"#/components/schemas/GatewayListItem"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","apis","total","limit","offset","counts"]}}}}}}},"/api/v1/gateways/limits":{"get":{"tags":["Flex Gateway"],"summary":"The request-size limits an endpoint's Max request size is chosen within","description":"Read BEFORE any gateway exists (a create form needs it), and the one source of these numbers for a client — the Studio renders the server's ceiling, never a constant of its own (FAI-1421).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The limits.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"limits":{"$ref":"#/components/schemas/GatewayEndpointLimits"}},"required":["success","limits"]}}}}}}},"/api/v1/gateways/{id}":{"get":{"tags":["Flex Gateway"],"summary":"Get one Flex Gateway","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The gateway.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"api":{"$ref":"#/components/schemas/Gateway"}},"required":["success","api"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"patch":{"tags":["Flex Gateway"],"summary":"Update name/description/enabled","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateGatewayInput"}}}},"responses":{"200":{"description":"The gateway.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"api":{"$ref":"#/components/schemas/Gateway"}},"required":["success","api"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"delete":{"tags":["Flex Gateway"],"summary":"Delete a Flex Gateway (+ its endpoints)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/gateways/{id}/endpoints":{"get":{"tags":["Flex Gateway"],"summary":"List a gateway's endpoints","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The endpoints.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"endpoints":{"type":"array","items":{"$ref":"#/components/schemas/GatewayEndpointListItem"}}},"required":["success","endpoints"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"post":{"tags":["Flex Gateway"],"summary":"Create an endpoint","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGatewayEndpointInput"}}}},"responses":{"201":{"description":"The created endpoint.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"endpoint":{"$ref":"#/components/schemas/GatewayEndpoint"}},"required":["success","endpoint"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/gateways/{id}/endpoints/{eid}":{"get":{"tags":["Flex Gateway"],"summary":"Get one endpoint","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The endpoint's ULID."},"required":true,"name":"eid","in":"path"}],"responses":{"200":{"description":"The endpoint.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"endpoint":{"$ref":"#/components/schemas/GatewayEndpoint"}},"required":["success","endpoint"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"patch":{"tags":["Flex Gateway"],"summary":"Update an endpoint","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The endpoint's ULID."},"required":true,"name":"eid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateGatewayEndpointInput"}}}},"responses":{"200":{"description":"The endpoint.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"endpoint":{"$ref":"#/components/schemas/GatewayEndpoint"}},"required":["success","endpoint"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"delete":{"tags":["Flex Gateway"],"summary":"Delete an endpoint","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The endpoint's ULID."},"required":true,"name":"eid","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/gateways/{id}/identity":{"put":{"tags":["Flex Gateway"],"summary":"Connect (or clear) the named Identity this gateway uses","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectGatewayIdentityInput"}}}},"responses":{"200":{"description":"The gateway (with identityId).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"gateway":{"$ref":"#/components/schemas/Gateway"}},"required":["success","gateway"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"CROSS_SOLUTION","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/gateways/{id}/identity-candidates":{"get":{"tags":["Flex Gateway"],"summary":"List a 'dynamic'-mode gateway's identity-candidate roster","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The roster.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"candidates":{"type":"array","items":{"$ref":"#/components/schemas/GatewayIdentityCandidate"}}},"required":["success","candidates"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"post":{"tags":["Flex Gateway"],"summary":"Attach an Identity to the roster by a resolver key","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachIdentityCandidateInput"}}}},"responses":{"201":{"description":"The attached candidate.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"candidate":{"$ref":"#/components/schemas/GatewayIdentityCandidate"}},"required":["success","candidate"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"CROSS_SOLUTION | CANDIDATE_ALREADY_ATTACHED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/gateways/{id}/identity-candidates/{cid}":{"delete":{"tags":["Flex Gateway"],"summary":"Detach an identity candidate","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The identity candidate's ULID."},"required":true,"name":"cid","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this gateway’s Solution (or Template).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/solutions":{"get":{"tags":["Solutions"],"summary":"List all solutions - searchable, filterable, offset-paginated by default; ?cursor= for keyset","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"}],"responses":{"200":{"description":"Solutions. The keyset branch (`?cursor=`) answers `nextCursor` and no census; the default branch answers `total`/`counts`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"solutions":{"type":"array","items":{"$ref":"#/components/schemas/SolutionListItem"}},"nextCursor":{"type":"string","nullable":true},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","solutions"]}}}}}},"post":{"tags":["Solutions"],"summary":"Create a solution (from a FactBase or a data-less prototype)","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSolutionInput"}}}},"responses":{"200":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"solution":{"$ref":"#/components/schemas/SolutionDetail"}},"required":["success","solution"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/from-prompt":{"post":{"tags":["Solutions"],"summary":"Home entry (multipart): create the Solution + start the first-cut build","security":[{"bearerAuth":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/FromPromptInput"}}}},"responses":{"200":{"description":"The new solution id/name/title.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"name":{"type":"string"},"title":{"type":"string"}},"required":["success","id","name","title"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"PROMPT_TOO_LONG - the request is longer than the limit; nothing was created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}":{"get":{"tags":["Solutions"],"summary":"Get one solution","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Solution's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The solution.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"solution":{"$ref":"#/components/schemas/SolutionDetail"}},"required":["success","solution"]}}}},"404":{"description":"SOLUTION_NOT_FOUND — no such Solution here. SOLUTION_NOT_SHARED — it IS here and nobody has shared it with you; the SAME status deliberately (a differing one would let a non-member probe ids), and the only one of the two with an action: POST /api/v1/solutions/{id}/access-request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["Solutions"],"summary":"Update title and/or description","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Solution's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSolutionInput"}}}},"responses":{"200":{"description":"The updated solution.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"solution":{"$ref":"#/components/schemas/SolutionDetail"}},"required":["success","solution"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"STALE_WRITE - modified since expectedUpdatedAt.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Solutions"],"summary":"Delete a solution (full teardown)","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","description":"The Solution's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"nullable":true}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/stats":{"get":{"tags":["Stats"],"summary":"All-solutions combined stats","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/solutions/usage":{"get":{"tags":["Stats"],"summary":"All-solutions usage report","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage report.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/stats":{"get":{"tags":["Stats"],"summary":"Platform-wide stats rollup","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/usage":{"get":{"tags":["Stats"],"summary":"Platform-wide usage report","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage report.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/solutions/{id}/doc-bases":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Create a DocBase owned by this Solution (pins the embedding + vector driver)","parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocBaseInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBase":{"$ref":"#/components/schemas/DocBase"}},"required":["success","docBase"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"List this Solution's DocBases","parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"DocBases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBases":{"type":"array","items":{"$ref":"#/components/schemas/DocBaseListItem"}}},"required":["success","docBases"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"List all DocBases - searchable, filterable, paginated","parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"DocBases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBases":{"type":"array","items":{"$ref":"#/components/schemas/DocBaseListItem"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","docBases","total","limit","offset","counts"]}}}}}}},"/api/v1/doc-bases/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Get one DocBase","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The DocBase.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBase":{"$ref":"#/components/schemas/DocBase"}},"required":["success","docBase"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Update a DocBase (name/description/settings; pinned embedding+vector immutable)","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDocBaseInput"}}}},"responses":{"200":{"description":"The updated DocBase.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBase":{"$ref":"#/components/schemas/DocBase"}},"required":["success","docBase"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Delete a DocBase + its documents, chunks, vectors, and source files","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/reindex":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Re-index the DocBase (optionally re-pin the embedding model, chunker or vector driver)","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReindexDocBaseInput"}}}},"responses":{"202":{"description":"Re-indexing into a newly minted generation. Rebuilds every ALREADY-INDEXED document only — a File Store file with no document yet is untouched; this never adds one.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBase":{"$ref":"#/components/schemas/DocBase"},"generation":{"type":"number","description":"The index generation the documents are being rebuilt into."},"jobs":{"type":"array","items":{"type":"object","properties":{"documentId":{"type":"string"},"jobId":{"type":"string"},"alreadyRunning":{"type":"boolean","description":"True when this document already had an ingest running, so no new job was started and `jobId` is that running job. It rebuilds the document against the new generation itself (it checks before it embeds, before it writes and before it marks the document ready), so the document is not skipped; the flag is how a caller tells its job apart from a queued one."}},"required":["documentId","jobId","alreadyRunning"]}}},"required":["success","docBase","generation","jobs"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/generations":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Index generations — one per build of the index, newest first","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Generations.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"generations":{"type":"array","items":{"$ref":"#/components/schemas/IndexGeneration"}}},"required":["success","generations"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/file-store":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Where this Doc Base's documents keep their bytes: its managed store (null before the first upload) plus any other stores referenced via \"Add from File Store\"","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The managed store (if any) and any other stores this Doc Base references.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStore":{"$ref":"#/components/schemas/DocBaseFileStore"},"referencedStores":{"type":"array","items":{"$ref":"#/components/schemas/ReferencedFileStore"}}},"required":["success","fileStore","referencedStores"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/file-stores":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Every File Store this Doc Base has linked for browsing/picking (its own store is separate — see /file-store)","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Linked stores.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stores":{"type":"array","items":{"$ref":"#/components/schemas/DocBaseFileStoreLink"}}},"required":["success","stores"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Link a File Store's whole tree for browsing/picking (no bytes move). Nothing is indexed by linking alone — unless `autoIndex` is on, when every NEW file of the store is added automatically","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDocBaseFileStoreInput"}}}},"responses":{"201":{"description":"Linked (or already linked — the same row), with its switch and counts.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"store":{"$ref":"#/components/schemas/DocBaseFileStoreLink"}},"required":["success","store"]}}}},"403":{"description":"The caller may not change this Doc Base (its Solution or Template)."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The store belongs to another Solution, or is system-managed."}}}},"/api/v1/doc-bases/{id}/file-stores/{storeId}/index-existing":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Add the files already in a linked File Store to this Doc Base's index: every one not yet a document here is queued for the same automatic indexing a new upload gets","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"storeId","in":"path"}],"responses":{"200":{"description":"What was queued, what was already indexed, and what cannot be indexed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"queued":{"type":"integer","description":"Files queued for indexing (each by its own background job)."},"alreadyIndexed":{"type":"integer","description":"Files that are already documents of this Doc Base."},"notIndexable":{"type":"integer","description":"Files it cannot index: quarantined, a failed scan, or a type the Doc Base cannot read."}},"required":["success","queued","alreadyIndexed","notIndexable"]}}}},"403":{"description":"The caller may not change this Doc Base (its Solution or Template)."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"The store holds more files than can be added in one go (INDEX_EXISTING_TOO_MANY_FILES, above 2000) — nothing was queued."}}}},"/api/v1/doc-bases/{id}/file-stores/{linkId}":{"patch":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Switch \"add new files to this Doc Base automatically\" on or off for a linked File Store (by the link's id or the store's). Turning it on does not add the files already there — `index-existing` does","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The link's id — or the id of the linked File Store, which addresses the same link."},"required":true,"name":"linkId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDocBaseFileStoreInput"}}}},"responses":{"200":{"description":"The link, with its switch and counts.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"store":{"$ref":"#/components/schemas/DocBaseFileStoreLink"}},"required":["success","store"]}}}},"400":{"description":"The body is not `{ autoIndex: boolean }`."},"403":{"description":"The caller may not change this Doc Base (its Solution or Template)."},"404":{"description":"DOC_BASE_NOT_FOUND, or FILE_STORE_LINK_NOT_FOUND — that store is not linked to this Doc Base."}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Unlink a File Store (documents already indexed from it are untouched; its new files stop being added automatically)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"linkId","in":"path"}],"responses":{"200":{"description":"Unlinked.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"The caller may not change this Doc Base (its Solution or Template)."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/file-stores/{storeId}/index-states":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"What happened to each of these files of a linked File Store in this Doc Base: indexed, waiting, not indexable or failed (with the reason). A file with no state is simply not in the index and is not returned","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"storeId","in":"path"},{"schema":{"type":"string","description":"Comma-separated ids (1–200) of files in the linked store — typically the page of its files on screen."},"required":true,"name":"fileIds","in":"query"}],"responses":{"200":{"description":"One entry per named file that has a state.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"states":{"type":"array","items":{"$ref":"#/components/schemas/DocBaseFileIndexState"}}},"required":["success","states"]}}}},"400":{"description":"BAD_FILE_IDS — `fileIds` is empty, names more than 200 files, or holds something that is not a file id."},"404":{"description":"DOC_BASE_NOT_FOUND, or FILE_STORE_LINK_NOT_FOUND — that store is not linked to this Doc Base."}}}},"/api/v1/doc-bases/{id}/documents":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Upload a file → queued document + ingest job","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/UploadDocumentInput"}}}},"responses":{"201":{"description":"Created + ingesting.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"document":{"$ref":"#/components/schemas/Document"},"jobId":{"type":"string"}},"required":["success","document","jobId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_DOCUMENT — this Doc Base already holds byte-identical content. The error details carry duplicateOfId / duplicateOfName; resend with allowDuplicate=\"true\" to index it anyway."}}},"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"List a DocBase's documents (with ingest status)","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Documents.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"documents":{"type":"array","items":{"$ref":"#/components/schemas/Document"}}},"required":["success","documents"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/documents/from-file":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Index a file already in the Files layer → queued document + ingest job (no bytes move)","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddDocumentFromFileInput"}}}},"responses":{"201":{"description":"Created + ingesting.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"document":{"$ref":"#/components/schemas/Document"},"jobId":{"type":"string"}},"required":["success","document","jobId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"The file belongs to another Solution, is quarantined, or DUPLICATE_DOCUMENT — this Doc Base already holds byte-identical content (details carry duplicateOfId / duplicateOfName; resend with allowDuplicate: true)."}}}},"/api/v1/doc-bases/{id}/documents/url":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Ingest a URL (same-origin crawl) → queued document + ingest job","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestUrlInput"}}}},"responses":{"201":{"description":"Created + ingesting.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"document":{"$ref":"#/components/schemas/Document"},"jobId":{"type":"string"}},"required":["success","document","jobId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/documents/{docId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Get one document","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"docId","in":"path"}],"responses":{"200":{"description":"The document.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"document":{"$ref":"#/components/schemas/Document"}},"required":["success","document"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Set a document's access-control audiences (D18 — no re-embed)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"docId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDocumentAudiencesInput"}}}},"responses":{"200":{"description":"The updated document.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"document":{"$ref":"#/components/schemas/Document"}},"required":["success","document"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Delete a document (chunks + vectors + source bytes)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"docId","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/documents/{docId}/reindex":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Re-run ingestion, optionally overriding this document's own chunk size/overlap","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"docId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReindexDocumentInput"}}}},"responses":{"202":{"description":"Re-ingesting. If an ingest of this document was already running (`alreadyRunning`), nothing is dropped: the request is recorded on the document, and the running ingest rebuilds it when it next looks, or a fresh ingest starts as soon as it finishes.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"},"alreadyRunning":{"type":"boolean","description":"True when this document already had an ingest running, so `jobId` is that running job and no new one was started. The re-index (with any override it carried) is still carried out after it."}},"required":["success","jobId","alreadyRunning"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/documents/{docId}/file":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Stream the original source bytes (upload documents)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"docId","in":"path"}],"responses":{"200":{"description":"The original file bytes."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/documents/{docId}/ingest/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Reconnectable SSE of ingestion progress (replay-from-cursor then tail)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"docId","in":"path"}],"responses":{"200":{"description":"text/event-stream of ingest events."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/search-presets":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"The retrieval-preset catalog + the platform default","responses":{"200":{"description":"Every preset with the knobs it sets, plus the platform default id.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"presets":{"type":"array","items":{"$ref":"#/components/schemas/DocBaseSearchPresetInfo"}},"defaultPreset":{"type":"string","enum":["fast","balanced","thorough"]}},"required":["success","presets","defaultPreset"]}}}}}}},"/api/v1/doc-bases/{id}/search":{"post":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Hybrid retrieval (keyword | semantic | hybrid) over a DocBase","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocBaseSearchInput"}}}},"responses":{"200":{"description":"Ranked chunks + retrieval meta.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"chunks":{"type":"array","items":{"$ref":"#/components/schemas/RetrievedChunk"}},"meta":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","chunks","meta"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-DocBases stats","responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/doc-bases/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One DocBase's stats","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/{id}/stats/query-performance":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"Retrieval-latency telemetry","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Query performance.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/doc-bases/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-DocBases usage","parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/doc-bases/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One DocBase's usage","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/doc-bases/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One DocBase's AI-operation history","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}}}}},"/api/v1/doc-bases/{id}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["DocBase"],"summary":"Index/version history (read-only)","parameters":[{"schema":{"type":"string","description":"The DocBase's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","versions"]}}}}}}},"/api/v1/launchpads":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"List every LaunchPad - searchable, filterable, paginated","parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"LaunchPads.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpads":{"type":"array","items":{"$ref":"#/components/schemas/LaunchPadListItem"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","launchpads","total","limit","offset","counts"]}}}}}}},"/api/v1/launchpads/{lid}":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Get one LaunchPad","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"The LaunchPad.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpad":{"$ref":"#/components/schemas/LaunchPadDetail"}},"required":["success","launchpad"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Update title/description","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLaunchpadInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpad":{"$ref":"#/components/schemas/LaunchPadDetail"}},"required":["success","launchpad"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Delete a LaunchPad (+ its artifacts)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","deleted"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/branding":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Get brand tokens (defaults if unset) + the managed logo File Store id","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"Branding.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tokens":{"$ref":"#/components/schemas/LaunchpadBrandingTokens"},"fileStoreId":{"type":"string"}},"required":["success","tokens","fileStoreId"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Update brand tokens (partial; no agent turn, no rebuild)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLaunchpadBrandingInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tokens":{"$ref":"#/components/schemas/LaunchpadBrandingTokens"}},"required":["success","tokens"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/fact-bases":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Connected FactBases","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"Connected FactBases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBases":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","factBases","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/fact-bases/{fid}":{"put":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Connect a FactBase (same Solution)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fid","in":"path"}],"responses":{"200":{"description":"Connected.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connected":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","connected"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CROSS_SOLUTION","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Disconnect a FactBase","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fid","in":"path"}],"responses":{"200":{"description":"Disconnected.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"disconnected":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","disconnected"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/deploy":{"post":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Deploy - promote the draft to live (mints a version)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"Deployed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"version":{"type":"number"},"launchpad":{"$ref":"#/components/schemas/LaunchPadDetail"}},"required":["success","version","launchpad"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/api-link":{"put":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Pin (or clear) the Flex Gateway this app calls","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LaunchpadApiLinkInput"}}}},"responses":{"200":{"description":"Linked.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpad":{"$ref":"#/components/schemas/LaunchPadDetail"}},"required":["success","launchpad"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CROSS_SOLUTION","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/launchpads/{lid}/preview-link":{"post":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"FAI-902 — mint a short-lived link to preview the LIVE app as a chosen audience scope (members:manage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LaunchpadPreviewLinkInput"}}}},"responses":{"200":{"description":"The preview link.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"url":{"type":"string"},"expiresAt":{"type":"string"}},"required":["success","url","expiresAt"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"LAUNCHPAD_TEMPLATE_OWNED / LAUNCHPAD_NOT_LIVE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/launchpads/{lid}/files":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"List the generated UI files","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"Files.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"files":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","files"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Delete a file/folder (?path=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string","description":"Repo-relative file path within the draft channel."},"required":true,"name":"path","in":"query"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/files/upload":{"post":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Upload files (multipart)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"files":{"type":"array","items":{"nullable":true}},"path":{"type":"string"}}}}}},"responses":{"200":{"description":"Uploaded.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/files/folder":{"post":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Create a folder","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LaunchpadFolderInput"}}}},"responses":{"200":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/file":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Read one file (?path=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string","description":"Repo-relative file path within the draft channel."},"required":true,"name":"path","in":"query"}],"responses":{"200":{"description":"The file contents.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"content":{"type":"string"}},"required":["success","content"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Write one file (?path=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string","description":"Repo-relative file path within the draft channel."},"required":true,"name":"path","in":"query"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LaunchpadFileWriteInput"}}}},"responses":{"200":{"description":"Written.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this LaunchPad’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-LaunchPads combined stats","responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/launchpads/{lid}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One LaunchPad's summary stats","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-LaunchPads usage report","parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/launchpads/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One LaunchPad's usage report","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/launchpads/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One LaunchPad's AI-operation history","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}}}}},"/api/v1/launchpads/{id}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Deploy history (read-only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","versions"]}}}}}}},"/api/v1/solutions/{id}/launchpads":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"List a Solution's LaunchPads","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"LaunchPads.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpads":{"type":"array","items":{"$ref":"#/components/schemas/LaunchPadListItem"}}},"required":["success","launchpads"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Create a LaunchPad in this Solution","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLaunchpadInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpad":{"$ref":"#/components/schemas/LaunchPadDetail"}},"required":["success","launchpad"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/domains":{"get":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"List every custom-domain claim on this LaunchPad, newest-changed first (includes removed)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"responses":{"200":{"description":"Claims.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"domains":{"type":"array","items":{"$ref":"#/components/schemas/LaunchpadDomainClaim"}}},"required":["success","domains"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Add a custom-domain claim","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddLaunchpadDomainInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"domain":{"type":"string"},"state":{"type":"string","enum":["setting_up","deploying","active","failed","removing","removed"]},"dnsRecords":{"type":"array","items":{"$ref":"#/components/schemas/LaunchpadDomainDnsRecord"}},"checkMessage":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["success","id","domain","state","dnsRecords","checkMessage","createdAt","updatedAt"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DOMAIN_ALREADY_CLAIMED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"429":{"description":"RATE_LIMITED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"503":{"description":"CUSTOM_DOMAINS_UNCONFIGURED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/launchpads/{lid}/domains/{did}/verify":{"post":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Verify ownership/routing DNS records (no-op outside setting_up)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string"},"required":true,"name":"did","in":"path"}],"responses":{"200":{"description":"Current claim state.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"domain":{"type":"string"},"state":{"type":"string","enum":["setting_up","deploying","active","failed","removing","removed"]},"dnsRecords":{"type":"array","items":{"$ref":"#/components/schemas/LaunchpadDomainDnsRecord"}},"checkMessage":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["success","id","domain","state","dnsRecords","checkMessage","createdAt","updatedAt"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/domains/{did}/retry":{"post":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Retry a failed setup: failed -> setting_up (no-op outside failed)","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string"},"required":true,"name":"did","in":"path"}],"responses":{"200":{"description":"Current claim state.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"domain":{"type":"string"},"state":{"type":"string","enum":["setting_up","deploying","active","failed","removing","removed"]},"dnsRecords":{"type":"array","items":{"$ref":"#/components/schemas/LaunchpadDomainDnsRecord"}},"checkMessage":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["success","id","domain","state","dnsRecords","checkMessage","createdAt","updatedAt"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/launchpads/{lid}/domains/{did}":{"delete":{"security":[{"bearerAuth":[]}],"tags":["LaunchPad"],"summary":"Remove (from active) or Cancel (from setting_up) a claim - same operation","parameters":[{"schema":{"type":"string"},"required":true,"name":"lid","in":"path"},{"schema":{"type":"string"},"required":true,"name":"did","in":"path"}],"responses":{"200":{"description":"Already terminal.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"domain":{"type":"string"},"state":{"type":"string","enum":["setting_up","deploying","active","failed","removing","removed"]},"dnsRecords":{"type":"array","items":{"$ref":"#/components/schemas/LaunchpadDomainDnsRecord"}},"checkMessage":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["success","id","domain","state","dnsRecords","checkMessage","createdAt","updatedAt"]}}}},"202":{"description":"Background teardown queued.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"domain":{"type":"string"},"state":{"type":"string","enum":["setting_up","deploying","active","failed","removing","removed"]},"dnsRecords":{"type":"array","items":{"$ref":"#/components/schemas/LaunchpadDomainDnsRecord"}},"checkMessage":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["success","id","domain","state","dnsRecords","checkMessage","createdAt","updatedAt"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/data-portraits":{"get":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"List all DataPortraits - searchable, filterable, paginated","parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"DataPortraits.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"portraits":{"type":"array","items":{"$ref":"#/components/schemas/DataPortrait"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","portraits","total","limit","offset","counts"]}}}}}}},"/api/v1/data-portraits/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Get one DataPortrait","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The DataPortrait.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"dataPortrait":{"$ref":"#/components/schemas/DataPortrait"}},"required":["success","dataPortrait"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Update DataPortrait metadata","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"dataPortrait":{"$ref":"#/components/schemas/DataPortrait"}},"required":["success","dataPortrait"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Delete a DataPortrait","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/data-portraits/{id}/profile":{"get":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"The measured Stage-2 profile","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Profile.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"profile":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}}},"required":["success","profile"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Save the profile","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"profile":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","profile"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/data-portraits/{id}/profile/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Profile-run status + incremental event page","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Return only events after this event id (the replay cursor). Omit to replay from the start."},"required":false,"name":"since","in":"query"}],"responses":{"200":{"description":"The latest run, the events after `since`, and the next cursor.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"events":{"type":"array","items":{"$ref":"#/components/schemas/ProfileEvent"}},"cursor":{"type":"integer","description":"Highest event id in this page — pass as `since` on the next poll."}},"required":["success","run","events","cursor"]}}}}}}},"/api/v1/data-portraits/{id}/profile/start":{"post":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Start the Stage-2 profiling job","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"}},"required":["success","jobId"]}}}}}}},"/api/v1/data-portraits/{id}/profile/stop":{"post":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Stop the profiling job","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stopping.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/data-portraits/{id}/profile/reconcile":{"post":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Reconcile profile discrepancies into the definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Reconciled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/data-portraits/{id}/ontology":{"get":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"The Stage-3 ontology","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Ontology.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"ontology":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}}},"required":["success","ontology"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Save / sign off the ontology","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"ontology":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","ontology"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/data-portraits/{id}/ontology/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Ontology-run status","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string"},"jobError":{"type":"string","nullable":true}},"required":["success","status"]}}}}}}},"/api/v1/data-portraits/{id}/ontology/generate":{"post":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Generate the ontology synchronously","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Generated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"ontology":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","ontology"]}}}}}}},"/api/v1/data-portraits/{id}/ontology/start":{"post":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Start the ontology job","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"}},"required":["success","jobId"]}}}}}}},"/api/v1/data-portraits/{id}/ontology/stop":{"post":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Stop the ontology job","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stopping.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/data-portraits/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-DataPortraits stats","responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/data-portraits/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One DataPortrait's stats","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/data-portraits/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-DataPortraits usage","parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/data-portraits/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One DataPortrait's usage","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/data-portraits/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One DataPortrait's AI-operation history","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}}}}},"/api/v1/data-portraits/{id}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Version history (read-only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","versions"]}}}}}}},"/api/v1/fact-bases/{id}/data-portraits":{"post":{"security":[{"bearerAuth":[]}],"tags":["DataPortrait"],"summary":"Create the DataPortrait for this FactBase (0-or-1)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"dataPortrait":{"$ref":"#/components/schemas/DataPortrait"}},"required":["success","dataPortrait"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/agents":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Create an Agent in this Solution","parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agent":{"$ref":"#/components/schemas/Agent"}},"required":["success","agent"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_AGENT_NAME — this Solution already has an agent with that name (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}},"get":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"List this Solution's Agents","parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Agents.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agents":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"total":{"type":"number"},"capabilities":{"$ref":"#/components/schemas/AgentApiCapabilities"}},"required":["success","agents","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Global list of Agents - searchable, filterable, paginated","parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Agents.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agents":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"capabilities":{"$ref":"#/components/schemas/AgentApiCapabilities"},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","agents","total","limit","offset","counts"]}}}}}}},"/api/v1/agents/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Get one Agent (incl. its draft definition)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The Agent.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agent":{"$ref":"#/components/schemas/Agent"},"draftPending":{"type":"boolean"},"capabilities":{"$ref":"#/components/schemas/AgentApiCapabilities"}},"required":["success","agent"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Update an Agent (name/description/enabled)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agent":{"$ref":"#/components/schemas/Agent"}},"required":["success","agent"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_AGENT_NAME — a rename onto a name another agent in the same owner already uses (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Delete an Agent (+ its version history)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/definition":{"put":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Replace the draft AgentDefinition","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentDefinitionInput"}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agent":{"$ref":"#/components/schemas/Agent"}},"required":["success","agent"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/validation":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Structured publish-validation lint (errors + warnings)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The lint result.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"validation":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","validation"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/publish":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Publish the draft (lint must pass; snapshots a version)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishAgentInput"}}}},"responses":{"200":{"description":"Published.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agent":{"$ref":"#/components/schemas/Agent"},"version":{"type":"number"}},"required":["success","agent","version"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"AGENT_VALIDATION_FAILED — the lint has error issues.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Publish/version history (read-only)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","versions"]}}}}}}},"/api/v1/agents/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-Agents combined stats","responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/agents/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One Agent's stats","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-Agents usage","parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/agents/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One Agent's usage","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/agents/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One Agent's AI-operation history","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}}}}},"/api/v1/agents/{id}/export":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Export the Agent as portable JSON (ids → symbolic refs; no secrets)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The portable Agent.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"export":{"$ref":"#/components/schemas/AgentExport"}},"required":["success","export"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/agents/import":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Import a portable Agent (symbolic refs resolved by name) as a draft","parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportAgentInput"}}}},"responses":{"201":{"description":"Created as a draft.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agent":{"$ref":"#/components/schemas/Agent"}},"required":["success","agent"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_AGENT_NAME — this Solution already has an agent with the imported name (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"422":{"description":"AGENT_IMPORT_UNRESOLVED_REFS — a referenced resource has no same-named match.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/intents/phrases":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Generate more example phrases for one intent (proposal only)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateIntentPhrasesInput"}}}},"responses":{"200":{"description":"New phrases (excluding the ones already present).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"phrases":{"type":"array","items":{"type":"string"}}},"required":["success","phrases"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/intents/suggest":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Propose a starter intent set from this Agent's own instructions + grants (proposal only)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Suggested intents (excluding ones already defined).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"intents":{"type":"array","items":{"$ref":"#/components/schemas/AgentIntent"}}},"required":["success","intents"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/intents/extract":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agents"],"summary":"Extract an intent set from a prose description (proposal only)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractIntentsInput"}}}},"responses":{"200":{"description":"Extracted intents.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"intents":{"type":"array","items":{"$ref":"#/components/schemas/AgentIntent"}}},"required":["success","intents"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Global list of flows (+ last-run rollup) - searchable, filterable, paginated","parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"Flows.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flows":{"type":"array","items":{"$ref":"#/components/schemas/Flow"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","flows","total","limit","offset","counts"]}}}}}}},"/api/v1/flows/templates":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Prebuilt flow template gallery","responses":{"200":{"description":"Templates.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"templates":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","templates"]}}}}}}},"/api/v1/flows/node-types":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Node types this tenant may author/publish/run (+ capability flags)","responses":{"200":{"description":"The availability projection - NOT the parseable catalog.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"nodeTypes":{"type":"array","items":{"type":"string"}},"capabilities":{"$ref":"#/components/schemas/FlowNodeCapabilities"}},"required":["success","nodeTypes","capabilities"]}}}}}}},"/api/v1/flows/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Get one flow (incl. the draft graph)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The flow.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flow":{"$ref":"#/components/schemas/Flow"}},"required":["success","flow"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Update flow name/description/enabled","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flow":{"$ref":"#/components/schemas/Flow"}},"required":["success","flow"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_FLOW_NAME — a rename onto a name another flow in the same owner already uses (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Delete a flow","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/expression-tokens":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Get graph-aware upstream expression tokens for one node","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"graph":{"type":"object","additionalProperties":{"nullable":true}},"currentNodeId":{"type":"string"}},"required":["graph","currentNodeId"]}}}},"responses":{"200":{"description":"Server-owned expression picker groups.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"groups":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","groups"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/file-preview":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Preview a saved ViewPort document during Studio authoring","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"file":{"type":"object","properties":{"fileId":{"type":"string","minLength":1},"fileStoreId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"mediaType":{"type":"string","minLength":1},"sizeBytes":{"type":"number","minimum":0},"sha256":{"type":"string","minLength":1},"version":{"type":"integer","minimum":0,"exclusiveMinimum":true}},"required":["fileId","fileStoreId","name","mediaType","sizeBytes","sha256","version"],"additionalProperties":false}},"required":["file"]}}}},"responses":{"200":{"description":"The bounded inert Studio preview.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/draft":{"put":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Save the draft graph (returns per-node validation errors + warnings)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowDraftInput"}}}},"responses":{"200":{"description":"Saved. `warnings` is additive and never blocks publish.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"errors":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"warnings":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","errors","warnings"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/validate":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Validate a graph WITHOUT saving it (the read-only twin of PUT /draft)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowDraftInput"}}}},"responses":{"200":{"description":"Validated. Nothing was persisted, so a reader never becomes the flow's last modifier (FAI-736).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"errors":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"warnings":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","errors","warnings"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/publish":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Publish the draft (snapshots a version)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Published (+ non-blocking warnings).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flow":{"$ref":"#/components/schemas/Flow"},"warnings":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","flow","warnings"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/export":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Export the published (else draft) graph (secrets stripped)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The portable graph.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"graph":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","graph"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/run":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Trigger a run","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"202":{"description":"The queued run.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","run"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/test-run":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Test-run with a sample payload","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"The run.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","run"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/interactive-test-run":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Start an authenticated Studio interactive test of the draft","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"202":{"description":"The queued Studio-owned run.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","run"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}/interactions":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Refresh or replay cards for an authenticated Studio test run of this flow","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"The owner projection; `interactive: false` with no cards for a headless run. Card actions name this same address.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"interactive":{"type":"boolean"},"interactions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","interactive","interactions"]}}}},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}/interactions/{interactionId}/submissions":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Answer one open Studio test form of a run of this flow","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"interactionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"values":{"nullable":true},"expectedVersion":{"type":"integer","minimum":0}},"required":["expectedVersion"]}}}},"responses":{"200":{"description":"Accepted, re-asked, or closed.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}/interactions/{interactionId}/preview":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Read one bounded Studio ViewPort preview of a run of this flow","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"interactionId","in":"path"}],"responses":{"200":{"description":"The inert preview.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}/interactions/{interactionId}/file":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Download one Studio ViewPort file of a run of this flow","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"interactionId","in":"path"}],"responses":{"200":{"description":"Attachment bytes."},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/runs/{runId}/interactions":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"deprecated":true,"summary":"Refresh or replay cards for an authenticated Studio test run (deprecated flow-less address)","description":"DEPRECATED - use `/api/v1/flows/{id}/runs/{runId}/interactions…`. Served for one release for a Studio loaded before the move.","parameters":[{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"The owner projection.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"interactive":{"type":"boolean"},"interactions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","interactive","interactions"]}}}},"404":{"description":"FLOW_RUN_NOT_FOUND - no such run, or a run whose flow you cannot see (the same answer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/runs/{runId}/interactions/{interactionId}/submissions":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"deprecated":true,"summary":"Answer one open Studio test form (deprecated flow-less address)","description":"DEPRECATED - use `/api/v1/flows/{id}/runs/{runId}/interactions…`. Served for one release for a Studio loaded before the move.","parameters":[{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"interactionId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"values":{"nullable":true},"expectedVersion":{"type":"integer","minimum":0}},"required":["expectedVersion"]}}}},"responses":{"200":{"description":"Accepted, re-asked, or closed.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"FLOW_RUN_NOT_FOUND - no such run, or a run whose flow you cannot see (the same answer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/runs/{runId}/interactions/{interactionId}/preview":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"deprecated":true,"summary":"Read one bounded Studio ViewPort preview (deprecated flow-less address)","description":"DEPRECATED - use `/api/v1/flows/{id}/runs/{runId}/interactions…`. Served for one release for a Studio loaded before the move.","parameters":[{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"interactionId","in":"path"}],"responses":{"200":{"description":"The inert preview.","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"404":{"description":"FLOW_RUN_NOT_FOUND - no such run, or a run whose flow you cannot see (the same answer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/runs/{runId}/interactions/{interactionId}/file":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"deprecated":true,"summary":"Download one Studio ViewPort file (deprecated flow-less address)","description":"DEPRECATED - use `/api/v1/flows/{id}/runs/{runId}/interactions…`. Served for one release for a Studio loaded before the move.","parameters":[{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"},{"schema":{"type":"string"},"required":true,"name":"interactionId","in":"path"}],"responses":{"200":{"description":"Attachment bytes."},"404":{"description":"FLOW_RUN_NOT_FOUND - no such run, or a run whose flow you cannot see (the same answer).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"A flow's recent runs","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Runs.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"runs":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","runs"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"One run of this flow (+ step trail + what it received)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"The run, its step trail and `received` (FAI-1422).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"$ref":"#/components/schemas/FlowRunDetail"}},"required":["success","run"]}}}},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Reconnectable SSE of the run’s events","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"text/event-stream of run events."},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}/cancel":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Cancel an in-flight run of this flow","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"200":{"description":"Cancelling - the run as it now stands.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"$ref":"#/components/schemas/FlowRunDetail"}},"required":["success","run"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"RUN_TERMINAL - the run has already finished.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/runs/{runId}/retry":{"post":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Re-run the flow of this run","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"runId","in":"path"}],"responses":{"202":{"description":"The new run.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","run"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Flow’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"FLOW_NOT_FOUND (the flow is not visible to you) or RUN_NOT_FOUND (no such run of THIS flow - a run of another flow answers the same).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/webhook":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Webhook config for this flow","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Webhook config.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"webhook":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","webhook"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/webhook/{token}":{"post":{"tags":["Flows"],"summary":"PUBLIC webhook ingestion (unguessable token + HMAC signature + idempotency)","description":"The body becomes the run's trigger: JSON as itself, a form (`application/x-www-form-urlencoded`) as an object of its fields (a repeated field as a list), text or XML as `{ text, contentType }`, any other type as `{}`. At most 2 MB. `X-Flow-Signature: sha256=<hex>` is an HMAC-SHA256, made with the signing secret, of the exact bytes sent.","security":[],"parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"token","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}}},"text/plain":{"schema":{"type":"string"}},"application/xml":{"schema":{"type":"string"}}}},"responses":{"202":{"description":"The queued run."},"401":{"description":"Invalid or missing signature."},"404":{"description":"No matching webhook trigger."}}}},"/api/v1/flows/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"A flow's run-health stats","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/flows/{id}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["Flows"],"summary":"Publish/version history (read-only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","versions"]}}}}}}},"/api/v1/solutions/{id}/flows":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"List the flows this Solution OWNS","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Flows.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flows":{"type":"array","items":{"$ref":"#/components/schemas/Flow"}},"total":{"type":"number"}},"required":["success","flows","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Create a flow in this Solution","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFlowInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flow":{"$ref":"#/components/schemas/Flow"}},"required":["success","flow"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_FLOW_NAME — this Solution already has a flow with that name (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/solutions/{id}/flows/import":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Create a flow from a graph (import / template)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFlowInput"}}}},"responses":{"201":{"description":"Created (+ per-node validation errors).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flow":{"$ref":"#/components/schemas/Flow"},"errors":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","flow","errors"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_FLOW_NAME — this Solution already has a flow with the imported name (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/bots":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Global list of every Bot across Solutions - cursor-paginated, or searchable/filterable/offset-paginated when `offset` is sent","parameters":[{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string"},"required":false,"name":"solutionId","in":"query"},{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"}],"responses":{"200":{"description":"The bots. Sending `offset` selects the offset paginator: the response then carries `total`/`counts` and no `nextCursor`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bots":{"type":"array","items":{"$ref":"#/components/schemas/BotListItem"}},"nextCursor":{"type":"string","nullable":true},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","bots"]}}}}}}},"/api/v1/bots/options":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"What a create form may offer — the channels and registration modes, with availability","description":"Every channel and every registration mode the platform MODELS, each marked available or not for this build and this deployment. An unavailable entry carries a plain-language `reason` a UI renders verbatim on the disabled tile — the same sentence the create path refuses with, so the two cannot disagree. `managed` is the one entry whose answer depends on configuration: it is unavailable, naming the missing setting, until this deployment has a usable registration driver. `graphPublish.configured` is a THIRD, orthogonal fact — whether this deployment can publish a bot straight into a customer's own Teams catalog at all; whether a particular workspace has consented is GET /api/v1/tenants/{id}/teams-graph.","responses":{"200":{"description":"The offerable channels and modes.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"options":{"$ref":"#/components/schemas/BotOptions"}},"required":["success","options"]}}}}}}},"/api/v1/bots/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Get one Bot (no credential, no token — just the two *Configured booleans)","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The bot.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bot":{"$ref":"#/components/schemas/Bot"}},"required":["success","bot"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Update a Bot (credential write-only; config is a PATCH)","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBotInput"}}}},"responses":{"200":{"description":"The updated bot.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bot":{"$ref":"#/components/schemas/Bot"}},"required":["success","bot"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CROSS_SOLUTION — the agent belongs to another Solution. DUPLICATE_BOT_NAME — a rename onto a name another bot in the same Solution already uses (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Delete a Bot (its conversations and delivery trail cascade)","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/bots/{id}/icons/{slot}":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Upload an app-package icon (multipart, field `file`)","description":"A PNG of EXACTLY the slot's size — 192x192 for `color`, 32x32 for `outline`. The size is refused here rather than at publish time, because Microsoft validates it when the package is installed. Replacing an icon mints the next byte VERSION of one file, so the previous icon stays in the store's history.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["color","outline"],"description":"Which icon: `color` (192x192) or `outline` (32x32, transparent)."},"required":true,"name":"slot","in":"path"}],"responses":{"200":{"description":"Stored, and the bot now points at it.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bot":{"$ref":"#/components/schemas/Bot"}},"required":["success","bot"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"BOT_ICON_NOT_PNG / BOT_ICON_UNREADABLE / BOT_ICON_WRONG_SIZE — the file is not a PNG of the required size.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Read a stored app-package icon (for display)","description":"The PNG itself, served `inline` with the type neutralised and `nosniff`. **204** when the bot has no custom icon in that slot — the package uses the platform default, which is an answer rather than a failure. Exists because the upload's own preview is local to one page load: without it the Settings tile could not show an icon it had just accepted.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["color","outline"],"description":"Which icon: `color` (192x192) or `outline` (32x32, transparent)."},"required":true,"name":"slot","in":"path"}],"responses":{"200":{"description":"The icon bytes."},"204":{"description":"No custom icon in this slot; the platform default is used."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Stop using an app-package icon (falls back to the platform default)","description":"The bytes are LEFT in the store: the reference is what governs the package, and the file's version history is the record of what the icon used to be.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["color","outline"],"description":"Which icon: `color` (192x192) or `outline` (32x32, transparent)."},"required":true,"name":"slot","in":"path"}],"responses":{"200":{"description":"Cleared.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bot":{"$ref":"#/components/schemas/Bot"}},"required":["success","bot"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/bots/{id}/status":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Move the lifecycle. Going `live` runs the full gate","description":"Going `live` requires: the bound agent published AND enabled (422 BOT_AGENT_NOT_PUBLISHED), its PUBLISHED definition not collecting forms (422 BOT_AGENT_FORMS_UNSUPPORTED), and credentials present (422 BOT_CREDENTIALS_MISSING). Every transition AWAY from traffic is unconditional, so a bot whose agent broke is never trapped live. A go-live also answers `warnings` — advisory notes about what the bound agent exposes on a chat channel, gathered from its own publish lint AFTER the status is written. They never refuse anything, and the array is empty for every other transition.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetBotStatusInput"}}}},"responses":{"200":{"description":"The bot, plus any advisory go-live warnings (empty for a non-live transition).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bot":{"$ref":"#/components/schemas/Bot"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/BotGoLiveWarning"}}},"required":["success","bot","warnings"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"The go-live gate refused — the code names which check.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/bots/{id}/verify":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Prove the platform credentials, leg by leg (advances draft → verified on success)","description":"Always 200 when the bot and its credential exist: `{ ok: false, checks }` is the ANSWER, not a failed request. Never touches `live` or `disabled`.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The verification report and the (possibly advanced) bot.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bot":{"$ref":"#/components/schemas/Bot"},"verification":{"$ref":"#/components/schemas/BotVerification"}},"required":["success","bot","verification"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"BOT_CREDENTIALS_MISSING — nothing to verify yet.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/bots/{id}/test-send":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Send a fixed probe message to one real conversation","description":"Outreach, so consent applies: a conversation that opted out answers 409 CHANNEL_CONSENT_REVOKED. With no conversation captured yet, 422 BOT_NO_CONVERSATIONS. Never fans out.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BotTestSendInput"}}}},"responses":{"200":{"description":"What the platform said.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"result":{"$ref":"#/components/schemas/BotTestSendResult"}},"required":["success","result"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CHANNEL_CONSENT_REVOKED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"422":{"description":"BOT_NO_CONVERSATIONS or BOT_CREDENTIALS_MISSING.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/bots/{id}/provision":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Re-run a managed bot's registration provisioning (the retry affordance)","description":"Managed bots only — a bot whose registration the customer owns answers 422 INVALID_BOT, because there is nothing for Flexday.ai to provision. Answers the bot AS IT STANDS and starts a durable job; poll `registrationStatus` (provisioning → ready | error) rather than reading the response as a result. Safe to press twice: at most one provisioning job is ever live per bot. A deployment with no usable registration driver answers 503 BOT_REGISTRATION_UNCONFIGURED naming the missing setting.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The bot; provisioning has been asked for.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bot":{"$ref":"#/components/schemas/Bot"}},"required":["success","bot"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"INVALID_BOT — this bot is not a managed one.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"503":{"description":"BOT_REGISTRATION_UNCONFIGURED — this deployment cannot create registrations.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/bots/{id}/teams-publish":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Start publishing this bot into the workspace's own Microsoft Teams catalog","description":"Answers a Microsoft sign-in URL for the browser to navigate to; the publish itself happens when the administrator comes back. **It does NOT publish, and cannot**: `POST /appCatalogs/teamsApps` supports no application permission (Microsoft documents Application as 'Not supported' in both v1.0 and beta), so the request has to carry a token belonging to a Teams or Global administrator of that organisation. Flexday.ai therefore sends them to Microsoft, exchanges the authorization code for a DELEGATED token, publishes with it, and discards it — `offline_access` is not requested, so no Microsoft credential is ever stored and an admin does the round trip each time. Idempotent in the way that matters: the FIRST completed publish adds the app and records its catalog id on the bot, and every later one UPDATES that entry in place, because a second entry would leave everyone who had already installed the bot talking to the old one. A deployment with no Graph application answers 503 TEAMS_GRAPH_UNCONFIGURED (only an operator can fix that); a bot with no app id answers 422 BOT_CREDENTIALS_MISSING. Connecting Microsoft 365 is NO LONGER required — pressing it only means Microsoft asks the admin for a sign-in instead of a consent. The manual org-catalog install path is unaffected and remains first-class.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The Microsoft sign-in URL to navigate to. Nothing has been published yet.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"authorizeUrl":{"type":"string"}},"required":["success","authorizeUrl"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"TEAMS_APP_ALREADY_IN_CATALOG — an app for this bot is already in the organisation's catalog and Flexday.ai did not put it there. Remove it in the Teams admin center, or keep managing it there; nothing is overwritten.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"422":{"description":"BOT_CREDENTIALS_MISSING (no app id yet) · INVALID_BOT (not a Teams bot). The package and consent refusals (TEAMS_APP_VALIDATION_FAILED, TEAMS_GRAPH_CONSENT_MISSING) can no longer surface here — they happen in the callback, where they arrive as ?teamsPublish=failed and are logged for an operator rather than rendered to a browser.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"503":{"description":"TEAMS_GRAPH_UNCONFIGURED — this deployment has no Microsoft Graph application · TEAMS_APP_PUBLISH_FAILED — Microsoft answered a 5xx or could not be reached.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/bots/{id}/webhook-token":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Rotate the webhook token (the predecessor stops working immediately)","description":"The recovery path for a token that was lost or leaked, and the only way to reach a manifest download after the reveal-once page has gone. For a bot whose registration the customer owns (byo) the new token is shown ONCE. For a MANAGED bot the platform re-points the Microsoft registration at the new endpoint FIRST and commits the new token only if that succeeds — so a failure leaves the old token working — and the response carries no token at all: nobody but the platform holds a managed bot's address, and its manifest download asks for none.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The new token and endpoint URL.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"created":{"$ref":"#/components/schemas/CreatedBot"}},"required":["success","created"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Bot’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/bots/{id}/manifest":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"The platform's installable app package (a zip), always as an attachment","description":"Requires the bot's own webhook token in `X-Webhook-Token`: the stored value is a one-way hash, so the package's endpoint URL cannot be rebuilt from the row. A wrong token and an absent one answer the SAME 401, so the route is not an oracle for guessing it.","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The bot's webhook token, shown once at create time. Required: the stored value is a one-way hash, so the package's endpoint URL cannot be rebuilt without it. Rotate the token if it was lost."},"required":false,"name":"X-Webhook-Token","in":"header"}],"responses":{"200":{"description":"The app package (application/zip, Content-Disposition: attachment)."},"401":{"description":"BOT_WEBHOOK_TOKEN_INVALID — present the token in X-Webhook-Token.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"BOT_CREDENTIALS_MISSING or CHANNEL_HAS_NO_MANIFEST.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/bots/{id}/conversations":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"One bot's captured conversations (its reach), cursor-paginated","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Deprecated - prefer `cursor`.","deprecated":true},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"The conversations.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"conversations":{"type":"array","items":{"$ref":"#/components/schemas/BotConversation"}},"nextCursor":{"type":"string","nullable":true}},"required":["success","conversations","nextCursor"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/bots/{id}/deliveries":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"One bot's outbound delivery trail, newest first","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Deprecated - prefer `cursor`.","deprecated":true},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Restrict to one conversation."},"required":false,"name":"conversationId","in":"query"},{"schema":{"type":"string","enum":["flow","agent","reply","test"],"description":"Restrict to who asked for the message."},"required":false,"name":"source","in":"query"},{"schema":{"type":"string","enum":["sent","delivered","read","failed"],"description":"Restrict to what became of the message."},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"The deliveries.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/BotDelivery"}},"nextCursor":{"type":"string","nullable":true}},"required":["success","deliveries","nextCursor"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/bots":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"The Bots this Solution owns","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The bots.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bots":{"type":"array","items":{"$ref":"#/components/schemas/Bot"}},"total":{"type":"number"}},"required":["success","bots","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Create a Bot owned by this Solution (the canonical create — owner from the path)","description":"A `byo` create carries the webhook token ONCE. A `managed` create carries no token at all: it starts a durable provisioning job that creates the Microsoft registration, points it at the webhook itself and seals the minted secret, so poll `registrationStatus` (provisioning → ready | error) instead of showing a reveal panel — and supply no `credentials` (nor `config.appId`/`config.entraTenantId`), which is refused BY NAME with 400 INVALID_BOT. A channel this build cannot serve answers 501 CHANNEL_KIND_NOT_AVAILABLE naming it; a mode it cannot serve answers 501 BOT_MODE_NOT_AVAILABLE; a deployment with no registration driver answers 503 BOT_REGISTRATION_UNCONFIGURED naming the missing setting; an agent from another Solution answers 409 CROSS_SOLUTION; a name this Solution already uses (case-insensitive) answers 409 DUPLICATE_BOT_NAME.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBotInput"}}}},"responses":{"201":{"description":"The created bot — plus its token and endpoint URL for a byo create, and neither for a managed one.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"created":{"$ref":"#/components/schemas/CreatedBot"}},"required":["success","created"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CROSS_SOLUTION — that agent belongs to another Solution. DUPLICATE_BOT_NAME — this Solution already has a bot with that name (case-insensitive); carries `duplicateOfId`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"501":{"description":"CHANNEL_KIND_NOT_AVAILABLE or BOT_MODE_NOT_AVAILABLE — that channel or registration mode is coming soon.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"503":{"description":"BOT_REGISTRATION_UNCONFIGURED — managed was asked for and this deployment cannot create registrations.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/tenants/{id}/teams-graph":{"get":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"This workspace's Microsoft 365 connection (the org-catalog publishing route)","description":"TWO independent booleans. `configured` says whether this DEPLOYMENT has a Microsoft Graph application at all — only an operator can change that. `connected` says whether one of THIS WORKSPACE's administrators has consented — its own admins can change that. A UI needs both, or it offers a Connect button that can only ever 503, or hides the feature from a workspace that has simply not connected yet. Readable by any member; connecting and disconnecting are admin+.","parameters":[{"schema":{"type":"string","description":"The workspace's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The connection state.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"teamsGraph":{"$ref":"#/components/schemas/TeamsGraphStatus"}},"required":["success","teamsGraph"]}}}},"403":{"description":"NOT_A_TENANT_MEMBER or INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Disconnect Microsoft 365 (idempotent; revokes our half)","description":"Stops Flexday.ai publishing into the organisation's catalog. 200 whether or not there was a live connection — this is a state to reach, not an event that can fail to happen. It is HALF a disconnection and says so: `revokedInDirectory: false`, because the standing grant inside the customer's own directory is removed by their administrator in the Microsoft 365 admin center. Admin+ (`members:manage`).","parameters":[{"schema":{"type":"string","description":"The workspace's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Disconnected.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"revokedInDirectory":{"type":"boolean"}},"required":["success","revokedInDirectory"]}}}},"403":{"description":"INSUFFICIENT_ROLE — disconnecting is admin+.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenants/{id}/teams-graph/connect":{"post":{"security":[{"bearerAuth":[]}],"tags":["Bot"],"summary":"Start the one-time Microsoft 365 admin consent — returns a URL to navigate to","description":"Answers the Microsoft admin-consent URL and WRITES NOTHING: an administrator who opens the consent screen and closes it has not connected anything. The URL carries a signed, 15-minute `state` naming this workspace and the administrator who asked; Microsoft redirects back to GET /api/v1/teams-graph/callback, which is where the connection is actually recorded. Admin+ (`members:manage`). A deployment with no Graph application answers 503 TEAMS_GRAPH_UNCONFIGURED naming the settings — and the manual org-catalog install path is unaffected either way.","parameters":[{"schema":{"type":"string","description":"The workspace's UUID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The Microsoft admin-consent URL to send the administrator to.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"consentUrl":{"type":"string"}},"required":["success","consentUrl"]}}}},"403":{"description":"INSUFFICIENT_ROLE — connecting is admin+.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"TEAMS_GRAPH_UNCONFIGURED — this deployment has no Microsoft Graph application.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/teams-graph/callback":{"get":{"tags":["Bot"],"summary":"PUBLIC — where Microsoft returns an administrator after admin consent","description":"Never renders HTML, never echoes a query parameter, and always answers a 302. The signed `state` is the ONLY thing it trusts: it is verified (signature + expiry) BEFORE any other parameter is read, and every refusal — missing, forged, expired, unknown workspace, malformed directory id — is the SAME neutral redirect, so the route is not an oracle. On success it records the workspace's connection under the tenant scope the state names, attributed to the administrator the state names, and redirects to that workspace's Bots page. `error_description` is accepted and deliberately never read.","security":[],"parameters":[{"schema":{"type":"string","description":"The signed state minted by POST /tenants/{id}/teams-graph/connect (an org-wide consent) or by POST /bots/{id}/teams-publish (a single publish). The ONLY field this route trusts, and its own domain prefix is what decides which round trip is being completed — never the presence of `code`, which any caller can supply."},"required":false,"name":"state","in":"query"},{"schema":{"type":"string","description":"The authorization code, on the PUBLISH round trip. Exchanged server-side for a delegated Graph token that is used once and never stored."},"required":false,"name":"code","in":"query"},{"schema":{"type":"string","description":"The CUSTOMER's Microsoft directory id, echoed back by Microsoft on success."},"required":false,"name":"tenant","in":"query"},{"schema":{"type":"string","description":"'True' on success. Accepted and deliberately not used as the decider — the state and the directory id are what a success needs."},"required":false,"name":"admin_consent","in":"query"},{"schema":{"type":"string","description":"Present when the administrator declined or Microsoft refused."},"required":false,"name":"error","in":"query"},{"schema":{"type":"string","description":"Provider-authored free text. Accepted so it is not a validation failure, then deliberately never read, never logged back to the caller, and never forwarded into the redirect."},"required":false,"name":"error_description","in":"query"}],"responses":{"302":{"description":"Redirect to the workspace's Bots page (?teamsGraph=connected|declined) or, when nothing could be trusted, to the studio root (?teamsGraph=error)."}}}},"/api/v1/bots/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-Bots combined stats (the collection KPI strip)","responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"$ref":"#/components/schemas/BotsStats"}},"required":["success","stats"]}}}}}}},"/api/v1/bots/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One Bot's stats — reach, recent outbound, last contact","parameters":[{"schema":{"type":"string","description":"The Bot's ULID.","example":"01JL0X…"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"$ref":"#/components/schemas/BotStats"}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"List all FactBases - searchable, filterable, paginated","parameters":[{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"}],"responses":{"200":{"description":"FactBases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBases":{"type":"array","items":{"$ref":"#/components/schemas/FactBase"}},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","factBases","total","limit","offset","counts"]}}}}}}},"/api/v1/fact-bases/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Get one FactBase","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The FactBase.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBase":{"$ref":"#/components/schemas/FactBase"}},"required":["success","factBase"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Update FactBase name/description","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBase":{"$ref":"#/components/schemas/FactBase"}},"required":["success","factBase"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Delete a FactBase (+ its dst_ schema)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/base-schema":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"The mechanical base schema","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Base schema.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"baseSchema":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","baseSchema"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/row-counts":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Live per-table row counts","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Row counts.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"rowCounts":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","rowCounts"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/value-count":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Live rows still holding one column value (enum-removal preflight)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"table","in":"query"},{"schema":{"type":"string"},"required":true,"name":"column","in":"query"},{"schema":{"type":"string"},"required":false,"name":"value","in":"query"}],"responses":{"200":{"description":"The count.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"table":{"type":"string"},"column":{"type":"string"},"value":{"type":"string"},"rows":{"type":"number","nullable":true,"description":"Matching live rows, or null when nothing could be counted."}},"required":["success","table","column","value","rows"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/limits":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Ingest limits a client must respect","responses":{"200":{"description":"Limits.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"limits":{"$ref":"#/components/schemas/FactBaseIngestLimits"}},"required":["success","limits"]}}}}}}},"/api/v1/fact-bases/{id}/sample-data":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Attach / replace sample data (multipart file, or inline content)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}},"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","description":"The sample-data JSON, as text."}},"required":["content"]}}}},"responses":{"200":{"description":"Stored — `factBase.sourceFile` names the file it now lives in.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBase":{"$ref":"#/components/schemas/FactBase"},"entities":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","factBase","entities"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_NOT_SERVABLE — the stored bytes are quarantined.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"413":{"description":"SAMPLE_DATA_TOO_LARGE / BODY_TOO_LARGE — the message names the limit AND the size that arrived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/fact-bases/{id}/file-store":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"The FactBase's managed File Store (created if absent; idempotent)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The managed store.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStore":{"$ref":"#/components/schemas/FactBaseFileStore"}},"required":["success","fileStore"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/sample-data/from-file":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Use a file already in this Solution as the sample data (no copy)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FactBaseSampleDataFromFileInput"}}}},"responses":{"200":{"description":"Linked — `factBase.sourceFile` describes it.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBase":{"$ref":"#/components/schemas/FactBase"},"entities":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","factBase","entities"]}}}},"400":{"description":"INVALID_FILE_ID / INVALID_JSON / INVALID_SAMPLE_SHAPE — it must BE sample data.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"404":{"description":"FACT_BASE_NOT_FOUND / FILE_NOT_FOUND","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"409":{"description":"CROSS_SOLUTION / MANAGED_STORE_NOT_LINKABLE (the file lives in a store the platform manages for another resource) / FILE_NOT_SERVABLE","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"422":{"description":"SAMPLE_DATA_TOO_LARGE — over the published ingest cap.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/fact-bases/{id}/definition":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"The LLM-authored definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Definition.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"definition":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}}},"required":["success","definition"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Save the definition","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"definition":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","definition"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Generate the definition synchronously","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Generated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"definition":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","definition"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/definition/ddl":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Preview the provisioning DDL","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"DDL.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"ddl":{"type":"string"}},"required":["success","ddl"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/definition/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Definition-inference job status","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string"}},"required":["success","status"]}}}}}}},"/api/v1/fact-bases/{id}/definition/start":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Start definition inference (job)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"}},"required":["success","jobId"]}}}}}}},"/api/v1/fact-bases/{id}/definition/stop":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Stop definition inference","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stopping.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/fact-bases/{id}/definition/answer-questions":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Answer open definition questions (applies patches)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"definition":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","definition"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/export":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Export a portable FactBase bundle (no ids, no dst_ schema name, no secrets)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The bundle.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"export":{"$ref":"#/components/schemas/FactBaseExport"}},"required":["success","export"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/validation":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"The structured definition lint (errors block provisioning)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The verdict — always 200; a definition with problems is not a failed request.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"validation":{"$ref":"#/components/schemas/DefinitionValidationResult"}},"required":["success","validation"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/provision":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Provision the dst_ schema (structure only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Opt-in exactly-once key; the same key replays the first response."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"confirmReprovision":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Provisioned.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"409":{"description":"ALREADY_PROVISIONED / IDEMPOTENCY_IN_PROGRESS","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"422":{"description":"DEFINITION_HAS_ERRORS (the lint's `error` issues, echoed as `issues`) / IDEMPOTENCY_KEY_REUSED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"issues":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","error"]}}}}}}},"/api/v1/fact-bases/{id}/load":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Load data (append|replace) - multipart file or inline content; dynamic rows validated at runtime","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["append","replace"]},"identity":{"type":"string","enum":["restart","continue"],"description":"On a replace: whether the emptied tables' identity sequences restart from 1. Defaults to 'restart'."},"file":{"type":"string","format":"binary"}}}},"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["append","replace"]},"identity":{"type":"string","enum":["restart","continue"],"description":"On a replace: whether the emptied tables' identity sequences restart from 1. Defaults to 'restart'."},"content":{"type":"string"},"data":{"nullable":true}}}}}},"responses":{"200":{"description":"Loaded — `loaded` carries the row counts, the identity clause that ran, and the resulting sequence positions. `sampleDataStored` is present only when the request carried a fresh upload: FALSE (with `sampleDataError`) means the rows WERE loaded but the file could not be kept as the sample data — a retry would load them twice.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"mode":{"type":"string"},"loaded":{"$ref":"#/components/schemas/FactBaseLoadResult"},"sampleDataStored":{"type":"boolean"},"sampleDataError":{"type":"string"}},"required":["success","mode","loaded"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"SAMPLE_DATA_TOO_LARGE / BODY_TOO_LARGE — the message names the limit AND the size that arrived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/attachment-mapping":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Propose a column mapping from an uploaded spreadsheet onto this FactBase's schema (background job; writes nothing)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string"}},"required":["success","status"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"SAMPLE_DATA_TOO_LARGE / BODY_TOO_LARGE — the message names the limit AND the size that arrived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/fact-bases/{id}/attachment-mapping/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Poll the propose job (same {idle,running,done,error} vocabulary as .../definition/status)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string"},"jobId":{"type":"string","nullable":true},"jobError":{"type":"string","nullable":true},"proposal":{"$ref":"#/components/schemas/AttachmentMappingProposal"}},"required":["success","status","jobId","jobError","proposal"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/attachment-mapping/confirm":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Apply a caller-confirmed subset of a mapping proposal (wipes then loads only the tables it touches)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmAttachmentMappingInput"}}}},"responses":{"200":{"description":"Loaded.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"loaded":{"$ref":"#/components/schemas/FactBaseLoadResult"}},"required":["success","loaded"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/data/clear":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Empty tables, keeping the schema (preflight, then echo the counts back)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FactBaseClearDataInput"}}}},"responses":{"200":{"description":"The plan (cleared:false) or the result (cleared:true, carrying the resulting sequence positions).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"cleared":{"type":"boolean"},"plan":{"$ref":"#/components/schemas/FactBaseClearDataPlan"},"sequences":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/FactBaseSequencePosition"}}},"required":["success","cleared","plan"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CLEAR_COUNTS_CHANGED — the rows moved since the plan was read; the fresh plan rides along.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"plan":{"$ref":"#/components/schemas/FactBaseClearDataPlan"}},"required":["success","error"]}}}},"422":{"description":"TRUNCATE_SET_INCOMPLETE (with `blockedBy`) / TRUNCATE_TABLE_UNKNOWN / TABLE_NOT_PROVISIONED / CLEAR_SET_EMPTY","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"blockedBy":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","error"]}}}}}}},"/api/v1/fact-bases/{id}/migrate/plan":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Plan a keep-data schema migration (diff → minimal DDL)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"The plan.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"plan":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","plan"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/migrate/apply":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Apply the migration (one transaction)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/queries":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"The FactBase's saved-query catalog","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Deprecated - prefer `cursor`.","deprecated":true},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Queries.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"queries":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","queries"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Save a query","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"201":{"description":"Saved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"query":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","query"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/queries/{query}":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"One saved query (by name or id)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Saved-query name (query_id) or ULID row id."},"required":true,"name":"query","in":"path"}],"responses":{"200":{"description":"The query.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"query":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","query"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Update a saved query","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Saved-query name (query_id) or ULID row id."},"required":true,"name":"query","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"query":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","query"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Delete a saved query","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Saved-query name (query_id) or ULID row id."},"required":true,"name":"query","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/queries/{query}/execute":{"post":{"security":[{"bearerAuth":[]}],"tags":["Runtime Query"],"summary":"Execute a saved query (static envelope + runtime-validated dynamic params)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Saved-query name (query_id) or ULID row id."},"required":true,"name":"query","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteQueryInput"}}}},"responses":{"200":{"description":"The query result envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteQueryResult"}}}},"400":{"description":"A dynamic-param error (e.g. MISSING_PARAM).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteQueryResult"}}}},"404":{"description":"UNKNOWN_QUERY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteQueryResult"}}}}}}},"/api/v1/fact-bases/{id}/roles":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Roles + their grant matrix + sync status","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Roles.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"roles":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","roles"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Create a custom role","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"role":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","role"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/roles/{roleId}":{"delete":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Delete a custom role","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"roleId","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"409":{"description":"ROLE_PROTECTED","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/fact-bases/{id}/roles/{roleId}/grants":{"put":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Replace a role's grant matrix","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"roleId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"role":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","role"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/roles/reconcile":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Re-sync every role to Postgres now","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Reconciled.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"roles":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","roles"]}}}}}}},"/api/v1/fact-bases/{id}/roles/validate-query":{"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Check a role can run a query (warnings)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Validation.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/fact-bases/{id}/rls-policies":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"List RLS policies","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Policies.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"policies":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","policies"]}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Create an RLS policy (+ reconcile)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"policy":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","policy"]}}}}}}},"/api/v1/fact-bases/{id}/rls-policies/{policyId}":{"delete":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Delete an RLS policy (+ reconcile)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"policyId","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/fact-bases/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-FactBases stats","responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/fact-bases/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One FactBase's stats","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/{id}/stats/query-performance":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"Runtime SQL-latency telemetry","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Query performance.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/fact-bases/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-FactBases usage","parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/fact-bases/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One FactBase's usage","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/fact-bases/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One FactBase's AI-operation history","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}}}}},"/api/v1/fact-bases/{id}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["FactBase"],"summary":"Provision/version history (read-only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","versions"]}}}}}}},"/api/v1/solutions/{id}/chat":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"The builder chat transcript","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Transcript.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/BuilderChatMessage"}}},"required":["success","messages"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Start a build/refine turn (detached job)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Opt-in exactly-once key; the same key replays the first response."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderChatInput"}}}},"responses":{"200":{"description":"The started job.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string","nullable":true},"status":{"type":"string"},"alreadyRunning":{"type":"boolean"}},"required":["success","jobId","status"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"IDEMPOTENCY_IN_PROGRESS - a request with this key is still processing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"IDEMPOTENCY_KEY_REUSED - key already used with a different body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/chat/reset":{"post":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Reset the builder conversation","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Reset.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/chat/attachments":{"post":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Upload chat attachments (multipart, up to 10)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"files":{"type":"array","items":{"nullable":true}}}}}}},"responses":{"200":{"description":"The stored attachments.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","attachments"]}}}}}}},"/api/v1/solutions/{id}/chat/attachments/{attachmentId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Fetch a stored chat attachment","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"}],"responses":{"200":{"description":"The attachment bytes."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/builder/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"How full the builder's memory is, and what the builder has cost","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"usage":{"$ref":"#/components/schemas/BuilderUsage"}},"required":["success","usage"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/brief":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"The Solution's pinned brief and the builder's notes","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The brief and the notes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderBriefResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Set the pinned brief and/or the builder's notes (an omitted field is left as it is)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderBriefInput"}}}},"responses":{"200":{"description":"The brief and the notes as saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderBriefResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"BRIEF_TOO_LONG - the brief or the notes is longer than 20,000 characters; nothing was saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/builder/simulated":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"What the builder last declared is still a placeholder in this Solution","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The current declaration.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"declaration":{"$ref":"#/components/schemas/BuilderSimulatedDeclaration"}},"required":["success","declaration"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/build/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Latest build job status","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string","nullable":true}},"required":["success","status"]}}}}}}},"/api/v1/solutions/{id}/build/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Reconnectable SSE of build events (?since=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"text/event-stream of build events."}}}},"/api/v1/solutions/{id}/build/stop":{"post":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Cooperatively cancel the running build","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stopping.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/solutions/{id}/email/settings":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"This Solution's email governance","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Settings.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"settings":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","settings"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Update email governance","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"settings":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","settings"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/email/test-send":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Send one email now (Platform or a connection)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"200":{"description":"Send result.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"result":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","result"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/fact-bases":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"List the FactBases this Solution OWNS","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"FactBases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBases":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","factBases","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Create a FactBase owned by this Solution (multipart file, or inline content)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"file":{"type":"string","format":"binary"}},"required":["name"]}},"application/json":{"schema":{"$ref":"#/components/schemas/CreateFactBaseInput"}}}},"responses":{"200":{"description":"Created (FactBase + inferred entities).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"SAMPLE_DATA_TOO_LARGE / BODY_TOO_LARGE — the message names the limit AND the size that arrived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/solutions/{id}/export/plan":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"What a Solution export would include and cost","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"An existing File Store to price against, instead of the resolved default."},"required":false,"name":"destinationStoreId","in":"query"}],"responses":{"200":{"description":"Plan.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"types":{"type":"array","items":{"$ref":"#/components/schemas/SolutionExportPlanType"}},"destinations":{"type":"array","items":{"$ref":"#/components/schemas/SolutionExportDestination"}},"destinationId":{"type":"string","nullable":true},"managedStoreCount":{"type":"number"},"capBytes":{"type":"number"},"estimatedBytesFromPreviousExports":{"type":"number"},"deletedFiles":{"type":"array","items":{"$ref":"#/components/schemas/SolutionExportDeletedFile"}},"deletedFileCount":{"type":"number"}},"required":["success","types","destinations","destinationId","managedStoreCount","capBytes","estimatedBytesFromPreviousExports","deletedFiles","deletedFileCount"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/export":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Start a Solution export (detached job)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SolutionExportRequest"}}}},"responses":{"202":{"description":"Started (or reattached to a running export).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"},"exportId":{"type":"string"}},"required":["success","jobId","exportId"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/export/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"The latest Solution-export job and its event cursor","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"job":{"$ref":"#/components/schemas/SolutionExportJob"},"latestEventId":{"type":"number"}},"required":["success","job","latestEventId"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/export/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Reconnectable SSE of the latest Solution-export job (?since=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"text/event-stream of export job events."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/exports":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"The live export zips in this Solution's File Stores","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Exports.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"files":{"type":"array","items":{"$ref":"#/components/schemas/SolutionExportListItem"}}},"required":["success","files"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/exports/{fileId}/download":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Download one export zip","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"The zip bytes."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/exports/{fileId}":{"delete":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Delete one export zip","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/import/staging":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Mint a direct-to-storage transfer target for a large bundle","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SolutionImportStagingInput"}}}},"responses":{"201":{"description":"Staged.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"staging":{"$ref":"#/components/schemas/SolutionImportStagingPlan"}},"required":["success","staging"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/import/staging/{importId}/complete":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Finish a staged upload — the stored object is re-verified against what was declared","parameters":[{"schema":{"type":"string"},"required":true,"name":"importId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SolutionImportStagingCompleteInput"}}}},"responses":{"200":{"description":"Ready.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/import":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Import a Solution bundle as a new Solution (detached job)","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"data":{"type":"string","description":"The data selection, as a JSON-encoded string — a multipart field is always text."}}}},"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SolutionImportByIdInput"},{"$ref":"#/components/schemas/SolutionImportFromFileInput"}]}}}},"responses":{"202":{"description":"Started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string"},"importId":{"type":"string"}},"required":["success","jobId","importId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"SAMPLE_DATA_TOO_LARGE / BODY_TOO_LARGE — the message names the limit AND the size that arrived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/import/{importId}/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"The latest job for this import intake, its event cursor, and its report once done","parameters":[{"schema":{"type":"string"},"required":true,"name":"importId","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"job":{"$ref":"#/components/schemas/SolutionImportJob"},"latestEventId":{"type":"number"},"result":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}}},"required":["success","job","latestEventId","result"]}}}}}}},"/api/v1/solutions/import/{importId}/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Reconnectable SSE of the latest import job for this intake (?since=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"importId","in":"path"}],"responses":{"200":{"description":"text/event-stream of import job events."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/import/limits":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Ingest limits a client must respect","responses":{"200":{"description":"Limits.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"limits":{"$ref":"#/components/schemas/SolutionImportLimits"}},"required":["success","limits"]}}}}}}},"/api/v1/solutions/import/inspect":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"What a staged or File-Store Solution bundle carries, before committing to the import","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SolutionImportByIdInput"},{"$ref":"#/components/schemas/SolutionImportFromFileInput"}]}}}},"responses":{"200":{"description":"The bundle summary.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bundle":{"$ref":"#/components/schemas/SolutionBundleSummary"}},"required":["success","bundle"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/import/sources":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"The File Stores a Solution bundle may be imported from","responses":{"200":{"description":"Non-managed File Stores, newest first, plus how many managed ones were left out.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStores":{"type":"array","items":{"$ref":"#/components/schemas/SolutionImportSource"}},"managedStoreCount":{"type":"number"}},"required":["success","fileStores","managedStoreCount"]}}}}}}},"/api/v1/solutions/{id}/fact-bases/import":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Import a portable FactBase bundle into this Solution (unprovisioned)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}},"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"responses":{"201":{"description":"Imported.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBase":{"type":"object","additionalProperties":{"nullable":true}},"roles":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","factBase","roles"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"SAMPLE_DATA_TOO_LARGE / BODY_TOO_LARGE — the message names the limit AND the size that arrived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/gateways":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"List this Solution's Flex Gateways","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Gateways.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"apis":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","apis"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Create a Flex Gateway in this Solution","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGatewayInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"api":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","api"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/identities":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"List this Solution's named Identities","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Identities.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identities":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","identities"]}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Create a named Identity in this Solution","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIdentityInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identity":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","identity"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One solution's summary stats","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/stats/build-runs":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"Recent build history (from ai_usage)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Build runs.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"runs":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","runs","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/stats/usage-by-model":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"Per-model token/cost breakdown","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Usage by model.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One solution's usage report (all-in)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/solutions/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One solution's AI-operation history","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/file-stores":{"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Create a File Store owned by this Solution","parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFileStoreInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStore":{"$ref":"#/components/schemas/FileStore"}},"required":["success","fileStore"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"List this Solution's File Stores (cursor-paginated)","parameters":[{"schema":{"type":"string","description":"The owning Solution's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Deprecated - prefer `cursor`.","deprecated":true},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"File Stores.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStores":{"type":"array","items":{"$ref":"#/components/schemas/FileStoreListItem"}},"nextCursor":{"type":"string","nullable":true}},"required":["success","fileStores","nextCursor"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/file-stores":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"List all File Stores - cursor-paginated, or searchable/filterable/offset-paginated when `offset` is sent","parameters":[{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200,"description":"Page size. ABSENT MEANS UNBOUNDED — the whole list."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Case-insensitive substring over the resource's name, description and owner names."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","description":"Narrow to one status/kind pill. Omit (or send `all`) for every row."},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["template","solution"],"description":"Narrow to Template-owned or Solution-owned rows. Absent on lists with no owner dimension."},"required":false,"name":"owner","in":"query"},{"schema":{"type":"string","enum":["newest","oldest","name"],"description":"Default `newest` (most recently updated first)."},"required":false,"name":"sort","in":"query"}],"responses":{"200":{"description":"File Stores. Sending `offset` selects the offset paginator: the response then carries `total`/`counts`/`ownerCounts` and no `nextCursor`.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStores":{"type":"array","items":{"$ref":"#/components/schemas/FileStoreListItem"}},"nextCursor":{"type":"string","nullable":true},"total":{"type":"integer"},"limit":{"type":"integer","nullable":true},"offset":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"ownerCounts":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["success","fileStores"]}}}}}}},"/api/v1/file-stores/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Get one File Store","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The File Store.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStore":{"$ref":"#/components/schemas/FileStore"}},"required":["success","fileStore"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Update a File Store (name / description / policy settings)","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFileStoreInput"}}}},"responses":{"200":{"description":"The updated File Store.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStore":{"$ref":"#/components/schemas/FileStore"}},"required":["success","fileStore"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Delete a File Store + every file, version and byte it owns","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/file-stores/{id}/files":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"List a File Store's files (folder + search + cursor)","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Deprecated - prefer `cursor`.","deprecated":true},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Restrict to one folder label (exact match)."},"required":false,"name":"folder","in":"query"},{"schema":{"type":"string","description":"Case-insensitive name search."},"required":false,"name":"q","in":"query"}],"responses":{"200":{"description":"Files.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"files":{"type":"array","items":{"$ref":"#/components/schemas/File"}},"total":{"type":"number"},"nextCursor":{"type":"string","nullable":true}},"required":["success","files","total","nextCursor"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Upload a file (multipart) — a new file, or a new VERSION of the one at that path","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/UploadFileInput"}}}},"responses":{"201":{"description":"Stored. The scan job resolves the quarantine verdict asynchronously.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"file":{"$ref":"#/components/schemas/File"},"version":{"type":"number"},"jobId":{"type":"string"},"unchanged":{"type":"boolean","description":"Byte-identical content already sat at this path."}},"required":["success","file","version","unchanged"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"FILE_TOO_LARGE / FILE_TYPE_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/{id}/files/presign":{"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Request a direct-to-storage upload link for a large file","description":"Runs every policy check the buffered route runs (scanner requirement, size ceiling, media-type policy, storage quota), creates an UNSERVABLE file row, and mints a short-lived presigned target — one PUT, or a staged set of parts when the backend supports them. The bytes never transit this API. Finish with POST {id}/files/{fileId}/complete, which re-reads the stored object before the file becomes real.","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PresignUploadInput"}}}},"responses":{"201":{"description":"The upload plan.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"plan":{"$ref":"#/components/schemas/PresignedUploadPlan"}},"required":["success","plan"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"FILE_TOO_LARGE / FILE_TYPE_NOT_ALLOWED / TENANT_QUOTA_EXCEEDED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"503":{"description":"PRESIGN_UNSUPPORTED — this deployment’s storage backend cannot sign URLs.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/{id}/files/{fileId}/complete":{"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Finish a direct-to-storage upload (the server verifies what actually landed)","description":"Commits any staged parts, then re-reads the STORED object: its size must equal what was declared, its head bytes decide the media type (re-checked against the store’s policy), and its sha256 is computed end-to-end unless the object is past FILE_PRESIGN_VERIFY_SHA256_MAX_BYTES and a hash was declared. Only then is the row finalised and the malware scan enqueued — a file becomes servable after verification AND a clean verdict, never on the client’s word.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteUploadInput"}}}},"responses":{"200":{"description":"Completed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"file":{"$ref":"#/components/schemas/File"},"version":{"type":"number"},"jobId":{"type":"string"},"sha256Verified":{"type":"boolean"}},"required":["success","file","version","sha256Verified"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"UPLOAD_NOT_PENDING / UPLOAD_NOT_RECEIVED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"422":{"description":"UPLOAD_SIZE_MISMATCH / UPLOAD_CHECKSUM_MISMATCH / FILE_TYPE_NOT_ALLOWED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/{id}/files/{fileId}/download-url":{"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Mint a short-lived direct-from-storage download link","description":"The full access chain (store membership, audiences, quarantine) runs BEFORE the link is minted, because none of it can be re-checked afterwards — the URL is redeemed at the storage service with no session and no tenant. The attachment headers are baked into the signature where the backend supports it. A POST, not a GET: the response is a bearer credential and must never be cached or logged as a URL.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"The link.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"url":{"type":"string"},"expiresAt":{"type":"string"}},"required":["success","url","expiresAt"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_NOT_SERVABLE — quarantined or still being scanned.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"503":{"description":"PRESIGN_UNSUPPORTED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/{id}/files/{fileId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Get one file","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"The file.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"file":{"$ref":"#/components/schemas/File"}},"required":["success","file"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Rename and/or move a file (metadata only — the bytes never move)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFileInput"}}}},"responses":{"200":{"description":"The updated file.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"file":{"$ref":"#/components/schemas/File"}},"required":["success","file"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Delete a file — soft by default, ?purge=true removes every version’s bytes","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"},{"schema":{"type":"string","enum":["true","false"],"description":"true ⇒ irreversible: the row goes and every version’s bytes with it."},"required":false,"name":"purge","in":"query"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"purged":{"type":"boolean"}},"required":["success","purged"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_IN_USE — something references this file.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/{id}/files/{fileId}/content":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Download the file bytes (streamed, always as an attachment)","description":"Always `Content-Disposition: attachment` with a SERVER-decided content type and `X-Content-Type-Options: nosniff`. Refuses with 409 FILE_NOT_SERVABLE while the scan verdict is pending, infected or failed.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"Download a specific version."},"required":false,"name":"version","in":"query"}],"responses":{"200":{"description":"The file bytes."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_NOT_SERVABLE — quarantined or still being scanned.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/{id}/files/{fileId}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"A file's immutable byte lineage, newest first","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"$ref":"#/components/schemas/FileVersion"}}},"required":["success","versions"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/file-stores/{id}/files/{fileId}/restore":{"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Restore an old version by minting a NEW one from it (forward-only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreFileVersionInput"}}}},"responses":{"200":{"description":"Restored as a new version.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"file":{"$ref":"#/components/schemas/File"},"version":{"type":"number"},"jobId":{"type":"string"}},"required":["success","file","version"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_VERSION_PURGED / FILE_VERSION_CURRENT.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/{id}/files/{fileId}/audiences":{"patch":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Replace a file's access-control audiences (D18 — no byte copy)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"fileId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetFileAudiencesInput"}}}},"responses":{"200":{"description":"The updated file.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"file":{"$ref":"#/components/schemas/File"}},"required":["success","file"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/file-stores/{id}/files/bulk-audiences":{"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Apply one audience tag set to many files","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkFileAudiencesInput"}}}},"responses":{"200":{"description":"Applied.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"updated":{"type":"number"}},"required":["success","updated"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/file-stores/{id}/folders":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"The distinct folder labels in a File Store, with their file counts","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Folders.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"folders":{"type":"array","items":{"$ref":"#/components/schemas/FileStoreFolder"}}},"required":["success","folders"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Create a folder — makes it exist (and browsable) with nothing uploaded into it yet","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFolderInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"folder":{"type":"string"}},"required":["success","folder"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FOLDER_ALREADY_EXISTS — a real file or an earlier \"New folder\" already made it exist.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Rename a folder in entirety — every file under it, in one metadata sweep (no bytes move)","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameFolderInput"}}}},"responses":{"200":{"description":"Renamed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"moved":{"type":"number"},"folder":{"type":"string"}},"required":["success","moved","folder"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_STORE_MANAGED (a system-managed store), or FOLDER_USED_BY_GATEWAY_ENDPOINT (a live file-kind gateway endpoint reads from this folder or one inside it).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Delete a folder in entirety — every live file under it (soft-deleted, or purged with ?purge=true)","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"description":"The folder to delete, e.g. \"invoices/2026\"."},"required":true,"name":"folder","in":"query"},{"schema":{"type":"string","enum":["true","false"],"description":"true ⇒ irreversible: every file under it loses every version’s bytes, not just its row."},"required":false,"name":"purge","in":"query"}],"responses":{"200":{"description":"Deleted (a file another resource still references is skipped and named in `failed`).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"type":"number"},"failed":{"type":"array","items":{"type":"object","properties":{"fileId":{"type":"string"},"name":{"type":"string"},"reason":{"type":"string"}},"required":["fileId","name","reason"]}},"folder":{"type":"string"}},"required":["success","deleted","failed","folder"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_STORE_MANAGED (a system-managed store), or FOLDER_USED_BY_GATEWAY_ENDPOINT (a live file-kind gateway endpoint reads from this folder or one inside it).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/file-stores/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-File-Stores stats","responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}}}}},"/api/v1/file-stores/{id}/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One File Store's stats","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stats.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","stats"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/file-stores/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-File-Stores usage","parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/file-stores/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One File Store's usage","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/file-stores/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One File Store's AI-operation history","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}}}}},"/api/v1/file-stores/{id}/versions":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Policy version history (read-only). BYTE versions are per-file, not here.","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Versions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"versions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","versions"]}}}}}}},"/api/v1/file-stores/{id}/access-log":{"get":{"security":[{"bearerAuth":[]}],"tags":["File Store"],"summary":"Who READ this store’s files — download / presign / preview / list","description":"The read counterpart to the audit trail. Audit triggers fire on INSERT/UPDATE/DELETE, so app.audit_log answers \"who changed this file\" and cannot answer \"who downloaded it\" — which is the first question a security review or an incident response asks of a file store. Filterable by file, op, source, actor (a studio actor id OR a gateway end-user subject) and date; `fileId` is what the per-file panel uses.","parameters":[{"schema":{"type":"string","description":"The File Store's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Deprecated - prefer `cursor`.","deprecated":true},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Narrow the trail to one file."},"required":false,"name":"fileId","in":"query"},{"schema":{"type":"string","enum":["download","presign","preview","list"],"description":"download (bytes served) · presign (a direct-from-storage link) · preview · list."},"required":false,"name":"op","in":"query"},{"schema":{"type":"string","enum":["studio","gateway","flow","agent"],"description":"Which door the read came through: studio · gateway (an end user) · flow · agent."},"required":false,"name":"source","in":"query"},{"schema":{"type":"string","description":"A studio actor's id OR a gateway end-user subject — matched against both."},"required":false,"name":"actor","in":"query"},{"schema":{"type":"string","description":"ISO timestamp, inclusive lower bound on `at`."},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","description":"ISO timestamp, inclusive upper bound on `at`."},"required":false,"name":"to","in":"query"}],"responses":{"200":{"description":"Access entries, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"entries":{"type":"array","items":{"$ref":"#/components/schemas/FileAccessEntry"}},"total":{"type":"number"},"nextCursor":{"type":"string","nullable":true}},"required":["success","entries","total","nextCursor"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"List every Template visible to the caller","responses":{"200":{"description":"Templates.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"templates":{"type":"array","items":{"$ref":"#/components/schemas/TemplateListItem"}},"total":{"type":"number"}},"required":["success","templates","total"]}}}}}}},"/api/v1/templates/publish-jobs/{jobId}/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Status of one publish-template job","parameters":[{"schema":{"type":"string"},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"job":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"latestEventId":{"type":"number"}},"required":["success","job","latestEventId"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/publish-jobs/{jobId}/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Reconnectable SSE of a publish-template job (?since=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"jobId","in":"path"}],"responses":{"200":{"description":"text/event-stream of publish job events."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Get one Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The Template.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"template":{"$ref":"#/components/schemas/Template"}},"required":["success","template"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Update a tenant-authored Template name or description","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true}}}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"template":{"$ref":"#/components/schemas/Template"}},"required":["success","template"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Delete a tenant-authored Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"All-Templates usage","parameters":[{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/templates/{id}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One Template's usage","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"]},"required":false,"name":"bucket","in":"query"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","report"]}}}}}}},"/api/v1/templates/{id}/history":{"get":{"security":[{"bearerAuth":[]}],"tags":["Stats"],"summary":"One Template's AI-operation history","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"History.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"operations":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","operations","total"]}}}}}}},"/api/v1/solutions/{id}/template-preflight":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Preview every blocking problem a \"Publish as Template\" of this Solution would hit, before publishing","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","enum":["true","false"],"default":"true"},"required":false,"name":"wipe","in":"query"}],"responses":{"200":{"description":"The preflight report — always 200, even when `ok` is false; a findings list is an answer, not an error.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"report":{"$ref":"#/components/schemas/PublishPreflightReport"}},"required":["success","report"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/templates":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Capture this Solution's current state as a new tenant-scoped Template (background job, no AI on the critical path)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true},"wipe":{"type":"boolean","description":"When true, the template's copy gets synthetic sample data (via the reseed profiler) instead of this Solution's real rows, and its DataPortrait profile is dropped. The source Solution's own live data is never modified either way."}},"required":["name","wipe"]}}}},"responses":{"201":{"description":"Created — the Template row exists but a `publish-template` job is still populating its owned resources.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"template":{"$ref":"#/components/schemas/Template"},"status":{"type":"string"},"jobId":{"type":"string"}},"required":["success","template","status","jobId"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"PUBLISH_PREFLIGHT_FAILED — this Solution is not publishable yet; `findings` carries the full preflight report.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"findings":{"type":"array","items":{"$ref":"#/components/schemas/PublishPreflightFinding"}}},"required":["success","error"]}}}}}}},"/api/v1/solutions/{id}/templates/{templateId}/clone":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Clone a Template's bundle into this Solution (background job, no AI on the critical path)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"templateId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"solutionName":{"type":"string","minLength":1}},"required":["solutionName"]}}}},"responses":{"200":{"description":"Started.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string"}},"required":["success","status"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"PUBLISH_PREFLIGHT_FAILED — this Template is not clonable yet; `findings` carries the full preflight report.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"findings":{"type":"array","items":{"$ref":"#/components/schemas/PublishPreflightFinding"}}},"required":["success","error"]}}}}}}},"/api/v1/solutions/{id}/clone/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Status of the latest clone-template job for this Solution","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"job":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"latestEventId":{"type":"number"}},"required":["success","job","latestEventId"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/clone/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Reconnectable SSE of this Solution’s clone-template job (?since=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"text/event-stream of clone job events."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/primary-launchpad":{"put":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Choose which owned LaunchPad this Template shows (preview + \"Browse this template\")","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"launchpadId":{"type":"string","minLength":1}},"required":["launchpadId"]}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"template":{"$ref":"#/components/schemas/Template"}},"required":["success","template"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"LAUNCHPAD_NOT_OWNED — that LaunchPad is not owned by this Template."}}}},"/api/v1/templates/{id}/release":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Release a new version of this Template — bumps major.minor.patch and deploys its owned LaunchPad","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"string","enum":["major","minor","patch"],"description":"Which part of major.minor.patch to bump — reset-below-tier arithmetic (a minor bump resets patch, a major bump resets minor+patch)."},"note":{"type":"string","nullable":true,"description":"Human summary shown in the Versions list, and used as the coupled LaunchPad deploy's label. Defaults to \"Released vX.Y.Z\" when omitted."}},"required":["tier"]}}}},"responses":{"200":{"description":"Released.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"template":{"$ref":"#/components/schemas/Template"},"version":{"$ref":"#/components/schemas/ReleasedTemplateVersion"}},"required":["success","template","version"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/catalog-releases":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Publish a new global catalog release of this Template (default workspace only, member+, background job) — builds a frozen copy every workspace can browse and clone, then, if a tier was given, records the bumped version once the copy is live","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"string","nullable":true,"enum":["major","minor","patch"],"description":"Optional, opt-in version bump: which part of major.minor.patch to bump, computed and recorded at go-live. Omit it or send null to publish at the Template's CURRENT version with no bump."},"note":{"type":"string","nullable":true,"description":"Human release note. Defaults to \"Released vX.Y.Z\" when omitted."}}}}}},"responses":{"202":{"description":"Started — the release row is `building`; the Template's own version is unchanged until go-live.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"release":{"$ref":"#/components/schemas/TemplateCatalogRelease"},"jobId":{"type":"string"}},"required":["success","release","jobId"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CATALOG_PUBLISH_IN_PROGRESS — a publish of this Template is already running."},"422":{"description":"PUBLISH_PREFLIGHT_FAILED — this Template is not publishable yet; `findings` carries the full preflight report.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"findings":{"type":"array","items":{"$ref":"#/components/schemas/PublishPreflightFinding"}}},"required":["success","error"]}}}}}},"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's own global catalog release history (default workspace only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Releases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"releases":{"type":"array","items":{"$ref":"#/components/schemas/TemplateCatalogRelease"}},"total":{"type":"number"}},"required":["success","releases","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/catalog-releases/withdraw":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Withdraw this entry's live global catalog release (default workspace only, member+) — other workspaces stop seeing/cloning it; their existing clones are unaffected; the frozen copy is torn down after a grace period","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Withdrawn.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"template":{"$ref":"#/components/schemas/Template"}},"required":["success","template"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/chat":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"The Template builder chat transcript","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Transcript.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"messages":{"type":"array","items":{"$ref":"#/components/schemas/TemplateBuilderChatMessage"}}},"required":["success","messages"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Start a Template build/refine turn (detached job)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"Opt-in exactly-once key; the same key replays the first response."},"required":false,"name":"Idempotency-Key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateBuilderChatInput"}}}},"responses":{"200":{"description":"The started job.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string","nullable":true},"status":{"type":"string"},"alreadyRunning":{"type":"boolean"}},"required":["success","jobId","status"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"IDEMPOTENCY_IN_PROGRESS - a request with this key is still processing.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"IDEMPOTENCY_KEY_REUSED - key already used with a different body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/chat/reset":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Reset the Template builder conversation","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Reset.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/builder/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"How full the Template builder's memory is, and what the builder has cost","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"usage":{"$ref":"#/components/schemas/BuilderUsage"}},"required":["success","usage"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/builder/simulated":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"What the Template builder last declared is still a placeholder in this Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The current declaration.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"declaration":{"$ref":"#/components/schemas/BuilderSimulatedDeclaration"}},"required":["success","declaration"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/brief":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"The Template's pinned brief and the builder's notes","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The brief and the notes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderBriefResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Set the Template's pinned brief and/or the builder's notes (an omitted field is left as it is)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderBriefInput"}}}},"responses":{"200":{"description":"The brief and the notes as saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderBriefResponse"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"BRIEF_TOO_LONG - the brief or the notes is longer than 20,000 characters; nothing was saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/build/status":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Latest Template build job status","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string","nullable":true}},"required":["success","status"]}}}}}}},"/api/v1/templates/{id}/build/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Reconnectable SSE of Template build events (?since=)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"text/event-stream of build events."}}}},"/api/v1/templates/{id}/build/stop":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Cooperatively cancel the running Template build","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stopping.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}}}}},"/api/v1/templates/{id}/chat/attachments":{"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Upload chat attachments for a Template build (multipart, field \"files\")","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Stored.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"attachments":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/TemplateBuilderChatAttachment"},{"type":"object","properties":{"size":{"type":"number"}},"required":["size"]}]}}},"required":["success","attachments"]}}}},"400":{"description":"No files, an unsupported type, or one over its per-kind size limit."},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/chat/attachments/{attachmentId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Fetch one Template chat attachment’s raw bytes","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string"},"required":true,"name":"attachmentId","in":"path"}],"responses":{"200":{"description":"The file bytes, with its own content type."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/launchpads":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned LaunchPads (id/title/slug/live/url/previewUrl)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"LaunchPads.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpads":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","launchpads","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a LaunchPad in this Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLaunchpadInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"launchpad":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","launchpad"]}}}},"400":{"description":"MISSING_TITLE"},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/fact-bases":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned FactBases (id/name/schema/provisioned only)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"FactBases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"factBases":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","factBases","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a FactBase owned by this Template (multipart file, or inline content)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string"},"file":{"type":"string","format":"binary"}},"required":["name"]}},"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"content":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["name","content"]}}}},"responses":{"200":{"description":"Created (FactBase + inferred entities).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"413":{"description":"SAMPLE_DATA_TOO_LARGE / BODY_TOO_LARGE — the message names the limit AND the size that arrived.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["success","error"]}}}}}}},"/api/v1/templates/{id}/data-portraits":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned Data Portraits","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Data Portraits.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"dataPortraits":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","dataPortraits","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/doc-bases":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned Doc Bases","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Doc Bases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBases":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","docBases","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a Doc Base in this Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocBaseInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"docBase":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","docBase"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/file-stores":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned (non-system-managed) File Stores","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"File Stores.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStores":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","fileStores","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a File Store in this Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFileStoreInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"fileStore":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","fileStore"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/flows":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned Flows","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Flows.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flows":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","flows","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a Flow in this Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFlowInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"flow":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","flow"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_FLOW_NAME — this Template already has a flow with that name (case-insensitive)."}}}},"/api/v1/templates/{id}/agents":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned Agents","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Agents.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agents":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","agents","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create an Agent in this Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"agent":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","agent"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_AGENT_NAME — this Template already has an agent with that name (case-insensitive)."}}}},"/api/v1/templates/{id}/bots":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned Bots — an unregistered slot, never live","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Bots.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"bots":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","bots","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a Bot owned by this Template — an unregistered slot: name, description, channel kind, mode and the bound Agent only, never credentials, a webhook token or a platform registration","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBotInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"created":{"$ref":"#/components/schemas/CreatedBot"}},"required":["success","created"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CROSS_SOLUTION — that agent belongs to a different owner. DUPLICATE_BOT_NAME — this Template already has a bot with that name (case-insensitive)."}}}},"/api/v1/templates/{id}/gateways":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned Flex Gateways","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Gateways.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"apis":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","apis","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a Flex Gateway in this Template","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGatewayInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"api":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","api"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/identities":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned named Identities","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Identities.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identities":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","identities","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a named Identity in this Template (kind restricted to `basic` — TEMPLATE_IDENTITY_KIND_NOT_SUPPORTED for anything else)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIdentityInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"identity":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","identity"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/connections":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"This Template's owned Connections","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Connections.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connections":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"total":{"type":"number"}},"required":["success","connections","total"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Create a Connection in this Template (may hold a real secret — stripped again on any future clone)","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConnectionInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"connection":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","connection"]}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"DUPLICATE_CONNECTION — this Template already has the same normalized name, kind, and configuration."}}}},"/api/v1/template-catalog/{id}/current":{"get":{"security":[{"bearerAuth":[]}],"tags":["Template"],"summary":"Resolve any id belonging to a catalog entry (the entry id, or any past/present snapshot id) to that entry's current live snapshot id","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Resolved.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"entryId":{"type":"string"},"templateId":{"type":"string"}},"required":["success","entryId","templateId"]}}}},"404":{"description":"CATALOG_ENTRY_NOT_FOUND — this id names no catalog entry, or the entry has been withdrawn.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/integrations/catalog":{"get":{"security":[{"bearerAuth":[]}],"tags":["Integrations"],"summary":"The applications and actions an integration step can use","description":"Compile-time catalog. Does not vary by tenant, plan or entitlement, and performs no I/O. Carries no endpoint, path or auth detail.","responses":{"200":{"description":"The provider/action descriptors.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"providers":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationProvider"}}},"required":["success","providers"]}}}}}}},"/api/v1/agents/{id}/sessions":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Open a session (test/api)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentSessionInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"sessionId":{"type":"string"},"session":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","sessionId","session"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — not the caller’s own Playground session, and the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"AGENT_NOT_PUBLISHED / AGENT_DISABLED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}},"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"List an agent's sessions","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"description":"Deprecated - prefer `cursor`.","deprecated":true},"required":false,"name":"offset","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Sessions.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"sessions":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","sessions"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/sessions/{sid}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Session detail + turns","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"The session + its turns.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"session":{"type":"object","additionalProperties":{"nullable":true}},"turns":{"type":"array","items":{"$ref":"#/components/schemas/AgentTurn"}}},"required":["success","session","turns"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/messages":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Send a message → start/resume a turn","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSendMessageInput"}}}},"responses":{"200":{"description":"The started turn job.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"turnId":{"type":"string"},"jobId":{"type":"string"},"alreadyRunning":{"type":"boolean"}},"required":["success","turnId","jobId","alreadyRunning"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — not the caller’s own Playground session, and the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"SESSION_ENDED / TURN_IN_PROGRESS / SESSION_TURN_LIMIT.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/submissions":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Submit the active structured-input form","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitAgentFormInput"}}}},"responses":{"200":{"description":"A field-level re-ask, a resumed agent turn, or an accepted/closed child-Flow form.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["awaiting_input","running","accepted","closed"]},"card":{"type":"object","properties":{"kind":{"type":"string","enum":["form"]},"requestId":{"type":"string","minLength":1},"spec":{"$ref":"#/components/schemas/FormSpec"},"errors":{"type":"object","additionalProperties":{"type":"string"}},"state":{"type":"string","enum":["active","submitting","completed"]}},"required":["kind","requestId","spec"],"additionalProperties":false},"turnId":{"type":"string"},"jobId":{"type":"string"},"version":{"type":"integer"},"reason":{"type":"string"}},"required":["success","status"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — not the caller’s own Playground session, and the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FORM_REQUEST_MISMATCH / FORM_SUBMISSION_REQUIRED / session conflict.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/cards/{cardId}/preview":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Bounded, inert preview of a document card","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The document card id, an inert key scoped to this session."},"required":true,"name":"cardId","in":"path"}],"responses":{"200":{"description":"The preview DTO. `unavailable` is a normal answer, not an error.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"preview":{"$ref":"#/components/schemas/DocumentPreview"},"canDownload":{"type":"boolean"},"file":{"type":"object","properties":{"name":{"type":"string"},"mediaType":{"type":"string"},"sizeBytes":{"type":"number"}},"required":["name","mediaType","sizeBytes"]}},"required":["success","preview","canDownload","file"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_NOT_SERVABLE — a quarantine verdict holds the bytes back.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/cards/{cardId}/file":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"A document card's bytes, always as an attachment","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The document card id, an inert key scoped to this session."},"required":true,"name":"cardId","in":"path"}],"responses":{"200":{"description":"The bytes, Content-Disposition: attachment with an inert content type."},"403":{"description":"CARD_DOWNLOAD_NOT_ALLOWED — the resolved download policy refuses it.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FILE_NOT_SERVABLE.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/turns/{tid}/feedback":{"put":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Rate an assistant reply","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The Turn's ULID."},"required":true,"name":"tid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubmitAgentFeedbackInput"}}}},"responses":{"200":{"description":"The stored rating.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"feedback":{"$ref":"#/components/schemas/AgentTurnFeedback"}},"required":["success","feedback"]}}}},"400":{"description":"FEEDBACK_TURN_NOT_RATEABLE — only an assistant reply can be rated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"403":{"description":"403 INSUFFICIENT_ROLE — not the caller’s own Playground session, and the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"FEEDBACK_DISABLED / FEEDBACK_TURN_UNFINISHED / FEEDBACK_ALREADY_GIVEN (the rating is final; DELETE then re-rate).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Withdraw a rating","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The Turn's ULID."},"required":true,"name":"tid","in":"path"}],"responses":{"200":{"description":"Removed (idempotent).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — not the caller’s own Playground session, and the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/turns/{tid}/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Reconnectable SSE of a turn (replay + tail)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The Turn's ULID."},"required":true,"name":"tid","in":"path"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"since","in":"query"}],"responses":{"200":{"description":"text/event-stream of turn events."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/turns/{tid}/delegations":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"The nested executions one turn started (safe lineage view)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The Turn's ULID."},"required":true,"name":"tid","in":"path"}],"responses":{"200":{"description":"The turn’s delegations, oldest first, plus their aggregate usage. Empty when it delegated nothing.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"delegations":{"type":"array","items":{"$ref":"#/components/schemas/AgentDelegationSummary"}},"usage":{"type":"object","properties":{"tokensIn":{"type":"number"},"tokensOut":{"type":"number"},"toolCalls":{"type":"number"},"delegations":{"type":"number"}},"required":["tokensIn","tokensOut","toolCalls","delegations"]}},"required":["success","delegations","usage"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/stop":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Cancel the in-flight turn","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"Stop result.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stopped":{"type":"boolean"}},"required":["success","stopped"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — not the caller’s own Playground session, and the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/sessions/{sid}/end":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"End a session","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"The ended session.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"session":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","session"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — not the caller’s own Playground session, and the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/playground-sessions":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"The caller's own Playground sessions","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":1,"description":"Page size. Clamped to the server maximum (50); default 20."},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque page cursor from a previous response's `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","description":"Bounded title-only search. Trimmed; longer input is truncated server-side."},"required":false,"name":"q","in":"query"},{"schema":{"type":"string","enum":["all","draft","published"],"description":"Draft sessions run the live definition; published ones are pinned to a version."},"required":false,"name":"target","in":"query"}],"responses":{"200":{"description":"One page, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/AgentPlaygroundHistoryRow"}},"pinned":{"type":"array","items":{"$ref":"#/components/schemas/AgentPlaygroundHistoryRow"},"description":"FAI-1413: the caller's pinned conversations (newest pin first, same search), on the FIRST page only; also present in `sessions` at their recency position."},"nextCursor":{"type":"string","nullable":true}},"required":["success","sessions","pinned","nextCursor"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"AGENT_HISTORY_NOT_AVAILABLE — the rollout gate is off for this workspace.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/playground-sessions/{sid}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"One of the caller's own Playground sessions + its turns","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"The session + its turns, in the Studio shape the existing renderers read.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"session":{"type":"object","additionalProperties":{"nullable":true}},"turns":{"type":"array","items":{"$ref":"#/components/schemas/AgentTurn"}}},"required":["success","session","turns"]}}}},"403":{"description":"AGENT_HISTORY_NOT_AVAILABLE — the rollout gate is off for this workspace.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"404":{"description":"SESSION_NOT_FOUND — unknown and foreign ids are indistinguishable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Remove one of the caller's own Playground sessions from their history","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"Removed. The session is ended and no longer listed, opened or resumed on this rail.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"AGENT_HISTORY_NOT_AVAILABLE — the rollout gate is off for this workspace.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"404":{"description":"SESSION_NOT_FOUND — unknown, foreign and already-removed ids are indistinguishable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/playground-sessions/{sid}/pin":{"put":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Pin one of the caller's own Playground sessions to the top of their history","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"Pinned (idempotent). updatedAt is unchanged.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"pinned":{"type":"boolean"}},"required":["success","pinned"]}}}},"403":{"description":"AGENT_HISTORY_NOT_AVAILABLE — the rollout gate is off for this workspace.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"404":{"description":"SESSION_NOT_FOUND — unknown, foreign and removed ids are indistinguishable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"409":{"description":"PIN_LIMIT_REACHED — the caller already has the maximum number of pinned chats on this rail.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Agent Runtime"],"summary":"Unpin one of the caller's own Playground sessions","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The Session's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"Unpinned (idempotent). updatedAt is unchanged.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"pinned":{"type":"boolean"}},"required":["success","pinned"]}}}},"403":{"description":"AGENT_HISTORY_NOT_AVAILABLE — the rollout gate is off for this workspace.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}},"404":{"description":"SESSION_NOT_FOUND — unknown, foreign and removed ids are indistinguishable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/eval-sets":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"List an agent's eval sets","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Sets.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"sets":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","sets"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Create an eval set","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentEvalSetInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"set":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","set"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/eval-sets/{sid}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Eval set detail + cases","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"The set + its cases.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"set":{"type":"object","additionalProperties":{"nullable":true}},"cases":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","set","cases"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"put":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Update an eval set (name / default)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentEvalSetInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"set":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","set"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Delete an eval set (+ its cases/runs)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/eval-sets/{sid}/cases":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Add a case to an eval set","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEvalCaseInput"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"case":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","case"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/eval-sets/{sid}/cases/{cid}":{"put":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Update an eval case","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The eval Case's ULID."},"required":true,"name":"cid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentEvalCaseInput"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"case":{"type":"object","additionalProperties":{"nullable":true}}},"required":["success","case"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Delete an eval case","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"},{"schema":{"type":"string","description":"The eval Case's ULID."},"required":true,"name":"cid","in":"path"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}},"required":["success"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/eval-sets/{sid}/run":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Start an eval run (draft or published target)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunAgentEvalInput"}}}},"responses":{"202":{"description":"The started run + its job.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"type":"object","additionalProperties":{"nullable":true}},"jobId":{"type":"string"}},"required":["success","run","jobId"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"EVAL_SET_EMPTY / AGENT_NOT_PUBLISHED.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]}}}}}}}}},"/api/v1/agents/{id}/eval-sets/{sid}/runs":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"List an eval set's runs","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Set's ULID."},"required":true,"name":"sid","in":"path"}],"responses":{"200":{"description":"Runs.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"runs":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","runs"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/eval-runs/{rid}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Eval run detail + per-case results","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Run's ULID."},"required":true,"name":"rid","in":"path"}],"responses":{"200":{"description":"The run + results.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"run":{"type":"object","additionalProperties":{"nullable":true}},"results":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}}},"required":["success","run","results"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/eval-runs/{rid}/stream":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Reconnectable SSE of an eval run (replay + tail)","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Run's ULID."},"required":true,"name":"rid","in":"path"},{"schema":{"type":"integer","nullable":true,"minimum":0},"required":false,"name":"since","in":"query"}],"responses":{"200":{"description":"text/event-stream of eval-run events."},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/eval-runs/{rid}/stop":{"post":{"security":[{"bearerAuth":[]}],"tags":["Agent Evals"],"summary":"Cancel an in-flight eval run","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","description":"The eval Run's ULID."},"required":true,"name":"rid","in":"path"}],"responses":{"200":{"description":"Stop result.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stopped":{"type":"boolean"}},"required":["success","stopped"]}}}},"403":{"description":"403 INSUFFICIENT_ROLE — the caller cannot change this Agent’s Solution (or Template).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/agents/{id}/analytics":{"get":{"security":[{"bearerAuth":[]}],"tags":["Agent Analytics"],"summary":"Bucketed usage, tools, guardrail and feedback metrics for one agent","parameters":[{"schema":{"type":"string","description":"The Agent's ULID."},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"date-time","description":"ISO start. Default: 30 days before `to`."},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","format":"date-time","description":"ISO end, EXCLUSIVE. Default: now."},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week","month"],"description":"Series granularity. Default: day."},"required":false,"name":"bucket","in":"query"},{"schema":{"type":"string","description":"Narrow to one captured end-user role. Blank is ignored."},"required":false,"name":"role","in":"query"},{"schema":{"type":"string","description":"Narrow to one captured end-user region. Blank is ignored."},"required":false,"name":"region","in":"query"}],"responses":{"200":{"description":"The report over the resolved range.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"analytics":{"$ref":"#/components/schemas/AgentAnalytics"}},"required":["success","analytics"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/form-rules/suggest":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Suggest guardrails for one form field","description":"Turns an example answer and a plain-English description into DECLARATIVE field rules — a named format, literal affixes, length bounds, or an email domain list. There is no regex in the vocabulary, so nothing here can hand the server an expression to compile. The result is a proposal: it writes nothing, and the caller saves what it keeps through the ordinary form write, which re-validates. Requires write access to the Solution, because it spends model quota.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuggestFormRulesBody"}}}},"responses":{"200":{"description":"The proposed rules, already normalized to what this field type can enforce.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"rules":{"$ref":"#/components/schemas/SuggestedFormRules"},"explanation":{"type":"string","nullable":true,"description":"One line for the AUTHOR summarising the proposal. Not persisted."}},"required":["success","rules","explanation"]}}}},"400":{"description":"FORM_RULE_ASSIST_EMPTY - neither an example nor a description was supplied.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Requires write access to this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution not found, or not shared with you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/form-submissions":{"get":{"security":[{"bearerAuth":[]}],"tags":["Form submissions"],"summary":"List opt-in canonical form submissions for a Solution","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","enum":["agent","flow"]},"required":false,"name":"producer","in":"query"}],"responses":{"200":{"description":"A cursor-paginated submission page.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"submissions":{"type":"array","items":{"$ref":"#/components/schemas/FormSubmission"}},"nextCursor":{"type":"string","nullable":true}},"required":["success","submissions","nextCursor"]}}}},"403":{"description":"Requires a workspace admin+, or a `manager` grant on this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution or submission not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/form-submissions/{submissionId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Form submissions"],"summary":"Get one canonical form submission through its owning Solution","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"submissionId","in":"path"}],"responses":{"200":{"description":"The submission.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"submission":{"$ref":"#/components/schemas/FormSubmission"}},"required":["success","submission"]}}}},"403":{"description":"Requires a workspace admin+, or a `manager` grant on this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution or submission not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/files/{fileId}/form-submissions":{"get":{"security":[{"bearerAuth":[]}],"tags":["Form submissions"],"summary":"Find this Solution’s submissions that reference a file","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"fileId","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true,"maximum":200},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Opaque keyset cursor from a prior response `nextCursor`."},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"string","enum":["agent","flow"]},"required":false,"name":"producer","in":"query"}],"responses":{"200":{"description":"A cursor-paginated reverse lookup.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"submissions":{"type":"array","items":{"$ref":"#/components/schemas/FormSubmission"}},"nextCursor":{"type":"string","nullable":true}},"required":["success","submissions","nextCursor"]}}}},"403":{"description":"Requires a workspace admin+, or a `manager` grant on this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution or submission not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/people":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Who holds a grant on this Solution","description":"Each entry carries the grantee’s tenant role, which is their CEILING — the effective permission is the LESSER of the two — so a share dialog can render the narrowing without a second call.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The grants.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"people":{"type":"array","items":{"$ref":"#/components/schemas/SolutionGrant"}}},"required":["success","people"]}}}},"403":{"description":"Requires read access to this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution not found, or not shared with you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/people/candidates":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Active tenant members who hold no grant on this Solution yet","description":"Each candidate carries `maxGrant`, the highest level the server would accept for them, so the share dialog never offers a control that would be refused.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The candidates.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"candidates":{"type":"array","items":{"$ref":"#/components/schemas/SolutionGrantCandidate"}}},"required":["success","candidates"]}}}},"403":{"description":"Requires manager access to this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution not found, or not shared with you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/people/{userId}":{"put":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Add or change one person’s grant on a Solution","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"userId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["viewer","editor","manager"]},"expiresAt":{"type":"string","nullable":true,"format":"date-time"}},"required":["role"]}}}},"responses":{"200":{"description":"The stored grant.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"grant":{"$ref":"#/components/schemas/SolutionGrant"}},"required":["success","grant"]}}}},"403":{"description":"Requires manager access to this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution not found, or the target is not an active member of this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"GRANT_EXCEEDS_TENANT_ROLE — the target’s tenant role can never hold that level, so the grant would never take effect. GRANT_TARGET_NOT_RESOLVABLE — they hold a workspace membership but no `app.actors` row, which `solution_members.user_id` requires (and `tenant_members.user_id` does not), so the grant cannot be stored until they sign in once.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Remove one person’s grant on a Solution","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"userId","in":"path"}],"responses":{"200":{"description":"Removed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"removed":{"type":"boolean","enum":[true]}},"required":["success","removed"]}}}},"403":{"description":"Requires manager access to this Solution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution not found, or that person holds no grant.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"LAST_SOLUTION_MANAGER — you are removing your own last manager grant. A workspace admin is the rescue path and is never refused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/access-request":{"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Ask this Solution’s managers for access","description":"The one affordance on a `SOLUTION_NOT_SHARED` page, so it is the one route here for a caller who has NO access to the Solution in the path. Notifies the Solution’s live managers — or the workspace’s owners/admins when it has none left, since they bypass the boundary and are the standing rescue path. The response carries a COUNT and never the addresses: who manages a Solution is ACL detail the caller holds no grant to read. Rate limited per (Solution, caller).","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","nullable":true,"maxLength":500}}}}}},"responses":{"200":{"description":"The request was sent (or reached nobody, which `notified: 0` says honestly).","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"requested":{"type":"boolean","enum":[true]},"notified":{"type":"number"},"delivered":{"type":"boolean"},"viaWorkspaceAdmins":{"type":"boolean"}},"required":["success","requested","notified","delivered","viaWorkspaceAdmins"]}}}},"404":{"description":"SOLUTION_NOT_FOUND — no such Solution in this workspace, or the caller is not a member of it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"SOLUTION_ALREADY_ACCESSIBLE — the caller can already see it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"RATE_LIMITED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/access-explain":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Why this person can (or cannot) see this Solution","description":"Admin-only. `branch` names which arm of `app.solution_scope_unrestricted()` fired, in that function’s own evaluation order. An RLS denial is an empty list indistinguishable from “there is no data”, so this is the only thing that can answer the first “it’s missing” report.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":false,"name":"userId","in":"query"}],"responses":{"200":{"description":"The explanation.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"explanation":{"$ref":"#/components/schemas/SolutionAccessExplanation"}},"required":["success","explanation"]}}}},"403":{"description":"Requires members:manage (admin+).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Solution not found, or not shared with you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variables":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"List this Solution’s variables","description":"Every variable this owner defines, with its effective value, its source (override / default / unset) and its readiness. Authenticated Studio surface only — there is deliberately no public configuration dump for generated apps or end users. Carries `capabilities`, the ONE availability answer every Studio surface reads; an older server omits it, which a client must read as “no authoring”.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The variables and the owner’s readiness.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variables":{"type":"array","items":{"$ref":"#/components/schemas/ConfigurationVariable"}},"readiness":{"$ref":"#/components/schemas/ConfigurationReadiness"},"capabilities":{"$ref":"#/components/schemas/ConfigurationCapabilities"}},"required":["success","variables","readiness"]}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Define a variable on this Solution","description":"Key and type are immutable once created. A default and an override may both be supplied.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","maxLength":64,"pattern":"^[A-Z][A-Z0-9_]*$","description":"Case-sensitive, [A-Z][A-Z0-9_]*. No dot — a dot separates a JSON subpath in {{config.KEY.field}}. Immutable after create."},"type":{"type":"string","enum":["text","number","boolean","json","secret"]},"displayName":{"type":"string","nullable":true,"maxLength":120},"description":{"type":"string","nullable":true,"maxLength":1000},"required":{"type":"boolean"},"defaultValue":{"$ref":"#/components/schemas/ConfigurationPresence"},"overrideValue":{"$ref":"#/components/schemas/ConfigurationPresence"},"secretValue":{"type":"string","minLength":1,"maxLength":8192,"description":"Write-only. Never returned by any endpoint."}},"required":["key","type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE, or CONFIGURATION_OWNER_FORBIDDEN for an override on a Template.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variables/{variableId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"One variable","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"responses":{"200":{"description":"The variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Edit a variable’s metadata or its default","description":"Metadata and the DEFAULT only — setting a Solution’s override is a separate operation, because a Template author writing a default and a Solution owner supplying a value are different decisions by different people. `key` and `type` are rejected by name rather than ignored.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"The revision you read. The write is one conditional UPDATE against it; a stale value answers 409 CONFIGURATION_REVISION_CONFLICT rather than overwriting a concurrent edit."},"displayName":{"type":"object","properties":{"set":{"type":"string","nullable":true}},"required":["set"],"additionalProperties":false},"description":{"type":"object","properties":{"set":{"type":"string","nullable":true}},"required":["set"],"additionalProperties":false},"required":{"type":"object","properties":{"set":{"type":"boolean"}},"required":["set"],"additionalProperties":false},"defaultValue":{"$ref":"#/components/schemas/ConfigurationPresence"}},"required":["expectedRevision"],"additionalProperties":false}}}},"responses":{"200":{"description":"The updated variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Delete a variable","description":"Refused while anything still references the key — a draft graph or definition, or a retained published version snapshot something may still be executing. The refusal carries the usage list.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true},"required":true,"name":"expectedRevision","in":"query"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"type":"boolean","enum":[true]}},"required":["success","deleted"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_VARIABLE_IN_USE — `error.usedBy` names each referencing definition. Or CONFIGURATION_REVISION_CONFLICT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variables/{variableId}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"What references this variable","description":"Drafts and retained published version snapshots, each naming the field the reference sits in. Only definitions that OPTED IN to the configuration namespace contribute — a historical `{{config.EXAMPLE}}` literal in an unmarked graph is text, not a dependency.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"responses":{"200":{"description":"The usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"},"usedBy":{"type":"array","items":{"$ref":"#/components/schemas/ConfigurationUsage"}}},"required":["success","variable","usedBy"]}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variables":{"get":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"List this Template’s variables","description":"Every variable this owner defines, with its effective value, its source (override / default / unset) and its readiness. Authenticated Studio surface only — there is deliberately no public configuration dump for generated apps or end users. Carries `capabilities`, the ONE availability answer every Studio surface reads; an older server omits it, which a client must read as “no authoring”.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The variables and the owner’s readiness.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variables":{"type":"array","items":{"$ref":"#/components/schemas/ConfigurationVariable"}},"readiness":{"$ref":"#/components/schemas/ConfigurationReadiness"},"capabilities":{"$ref":"#/components/schemas/ConfigurationCapabilities"}},"required":["success","variables","readiness"]}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"Define a variable on this Template","description":"A Template carries a default and never an override — an `overrideValue` here answers 403 CONFIGURATION_OWNER_FORBIDDEN.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","maxLength":64,"pattern":"^[A-Z][A-Z0-9_]*$","description":"Case-sensitive, [A-Z][A-Z0-9_]*. No dot — a dot separates a JSON subpath in {{config.KEY.field}}. Immutable after create."},"type":{"type":"string","enum":["text","number","boolean","json","secret"]},"displayName":{"type":"string","nullable":true,"maxLength":120},"description":{"type":"string","nullable":true,"maxLength":1000},"required":{"type":"boolean"},"defaultValue":{"$ref":"#/components/schemas/ConfigurationPresence"},"overrideValue":{"$ref":"#/components/schemas/ConfigurationPresence"},"secretValue":{"type":"string","minLength":1,"maxLength":8192,"description":"Write-only. Never returned by any endpoint."}},"required":["key","type"],"additionalProperties":false}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE, or CONFIGURATION_OWNER_FORBIDDEN for an override on a Template.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variables/{variableId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"One variable","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"responses":{"200":{"description":"The variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"Edit a variable’s metadata or its default","description":"Metadata and the DEFAULT only — setting a Solution’s override is a separate operation, because a Template author writing a default and a Solution owner supplying a value are different decisions by different people. `key` and `type` are rejected by name rather than ignored.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"The revision you read. The write is one conditional UPDATE against it; a stale value answers 409 CONFIGURATION_REVISION_CONFLICT rather than overwriting a concurrent edit."},"displayName":{"type":"object","properties":{"set":{"type":"string","nullable":true}},"required":["set"],"additionalProperties":false},"description":{"type":"object","properties":{"set":{"type":"string","nullable":true}},"required":["set"],"additionalProperties":false},"required":{"type":"object","properties":{"set":{"type":"boolean"}},"required":["set"],"additionalProperties":false},"defaultValue":{"$ref":"#/components/schemas/ConfigurationPresence"}},"required":["expectedRevision"],"additionalProperties":false}}}},"responses":{"200":{"description":"The updated variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"Delete a variable","description":"Refused while anything still references the key — a draft graph or definition, or a retained published version snapshot something may still be executing. The refusal carries the usage list.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true},"required":true,"name":"expectedRevision","in":"query"}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"type":"boolean","enum":[true]}},"required":["success","deleted"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_VARIABLE_IN_USE — `error.usedBy` names each referencing definition. Or CONFIGURATION_REVISION_CONFLICT.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variables/{variableId}/usage":{"get":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"What references this variable","description":"Drafts and retained published version snapshots, each naming the field the reference sits in. Only definitions that OPTED IN to the configuration namespace contribute — a historical `{{config.EXAMPLE}}` literal in an unmarked graph is text, not a dependency.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"responses":{"200":{"description":"The usage.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"},"usedBy":{"type":"array","items":{"$ref":"#/components/schemas/ConfigurationUsage"}}},"required":["success","variable","usedBy"]}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variables/{variableId}/override":{"put":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Set this Solution’s override","description":"The deployment-specific value. `value` is required — clearing is the DELETE below, never a null passed here, which is what lets a `json` variable be overridden to a deliberate JSON null.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"The revision you read. The write is one conditional UPDATE against it; a stale value answers 409 CONFIGURATION_REVISION_CONFLICT rather than overwriting a concurrent edit."},"value":{"$ref":"#/components/schemas/ConfigurationValue"}},"required":["expectedRevision","value"],"additionalProperties":false}}}},"responses":{"200":{"description":"The updated variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Clear this Solution’s override","description":"Falls back to the default, which may itself be absent. Refused with CONFIGURATION_VALUE_UNSET when that would leave a PUBLISHED consumer unable to resolve the key; a draft reference never blocks it, because writing the reference before setting the value is the normal order of work.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"},{"schema":{"type":"integer","minimum":0,"exclusiveMinimum":true},"required":true,"name":"expectedRevision","in":"query"}],"responses":{"200":{"description":"The updated variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED — this deployment does not offer variable authoring. Server-side, so hiding the control is not what enforces it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variables/{variableId}/secret":{"put":{"security":[{"bearerAuth":[]}],"tags":["Solutions"],"summary":"Set or rotate this Solution’s secret","description":"Write-only. The value is sealed by the deployment’s secret store and is never returned by this or any other endpoint — the variable comes back with `{present:true, withheld:true, backend, sealedAt}`. A rotation takes effect at the next node that READS the secret, including inside a run that is already under way: that is deliberate, and it is what makes revoking a credential work.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"The revision you read. The write is one conditional UPDATE against it; a stale value answers 409 CONFIGURATION_REVISION_CONFLICT rather than overwriting a concurrent edit."},"value":{"type":"string","minLength":1,"maxLength":8192,"description":"Write-only. Never returned by any endpoint."}},"required":["expectedRevision","value"],"additionalProperties":false}}}},"responses":{"200":{"description":"The updated variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED or CONFIGURATION_SECRETS_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"CONFIGURATION_SECRET_BACKEND_UNAVAILABLE — the secret store could not be reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variables/{variableId}/secret":{"put":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"Set or rotate this Template’s secret default","description":"Write-only, and it is the DEFAULT slot: a Template declares what its copies must supply. The value never travels — a clone, a publish and an export all carry the declaration and no bytes, so every destination supplies its own.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"variableId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expectedRevision":{"type":"integer","minimum":0,"exclusiveMinimum":true,"description":"The revision you read. The write is one conditional UPDATE against it; a stale value answers 409 CONFIGURATION_REVISION_CONFLICT rather than overwriting a concurrent edit."},"value":{"type":"string","minLength":1,"maxLength":8192,"description":"Write-only. Never returned by any endpoint."}},"required":["expectedRevision","value"],"additionalProperties":false}}}},"responses":{"200":{"description":"The updated variable.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variable":{"$ref":"#/components/schemas/ConfigurationVariable"}},"required":["success","variable"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"CONFIGURATION_VARIABLE_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"CONFIGURATION_REVISION_CONFLICT (stale revision) or DUPLICATE_CONFIGURATION_KEY.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"CONFIGURATION_VALUE_INVALID (type, size or depth), CONFIGURATION_LIMIT_EXCEEDED (per-owner ceiling), or CONFIGURATION_VALUE_UNSET (the change would leave a published consumer unresolvable). Messages name the field or the key, never the value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED or CONFIGURATION_SECRETS_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"CONFIGURATION_SECRET_BACKEND_UNAVAILABLE — the secret store could not be reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/configuration-variables":{"get":{"security":[{"bearerAuth":[]}],"tags":["Variables"],"summary":"List every variable you can see, across Solutions","description":"Every Solution-owned variable you can see, across Solutions, with its owning Solution. A VIEW, not a new owner: each variable is still one Solution’s and readable only by that Solution’s flows and agents. Row-level security is the filter, so an ungranted Solution’s variables are absent. Template variables are not listed. Never gated by the capability switch (reads always work); carries `capabilities` so the page knows whether to offer “New”.","responses":{"200":{"description":"The visible variables, and the same counts the stats route answers.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"variables":{"type":"array","items":{"$ref":"#/components/schemas/VisibleConfigurationVariable"}},"stats":{"$ref":"#/components/schemas/ConfigurationVariableStats"},"capabilities":{"$ref":"#/components/schemas/ConfigurationCapabilities"}},"required":["success","variables","stats"]}}}}}}},"/api/v1/configuration-variables/stats":{"get":{"security":[{"bearerAuth":[]}],"tags":["Variables"],"summary":"Counts for the variables you can see","description":"The CREDENTIALS page’s KPI strip, computed over exactly the rows the list returns.","responses":{"200":{"description":"The counts.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"stats":{"$ref":"#/components/schemas/ConfigurationVariableStats"}},"required":["success","stats"]}}}}}}},"/api/v1/solutions/{id}/variable-proposals/latest":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"The builder’s most recent variable proposal","description":"Any status, or null. A reloaded builder opens a `pending` one in review mode.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The proposal, or null.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"anyOf":[{"$ref":"#/components/schemas/VariableProposal"},{"nullable":true},{"nullable":true}]}},"required":["success","proposal"]}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variable-proposals/{proposalId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"One variable proposal","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"proposalId","in":"path"}],"responses":{"200":{"description":"The proposal.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"$ref":"#/components/schemas/VariableProposal"}},"required":["success","proposal"]}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variable-proposals/{proposalId}/complete":{"post":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Done: create the reviewed variables and resume the builder","description":"Creates (or sets) each included entry through the Variables write service, under YOUR identity and permissions, then resumes the builder turn with a message naming each key and its result - never a value. Redeemed exactly once: a second Done answers the recorded outcome with `applied: false` and creates nothing.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"proposalId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteVariableProposalInput"}}}},"responses":{"200":{"description":"The completed proposal.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"$ref":"#/components/schemas/VariableProposal"},"applied":{"type":"boolean"},"jobId":{"type":"string","nullable":true}},"required":["success","proposal","applied","jobId"]}}}},"400":{"description":"VARIABLE_PROPOSAL_SUBMISSION_INVALID: names a key or a field, never a value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"INSUFFICIENT_ROLE: a viewer cannot commit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"VARIABLE_PROPOSAL_NOT_PENDING: it was dismissed or superseded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED or CONFIGURATION_SECRETS_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/solutions/{id}/variable-proposals/{proposalId}/dismiss":{"post":{"security":[{"bearerAuth":[]}],"tags":["Build"],"summary":"Dismiss: create nothing and resume the builder","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"proposalId","in":"path"}],"responses":{"200":{"description":"The dismissed proposal.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"$ref":"#/components/schemas/VariableProposal"},"jobId":{"type":"string","nullable":true}},"required":["success","proposal","jobId"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"VARIABLE_PROPOSAL_NOT_PENDING: it was dismissed or superseded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variable-proposals/latest":{"get":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"The builder’s most recent variable proposal","description":"Any status, or null. A reloaded builder opens a `pending` one in review mode.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The proposal, or null.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"anyOf":[{"$ref":"#/components/schemas/VariableProposal"},{"nullable":true},{"nullable":true}]}},"required":["success","proposal"]}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variable-proposals/{proposalId}":{"get":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"One variable proposal","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"proposalId","in":"path"}],"responses":{"200":{"description":"The proposal.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"$ref":"#/components/schemas/VariableProposal"}},"required":["success","proposal"]}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variable-proposals/{proposalId}/complete":{"post":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"Done: create the reviewed variables and resume the builder","description":"Creates (or sets) each included entry through the Variables write service, under YOUR identity and permissions, then resumes the builder turn with a message naming each key and its result - never a value. Redeemed exactly once: a second Done answers the recorded outcome with `applied: false` and creates nothing.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"proposalId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteVariableProposalInput"}}}},"responses":{"200":{"description":"The completed proposal.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"$ref":"#/components/schemas/VariableProposal"},"applied":{"type":"boolean"},"jobId":{"type":"string","nullable":true}},"required":["success","proposal","applied","jobId"]}}}},"400":{"description":"VARIABLE_PROPOSAL_SUBMISSION_INVALID: names a key or a field, never a value.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"INSUFFICIENT_ROLE: a viewer cannot commit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"VARIABLE_PROPOSAL_NOT_PENDING: it was dismissed or superseded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"CONFIGURATION_AUTHORING_DISABLED or CONFIGURATION_SECRETS_DISABLED.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/templates/{id}/variable-proposals/{proposalId}/dismiss":{"post":{"security":[{"bearerAuth":[]}],"tags":["Templates"],"summary":"Dismiss: create nothing and resume the builder","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1},"required":true,"name":"proposalId","in":"path"}],"responses":{"200":{"description":"The dismissed proposal.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"proposal":{"$ref":"#/components/schemas/VariableProposal"},"jobId":{"type":"string","nullable":true}},"required":["success","proposal","jobId"]}}}},"403":{"description":"INSUFFICIENT_ROLE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"VARIABLE_PROPOSAL_NOT_FOUND, or the owner is not visible to you.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"VARIABLE_PROPOSAL_NOT_PENDING: it was dismissed or superseded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/tenant-context":{"get":{"tags":["Tenants"],"summary":"The caller’s resolved context in the active workspace (the membership authority)","description":"The cheapest tenant-scoped request there is. Reaching it means the tenant gate resolved this caller — which is also where a pending invitation is honoured at login and verified-domain auto-join runs — so a client must ask this rather than deciding membership from its own memberships list. A genuine refusal is 403 NOT_A_TENANT_MEMBER.","responses":{"200":{"description":"The resolved tenant context.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"tenantContext":{"$ref":"#/components/schemas/TenantContext"}},"required":["success","tenantContext"]}}}}}}},"/api/v1/features":{"get":{"tags":["Platform"],"summary":"What this deployment serves","responses":{"200":{"description":"The deployment-wide feature switches.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[true]},"features":{"$ref":"#/components/schemas/DeploymentFeatures"}},"required":["success","features"]}}}}}}},"/api/{slug}/_/executions/{executionId}":{"get":{"tags":["Gateway runtime"],"summary":"Poll one execution at its gateway's own address","description":"Served by the gateway process (apps.<domain>, or <tenant>.apps.<domain>), not the studio API host. Authorized inside the execution's own tenant, either by the anonymous execution token or by the endpoint's own credential: the Identity is resolved exactly as it was for the request that started the execution (a dynamic gateway picks the candidate the bearer's issuer names), the same authorization rules apply, and the verified subject must equal the one recorded at invocation. An execution started through another gateway is a 404, like an unknown one.","security":[],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's slug - the gateway that started the execution."},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The execution projection. Once a Respond step has answered or the run is over it carries the answer: `data`, `httpStatus` and `responded` - the same values a sync call returns - beside the deprecated `result`.","headers":{"Deprecation":{"description":"Sent with the deprecated `result` member (RFC 9745): the date it was deprecated, 2026-10-05, as `@<unix seconds>`.","schema":{"type":"string"}},"Sunset":{"description":"Sent with the deprecated `result` member (RFC 8594): the date it is removed, 2026-12-01, as an HTTP-date.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionProjection"}}}},"403":{"description":"Not authorized to read this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown or expired execution, or one another gateway started.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/_/executions/{executionId}":{"get":{"tags":["Gateway runtime"],"summary":"Poll one gateway execution (deprecated alias)","description":"Deprecated alias of the same action at the gateway's own address `/api/{slug}/_/executions/{executionId}…`, kept for one release so a page loaded before the move keeps working (FAI-1423 removes it). Authorized identically; it does not check which gateway started the execution. Served by the gateway process (apps.<domain>), not the studio API host. Authorized inside the execution's own tenant, either by the anonymous execution token or by the endpoint's own credential: the Identity is resolved exactly as it was for the request that started the execution (a dynamic gateway picks the candidate the bearer's issuer names), the same authorization rules apply, and the verified subject must equal the one recorded at invocation.","deprecated":true,"security":[],"parameters":[{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The execution projection. Once a Respond step has answered or the run is over it carries the answer: `data`, `httpStatus` and `responded` - the same values a sync call returns - beside the deprecated `result`.","headers":{"Deprecation":{"description":"Sent with the deprecated `result` member (RFC 9745): the date it was deprecated, 2026-10-05, as `@<unix seconds>`.","schema":{"type":"string"}},"Sunset":{"description":"Sent with the deprecated `result` member (RFC 8594): the date it is removed, 2026-12-01, as an HTTP-date.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionProjection"}}}},"403":{"description":"Not authorized to read this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown or expired execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/{slug}/_/executions/{executionId}/cancel":{"post":{"tags":["Gateway runtime"],"summary":"Cancel one Flow execution at its gateway's own address","description":"Authorized exactly like polling. Cancellation is durable; a live worker may answer `cancelling` until polling observes the terminal `cancelled` state. An execution started through another gateway is a 404, like an unknown one.","security":[],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's slug - the gateway that started the execution."},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The execution was already terminal or is now cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionCancelProjection"}}}},"202":{"description":"Cancellation was recorded and a live worker was nudged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionCancelProjection"}}}},"403":{"description":"Not authorized to cancel this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown or expired execution, or one another gateway started.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The execution has not attached a Flow run yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/_/executions/{executionId}/cancel":{"post":{"tags":["Gateway runtime"],"summary":"Cancel one gateway Flow execution (deprecated alias)","description":"Deprecated alias of the same action at the gateway's own address `/api/{slug}/_/executions/{executionId}…`, kept for one release so a page loaded before the move keeps working (FAI-1423 removes it). Authorized identically; it does not check which gateway started the execution. Authorized exactly like polling. Cancellation is durable; a live worker may answer `cancelling` until polling observes the terminal `cancelled` state.","deprecated":true,"security":[],"parameters":[{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The execution was already terminal or is now cancelled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionCancelProjection"}}}},"202":{"description":"Cancellation was recorded and a live worker was nudged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionCancelProjection"}}}},"403":{"description":"Not authorized to cancel this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown or expired execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The execution has not attached a Flow run yet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/{slug}/_/executions/{executionId}/interactions/{interactionId}/submissions":{"post":{"tags":["Gateway runtime"],"summary":"Answer one open Form on an execution, at its gateway's own address","description":"Served by the gateway process (apps.<domain>), not the studio API host. Authorized exactly as polling is. Authorized inside the execution's own tenant, either by the anonymous execution token or by the endpoint's own credential: the Identity is resolved exactly as it was for the request that started the execution (a dynamic gateway picks the candidate the bearer's issuer names), the same authorization rules apply, and the verified subject must equal the one recorded at invocation. Invalid input is a 200 `awaiting_input` with per-field errors, not an error. An execution started through another gateway is a 404, like an unknown one.","security":[],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's slug - the gateway that started the execution."},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"The card's own id — a form's `requestId`. A lookup key, never a capability."},"required":true,"name":"interactionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowFormSubmissionBody"}}}},"responses":{"200":{"description":"Accepted, re-asked, or closed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowFormSubmissionResult"}}}},"400":{"description":"Malformed submission (a missing `expectedVersion`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"403":{"description":"Not authorized to act on this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown execution, or an interaction this caller does not own.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The form is closed, or the version is stale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"413":{"description":"The submission exceeds the size cap.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/_/executions/{executionId}/interactions/{interactionId}/submissions":{"post":{"tags":["Gateway runtime"],"summary":"Answer one open Form on a gateway execution (deprecated alias)","description":"Deprecated alias of the same action at the gateway's own address `/api/{slug}/_/executions/{executionId}…`, kept for one release so a page loaded before the move keeps working (FAI-1423 removes it). Authorized identically; it does not check which gateway started the execution. Served by the gateway process (apps.<domain>), not the studio API host. Authorized exactly as polling is. Authorized inside the execution's own tenant, either by the anonymous execution token or by the endpoint's own credential: the Identity is resolved exactly as it was for the request that started the execution (a dynamic gateway picks the candidate the bearer's issuer names), the same authorization rules apply, and the verified subject must equal the one recorded at invocation. Invalid input is a 200 `awaiting_input` with per-field errors, not an error.","deprecated":true,"security":[],"parameters":[{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"The card's own id — a form's `requestId`. A lookup key, never a capability."},"required":true,"name":"interactionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowFormSubmissionBody"}}}},"responses":{"200":{"description":"Accepted, re-asked, or closed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowFormSubmissionResult"}}}},"400":{"description":"Malformed submission (a missing `expectedVersion`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"403":{"description":"Not authorized to act on this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown execution, or an interaction this caller does not own.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The form is closed, or the version is stale.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"413":{"description":"The submission exceeds the size cap.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/{slug}/_/executions/{executionId}/interactions/{interactionId}/preview":{"get":{"tags":["Gateway runtime"],"summary":"Read one presented document's bounded preview, at its gateway's own address","description":"Served by the gateway process (apps.<domain>). Authorized exactly as polling is, then the interaction must be OWNED by this execution and the file must resolve under the caller's CURRENT verified audiences — Solution, then ACL, then quarantine. Reachable even when downloads are refused: viewing and keeping are different permissions. An execution started through another gateway is a 404, like an unknown one.","security":[],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's slug - the gateway that started the execution."},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"The card's own id — a form's `requestId`. A lookup key, never a capability."},"required":true,"name":"interactionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","enum":["1"],"description":"Renderer-only byte mode for a preview already classified as PDF or safe raster image. It does not authorize download."},"required":false,"name":"content","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The inert JSON preview, or attachment-framed PDF/image bytes when `content=1`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowCardPreviewResult"}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"403":{"description":"Not authorized to act on this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"One indistinguishable answer for an unknown execution, an interaction this caller does not own, a card that is not a document, and a file the caller may not see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The file is quarantined and cannot be served.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"422":{"description":"`content=1` was requested for a preview already represented as inert data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/_/executions/{executionId}/interactions/{interactionId}/preview":{"get":{"tags":["Gateway runtime"],"summary":"Read one presented document's bounded preview (deprecated alias)","description":"Deprecated alias of the same action at the gateway's own address `/api/{slug}/_/executions/{executionId}…`, kept for one release so a page loaded before the move keeps working (FAI-1423 removes it). Authorized identically; it does not check which gateway started the execution. Served by the gateway process (apps.<domain>). Authorized exactly as polling is, then the interaction must be OWNED by this execution and the file must resolve under the caller's CURRENT verified audiences — Solution, then ACL, then quarantine. Reachable even when downloads are refused: viewing and keeping are different permissions.","deprecated":true,"security":[],"parameters":[{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"The card's own id — a form's `requestId`. A lookup key, never a capability."},"required":true,"name":"interactionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","enum":["1"],"description":"Renderer-only byte mode for a preview already classified as PDF or safe raster image. It does not authorize download."},"required":false,"name":"content","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The inert JSON preview, or attachment-framed PDF/image bytes when `content=1`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowCardPreviewResult"}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"403":{"description":"Not authorized to act on this execution.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"One indistinguishable answer for an unknown execution, an interaction this caller does not own, a card that is not a document, and a file the caller may not see.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The file is quarantined and cannot be served.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"422":{"description":"`content=1` was requested for a preview already represented as inert data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/{slug}/_/executions/{executionId}/interactions/{interactionId}/file":{"get":{"tags":["Gateway runtime"],"summary":"Download one presented document's bytes, at its gateway's own address","description":"The same authorization chain as the preview, plus the live download policy: the node's authored narrowing is frozen on the card and the File Store's policy is read on every request, so tightening a store to `never` stops downloads already in flight. Bytes always leave as `Content-Disposition: attachment` with an executable-neutralised content type and `X-Content-Type-Options: nosniff` — apps.<domain> is one origin shared by every generated app. An execution started through another gateway is a 404, like an unknown one.","security":[],"parameters":[{"schema":{"type":"string","description":"The Flex Gateway's slug - the gateway that started the execution."},"required":true,"name":"slug","in":"path"},{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"The card's own id — a form's `requestId`. A lookup key, never a capability."},"required":true,"name":"interactionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","enum":["download"],"description":"Explicit download intent. Omitted remains compatible with older callers."},"required":false,"name":"intent","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The document, always as an attachment.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"403":{"description":"Not authorized to act on this execution, or the resolved download policy refuses the bytes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown execution, or a card this caller may not read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The file is quarantined and cannot be served.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}},"/api/_/executions/{executionId}/interactions/{interactionId}/file":{"get":{"tags":["Gateway runtime"],"summary":"Download one presented document's bytes (deprecated alias)","description":"Deprecated alias of the same action at the gateway's own address `/api/{slug}/_/executions/{executionId}…`, kept for one release so a page loaded before the move keeps working (FAI-1423 removes it). Authorized identically; it does not check which gateway started the execution. The same authorization chain as the preview, plus the live download policy: the node's authored narrowing is frozen on the card and the File Store's policy is read on every request, so tightening a store to `never` stops downloads already in flight. Bytes always leave as `Content-Disposition: attachment` with an executable-neutralised content type and `X-Content-Type-Options: nosniff` — apps.<domain> is one origin shared by every generated app.","deprecated":true,"security":[],"parameters":[{"schema":{"type":"string","description":"The opaque execution id from the 202 response."},"required":true,"name":"executionId","in":"path"},{"schema":{"type":"string","description":"The card's own id — a form's `requestId`. A lookup key, never a capability."},"required":true,"name":"interactionId","in":"path"},{"schema":{"type":"string","description":"Legacy anonymous execution token. Still accepted; new clients send the header.","deprecated":true},"required":false,"name":"t","in":"query"},{"schema":{"type":"string","enum":["download"],"description":"Explicit download intent. Omitted remains compatible with older callers."},"required":false,"name":"intent","in":"query"},{"schema":{"type":"string","description":"The anonymous execution token. Preferred over the legacy `?t=`."},"required":false,"name":"x-flexday-execution-token","in":"header"}],"responses":{"200":{"description":"The document, always as an attachment.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"403":{"description":"Not authorized to act on this execution, or the resolved download policy refuses the bytes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"404":{"description":"Unknown execution, or a card this caller may not read.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}},"409":{"description":"The file is quarantined and cannot be served.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GatewayErrorResponse"}}}}}}}}}