{"openapi":"3.1.0","info":{"title":"Agentkit API","version":"2.0.0","description":"This document describes the Agentkit v2 API. The /api/v1 API is legacy and intentionally undocumented. Authenticated requests are rate-limited per API key or user session, with the same limits on every plan: 300 requests per minute overall, 30 chat or retry requests per minute, and per agent 60 source edits or new URL, text or Q&A sources per minute and 6 retrains per hour. A request over a limit returns 429 RATE_LIMIT_TOO_MANY_REQUESTS with a Retry-After header. Developer documentation: https://agentkit.ai/docs/developer","termsOfService":"https://agentkit.ai/terms-of-service","contact":{"name":"Agentkit support","email":"team@agentkit.ai","url":"https://agentkit.ai/docs/developer"}},"externalDocs":{"description":"Agentkit developer documentation","url":"https://agentkit.ai/docs/developer"},"servers":[{"url":"https://agentkit.ai/api/v2"}],"security":[{"bearerAuth":[]}],"paths":{"/agents/{agentId}/channels":{"get":{"operationId":"listManagementChannels","summary":"List management channels","description":"Returns channel availability and connection state. Accepts a workspace API key or an explicit user session.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"}],"responses":{"200":{"description":"Channel inventory.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagementChannelList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/{channel}/config":{"get":{"operationId":"getManagementChannel","summary":"Get a management channel","description":"Returns one channel with its saved override, effective instructions, and settings revision.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ChannelId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"}],"responses":{"200":{"description":"Channel details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagementChannelDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateManagementChannelOverride","summary":"Update a channel override","description":"Replaces the channel instruction override and action allowlist. The email channel takes its instructions from the email settings, so it accepts only `instructionMode: \"inherit\"` with a null `instructionOverride`; anything else is rejected with 400. The help page and email channels remain in limited rollout and need a rollout-approved user session plus an eligible plan. WhatsApp and Center Stage are available to any caller with agent access on an eligible plan. The web and Instagram channels are available to any caller with access to the agent.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ChannelId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelOverrideRequest"}}}},"responses":{"200":{"description":"Updated channel details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagementChannelDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/web/presentation":{"patch":{"operationId":"updateWebPresentation","summary":"Update web presentation","description":"Optimistically updates widget or iframe enablement using a SHA-256 revision of the raw agent settings.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebPresentationRequest"}}}},"responses":{"200":{"description":"Updated web channel details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagementChannelDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/center-stage":{"get":{"operationId":"getCenterStage","summary":"Get Center Stage settings","description":"Returns the owner-facing Center Stage presentation, entitlement state, and settings revision. Requires an agent-owner session.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Center Stage settings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CenterStageView"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateCenterStage","summary":"Update Center Stage settings","description":"Optimistically replaces Center Stage settings. Requires an agent-owner session and eligible plan.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CenterStageRequest"}}}},"responses":{"200":{"description":"Updated Center Stage settings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CenterStageView"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/actions":{"get":{"operationId":"listCustomApiActions","summary":"List custom API actions","description":"Lists custom API action definitions, including the request configuration. Requires a user session: a stored configuration can hold literal downstream credentials, so an account API key never reads it.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Custom API actions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomApiActionList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"createCustomApiAction","summary":"Create a custom API action","description":"Creates a disabled server action. Test it before enabling it with the status route.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomApiActionRequest"}}}},"responses":{"201":{"description":"Created disabled action.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomApiAction"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/actions/{actionId}":{"get":{"operationId":"getCustomApiAction","summary":"Get a custom API action","description":"Returns one custom API action definition, including the request configuration. Requires a user session for the same reason as the list route.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ActionId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Custom API action.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomApiAction"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateCustomApiAction","summary":"Update a custom API action","description":"Updates an action using its loaded updatedAt value.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ActionId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomApiActionRequest"}}}},"responses":{"200":{"description":"Updated action.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomApiAction"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"deleteCustomApiAction","summary":"Delete a custom API action","description":"Deletes an action using its loaded updatedAt value.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ActionId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteCustomApiActionRequest"}}}},"responses":{"200":{"description":"Deletion confirmation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/actions/{actionId}/status":{"patch":{"operationId":"setCustomApiActionStatus","summary":"Enable or disable a custom API action","description":"Enables only a tested action with valid variables, destinations, secret references, and plan access.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ActionId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetCustomApiActionStatusRequest"}}}},"responses":{"200":{"description":"Updated action.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomApiAction"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/secrets":{"get":{"operationId":"listAgentSecrets","summary":"List action secret metadata","description":"Lists secret names and metadata. The response never contains plaintext or ciphertext.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"}],"responses":{"200":{"description":"Secret metadata.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretMetadataList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/secrets/{name}":{"put":{"operationId":"setAgentSecret","summary":"Set an action secret","description":"Encrypts a secret value and returns metadata only. The value is write-only.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SecretName"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetAgentSecretRequest"}}}},"responses":{"200":{"description":"Secret metadata.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"deleteAgentSecret","summary":"Delete an action secret","description":"Deletes one named action secret.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SecretName"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Deletion confirmation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets":{"get":{"operationId":"listWidgets","summary":"List widgets","description":"Lists non-archived widgets. Requires a rollout-approved user session.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Widgets.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"createWidget","summary":"Create a widget","description":"Creates a widget draft. Requires a rollout-approved user session.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWidgetRequest"}}}},"responses":{"201":{"description":"Created widget.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Widget"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/import":{"post":{"operationId":"importWidget","summary":"Import a widget package","description":"Validates and imports a portable widget package as a draft.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportWidgetRequest"}}}},"responses":{"201":{"description":"Imported widget and compile warnings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetMutationResult"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/{widgetId}":{"get":{"operationId":"getWidget","summary":"Get a widget","description":"Returns one widget draft.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Widget.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Widget"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"saveWidgetDraft","summary":"Save a widget draft","description":"Optimistically replaces a widget draft using its loaded updatedAt value.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveWidgetDraftRequest"}}}},"responses":{"200":{"description":"Saved widget.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Widget"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"deleteWidget","summary":"Delete a widget","description":"Deletes one widget.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Deletion confirmation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/{widgetId}/status":{"patch":{"operationId":"setWidgetStatus","summary":"Set widget status","description":"Sets a widget to draft or archived.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetWidgetStatusRequest"}}}},"responses":{"200":{"description":"New status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetStatusResult"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/{widgetId}/publish":{"post":{"operationId":"publishWidget","summary":"Publish a widget","description":"Compiles and publishes the loaded draft using optimistic concurrency.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishWidgetRequest"}}}},"responses":{"200":{"description":"Published immutable version and warnings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishedWidgetResult"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/{widgetId}/versions":{"get":{"operationId":"listWidgetVersions","summary":"List widget versions","description":"Lists immutable versions newest first.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Widget versions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetVersionList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/{widgetId}/versions/{versionId}":{"get":{"operationId":"getWidgetVersion","summary":"Get a widget version","description":"Returns one immutable compiled widget version.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/WidgetVersionId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Widget version.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetVersion"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/{widgetId}/duplicate":{"post":{"operationId":"duplicateWidget","summary":"Duplicate a widget","description":"Creates a draft copy of one widget.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Duplicated widget.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Widget"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/widgets/{widgetId}/export":{"get":{"operationId":"exportWidget","summary":"Export a widget","description":"Returns the portable .widget package without action credentials.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/WidgetId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Portable widget package.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WidgetPackage"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/backstage/overview":{"get":{"operationId":"getBackstageOverview","summary":"Get Backstage overview","description":"Returns a bounded agent inventory for an MFA-verified super-admin user session with agent membership. Available on every plan.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Agent inventory.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageOverview"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/backstage/sessions":{"get":{"operationId":"listBackstageSessions","summary":"List Backstage sessions","description":"Lists Backstage sessions in reverse creation order.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Session page.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageSessionList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/backstage/sessions/{sessionId}":{"get":{"operationId":"getBackstageSession","summary":"Get a Backstage session","description":"Returns a session and its latest 40 user and assistant messages.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/BackstageSessionId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Session detail.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageSessionDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"deleteBackstageSession","summary":"Delete a Backstage session","description":"Deletes one Backstage session.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/BackstageSessionId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Deletion confirmation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/backstage/changes/{changeId}":{"get":{"operationId":"getBackstageChange","summary":"Get a Backstage change","description":"Returns one proposed change and its review display.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/BackstageChangeId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Change state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageChange"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"decideBackstageChange","summary":"Decide a Backstage change","description":"Approves or rejects one proposed change after write-access checks.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/BackstageChangeId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageDecisionRequest"}}}},"responses":{"200":{"description":"Resulting change state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageChangeState"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/backstage/runs/{runId}":{"get":{"operationId":"getBackstageRun","summary":"Read a durable Backstage run","description":"Returns saved progress for the session owner. Requires super-admin and MFA; available on every plan.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Saved run progress.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageRun"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"cancelBackstageRun","summary":"Stop Backstage reasoning","description":"Cancels this run. Already approved ingestion jobs continue.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"name":"runId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Saved run state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageRun"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/backstage/chat":{"post":{"operationId":"chatWithBackstage","summary":"Chat with Backstage","description":"Admits one durable request for one shared message credit. Retry with identical clientMessageId and content to recover its run. Poll the run endpoint; disconnecting does not cancel work.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageMessageRequest"}}}},"responses":{"202":{"description":"Durable run admission.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BackstageRunAdmission"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails":{"get":{"operationId":"listEmailThreads","summary":"list Email Threads","description":"Accepts an account API key with API access and agent ownership, or an explicit user session with the existing email rollout and MFA. Reads remain available when email is disabled, including discarded email. Returns lightweight summaries in activity order. Cursors bind agent, status and since filters.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"status","in":"query","schema":{"type":"string","enum":["all","to_review","sent","discarded"],"default":"all"}},{"name":"since","in":"query","schema":{"type":"string","format":"date-time"}},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailThreadList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/{threadId}":{"get":{"operationId":"getEmailThread","summary":"get Email Thread","description":"Accepts an account API key with API access and agent ownership, or an explicit user session with the existing email rollout and MFA. Reads remain available when email is disabled, including discarded email. Returns all stored bodies, normalized headers, immutable ingestion disposition, discard reason and draft revisions. Reading does not mark read. Repeated historical headers retain their stored joined representation.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"threadId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailThreadDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/{threadId}/discard":{"post":{"operationId":"discardEmailThread","summary":"discard Email Thread","description":"Accepts an account API key with API access and agent ownership, or a user session with rollout, MFA and settings.manage permission (or personal ownership). Works when email is disabled. Never sends, generates or forwards mail. Only discards the reviewed inbound/draft snapshot. Stale state returns 409.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"threadId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDiscardRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailMutationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/{threadId}/restore":{"post":{"operationId":"restoreEmailThread","summary":"restore Email Thread","description":"Accepts an account API key with API access and agent ownership, or a user session with rollout, MFA and settings.manage permission (or personal ownership). Works when email is disabled. Never sends, generates or forwards mail. Restores review visibility without generation, actions or delivery. Retired drafts stay retired.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"threadId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailRestoreRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailMutationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/{threadId}/draft":{"post":{"operationId":"draftEmailThread","summary":"draft Email Thread","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Explicitly requests a draft. It never auto-sends and rejects system verification mail.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"},{"name":"threadId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailMutationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/messages/{messageId}":{"get":{"operationId":"getEmailMessage","summary":"get Email Message","description":"Accepts an account API key with API access and agent ownership, or an explicit user session with the existing email rollout and MFA. Reads remain available when email is disabled, including discarded email. Returns the stored body, addresses, normalized headers and ingestion disposition. Reading does not change inbox state.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailMessageDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/messages/{messageId}/forward":{"post":{"operationId":"forwardEmailMessage","summary":"forward Email Message","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Forwards stored message text without attachments. Reuse submissionId after an ambiguous timeout and read back the outcome.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"},{"name":"messageId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailForwardRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailMutationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/drafts":{"get":{"operationId":"listEmailDrafts","summary":"list Email Drafts","description":"Accepts an account API key with API access and agent ownership, or an explicit user session with the existing email rollout and MFA. Reads remain available when email is disabled, including discarded email. Lists pending drafts in generation order.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"since","in":"query","schema":{"type":"string","format":"date-time"}},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDraftList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/drafts/{draftId}":{"get":{"operationId":"getEmailDraft","summary":"get Email Draft","description":"Accepts an account API key with API access and agent ownership, or an explicit user session with the existing email rollout and MFA. Reads remain available when email is disabled, including discarded email. ","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDraftDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"editEmailDraft","summary":"edit Email Draft","description":"Accepts an account API key with API access, agent ownership and email entitlement, or a user session with rollout, MFA and settings.manage permission. Requires an explicit reviewed draft revision. Key approvals retain the API key identity in the send audit. Atomically compares the reviewed revision and rejects newer inbound mail or a claimed send.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailEditRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailDraftDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/emails/drafts/{draftId}/send":{"post":{"operationId":"sendEmailDraft","summary":"send Email Draft","description":"Accepts an account API key with API access, agent ownership and email entitlement, or a user session with rollout, MFA and settings.manage permission. Requires an explicit reviewed draft revision. Key approvals retain the API key identity in the send audit. Approves the reviewed draft revision. Repeated delivery uses the same draft identity. Already sent is a success; ignored and empty are not delivered.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/OptionalSessionAuthMode"},{"name":"draftId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailSendRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailMutationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/email/enable":{"post":{"operationId":"enableEmailChannel","summary":"enable Email Channel","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Atomically enables and provisions an inbox. address is an exact initial local part on the configured inbound domain. Different choices for an existing inbox conflict.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailEnableRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/email/disable":{"post":{"operationId":"disableEmailChannel","summary":"disable Email Channel","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Preserves inbox address, routing and history.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/email/settings":{"get":{"operationId":"getEmailSettings","summary":"get Email Settings","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. ","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateEmailSettings","summary":"update Email Settings","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Patches supplied fields only. signatureHtml currently stores plain text. Empty text clears the signature.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailSettingsRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/email/reply-address":{"get":{"operationId":"getEmailReplyAddress","summary":"get Email Reply Address","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. ","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"put":{"operationId":"addEmailReplyAddress","summary":"add Email Reply Address","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Delivers a code to the reply mailbox without returning it. Replaces the existing single inbox reply routing.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailAddressRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailReplyAddressResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"removeEmailReplyAddress","summary":"remove Email Reply Address","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Clears routing and verification while preserving inbox and history.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailChannelResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/email/reply-address/verify":{"post":{"operationId":"verifyEmailReplyAddress","summary":"verify Email Reply Address","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Consumes a six-digit mailbox code under existing expiry and attempt limits.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailVerifyRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailReplyAddressResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/email/automated-senders":{"get":{"operationId":"listEmailAutomatedSenders","summary":"list Email Automated Senders","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. ","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailAutomatedSendersResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"addEmailAutomatedSender","summary":"add Email Automated Sender","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. Adds an exact sender preference for future automated mail to reach review. It never grants tools, generation or automatic replies.","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailAddressRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailAutomatedSendersResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"removeEmailAutomatedSender","summary":"remove Email Automated Sender","description":"Requires an explicit user session, API access and the existing email rollout. MFA must be satisfied. Writes require settings.manage permission (or personal ownership) and email entitlement, except disable and removal cleanup. ","security":[{"sessionBearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/SessionAuthMode"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailAddressRequest"}}}},"responses":{"200":{"description":"Email operation result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailAutomatedSendersResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/auth/device/code":{"post":{"operationId":"createDeviceCode","summary":"Start a CLI browser login","description":"Issues a device code for the CLI and a user code for the person to approve at the verification URL. No authentication. Limited to 10 codes per IP address per hour.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceCodeRequest"}}}},"responses":{"200":{"description":"A device code to poll with and a user code to show the person.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceCode"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"429":{"description":"Too many codes were requested from this IP address.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["rate_limited"]}}}}}}}}},"/auth/device/token":{"post":{"operationId":"redeemDeviceCode","summary":"Poll for the API key of a CLI browser login","description":"Poll at the interval returned with the device code. Once the person approves, the response carries a new API key exactly once; the raw key is never stored. No authentication.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceTokenRequest"}}}},"responses":{"200":{"description":"The login was approved. The key is returned once.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceToken"}}}},"400":{"description":"`authorization_pending`: keep polling. `slow_down`: polled inside the interval; use the returned `interval` from now on. `expired_token`: the code is older than 10 minutes. `access_denied`: the person pressed Deny. `invalid_grant`: unknown, already redeemed, or lost a concurrent redemption.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceTokenError"}}}},"403":{"description":"The approving user is no longer a member of the workspace.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["access_denied"]}}}}}},"409":{"description":"The workspace already has 25 active API keys.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["key_limit_reached"]}}}}}}}}},"/auth/key":{"delete":{"operationId":"revokeCurrentApiKey","summary":"Revoke the calling API key","description":"Deletes the API key that authenticates the request. Any scope is enough. A user-session caller gets 400 `not_an_api_key`.","responses":{"204":{"description":"The key was revoked.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}}},"400":{"description":"The caller used a user session, not an API key.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["not_an_api_key"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/me":{"get":{"operationId":"getCurrentCredential","summary":"Describe the calling credential","description":"Returns the workspace and the credential behind the request. Any scope is enough. For a user session, `account` is set only when the user belongs to exactly one workspace.","security":[{"bearerAuth":[]},{"sessionBearerAuth":[]}],"responses":{"200":{"description":"The workspace and credential.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrentCredential"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/health":{"get":{"operationId":"getHealth","summary":"Check API health","description":"Checks whether the v2 API is available. This endpoint does not require authentication.","security":[],"responses":{"200":{"description":"The API is available.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/agents":{"get":{"operationId":"listAgents","summary":"List agents","description":"Lists the agents owned by the workspace in reverse creation order.","parameters":[{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of agents.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"createAgent","summary":"Create an agent","description":"Creates an agent in the workspace. Empty or null URL values are stored as null.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentRequest"}}}},"responses":{"201":{"description":"The created agent.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}":{"get":{"operationId":"getAgent","summary":"Get an agent","description":"Returns one agent owned by the authenticated workspace.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The requested agent.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateAgent","summary":"Update an agent","description":"Updates an agent name or URL. At least one field is required.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAgentRequest"}}}},"responses":{"200":{"description":"The updated agent.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"delete":{"operationId":"deleteAgent","summary":"Delete an agent","description":"Deletes an agent owned by the authenticated workspace.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"Confirmation that the agent was deleted.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/chat":{"post":{"operationId":"chatWithAgent","summary":"Send a chat message","description":"Sends a message to an agent. Assistant text uses Markdown. Streaming is enabled by default; set stream to false to receive one JSON response.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}}},"responses":{"200":{"description":"A Server-Sent Events stream when stream is true, or one JSON assistant message when stream is false.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/EventStream"}},"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/conversations":{"get":{"operationId":"listConversations","summary":"List conversations","description":"Lists conversation summaries. The source filter defaults to API v2 conversations.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/ConversationSource"},{"$ref":"#/components/parameters/ConversationUnread"}],"responses":{"200":{"description":"A page of conversation summaries.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/conversations/export":{"get":{"operationId":"exportConversations","summary":"Export conversations","description":"Exports up to 20 conversations per page with every non-tool message ordered from oldest to newest.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"name":"limit","in":"query","required":false,"description":"Maximum conversations to return.","schema":{"type":"integer","minimum":1,"maximum":20,"default":20}},{"$ref":"#/components/parameters/Cursor"},{"$ref":"#/components/parameters/ConversationSource"},{"$ref":"#/components/parameters/ConversationUnread"}],"responses":{"200":{"description":"A page of conversations with complete transcripts.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationExportList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/conversations/{conversationId}":{"get":{"operationId":"getConversation","summary":"Get a conversation","description":"Returns one conversation and its complete non-tool transcript for the selected source.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ConversationId"},{"$ref":"#/components/parameters/ConversationSource"}],"responses":{"200":{"description":"The conversation and its transcript.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetail"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/conversations/{conversationId}/messages":{"get":{"operationId":"listConversationMessages","summary":"List conversation messages","description":"Lists non-tool messages in a conversation selected by source. Omitted source includes api_v2 and API Playground tests. Messages within a page are ordered from oldest to newest.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ConversationId"},{"$ref":"#/components/parameters/ConversationMessageSource"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"A page of conversation messages.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/conversations/{conversationId}/messages/{messageId}/feedback":{"patch":{"operationId":"updateMessageFeedback","summary":"Set or clear message feedback","description":"Sets positive or negative feedback on an AI assistant message, or clears feedback with null.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ConversationId"},{"$ref":"#/components/parameters/MessageId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}}},"responses":{"200":{"description":"The assistant message with its updated feedback.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageEnvelope"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/conversations/{conversationId}/retry":{"post":{"operationId":"retryConversation","summary":"Retry an assistant reply","description":"Regenerates an AI assistant reply from its preceding user message and removes the selected reply and later messages.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ConversationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetryRequest"}}}},"responses":{"200":{"description":"A Server-Sent Events stream when stream is true, or one regenerated assistant message when stream is false.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/EventStream"}},"application/json":{"schema":{"$ref":"#/components/schemas/RetryResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/agents/{agentId}/conversations/{conversationId}/tool-result":{"post":{"operationId":"submitToolResult","summary":"Submit a client-side tool result","description":"Claims a pending client action once and streams the assistant continuation.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/ConversationId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolResultRequest"}}}},"responses":{"200":{"description":"Assistant continuation after the tool result, always as Server-Sent Events.","content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/EventStream"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/users/{userId}/conversations":{"get":{"operationId":"listUserConversations","summary":"List conversations for a user","description":"Lists API v2 conversations associated with one caller-supplied end-user ID.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/UserId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"name":"source","in":"query","required":false,"description":"Only api_v2 is accepted because user IDs are written by API v2 chat.","schema":{"type":"string","enum":["api_v2"],"default":"api_v2"}},{"$ref":"#/components/parameters/ConversationUnread"}],"responses":{"200":{"description":"A page of conversations for the end user.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/sources":{"get":{"operationId":"listSources","summary":"List training sources","description":"Lists the text, Q&A, URL, and uploaded-file sources attached to an agent.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"name":"sourceType","in":"query","required":false,"description":"Restricts results to one stored source type.","schema":{"type":"string","enum":["web_crawl","file_upload","text_snippet","qna_entry"]}}],"responses":{"200":{"description":"A page of training sources.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/sources/text":{"post":{"operationId":"createTextSource","summary":"Add a text source","description":"Adds a titled text snippet to the agent training sources.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTextSourceRequest"}}}},"responses":{"201":{"description":"The text source was created.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCreated"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/sources/qna":{"post":{"operationId":"createQnaSource","summary":"Add a Q&A source","description":"Adds question variants and their answer to the agent training sources.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateQnaSourceRequest"}}}},"responses":{"201":{"description":"The Q&A source was created.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCreated"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/sources/url":{"post":{"operationId":"createUrlSource","summary":"Add or retrain a URL source","description":"Queues one public HTTP or HTTPS URL for indexing, or retrains it when it already exists.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUrlSourceRequest"}}}},"responses":{"202":{"description":"The URL processing job was queued.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UrlSourceJob"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/agents/{agentId}/sources/file/upload-url":{"post":{"operationId":"createFileUploadUrls","summary":"Create signed file upload URLs","description":"Creates signed storage upload URLs for one to 20 supported files. Each URL reserves the declared `size` (50 MB when omitted) against the account upload budget until the file is registered and processed, or the URL expires after two hours. Returns 429 when too many uploads are outstanding or too many URLs were requested in the last hour.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFileUploadUrlsRequest"}}}},"responses":{"200":{"description":"Signed upload details for each file.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadUrls"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/agents/{agentId}/sources/file":{"post":{"operationId":"registerFileSources","summary":"Register uploaded file sources","description":"Validates previously uploaded files and queues them for processing. Each path must come from an unexpired upload URL, can be registered once (a repeat returns 409), and its object must not exceed the declared size.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterFilesRequest"}}}},"responses":{"202":{"description":"The file processing job was queued.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileProcessingJob"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/agents/{agentId}/sources/{documentId}":{"get":{"operationId":"getSource","summary":"Read a training source","description":"Requires read scope. Q&A entries also include their parsed questions and answer.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/DocumentId"}],"responses":{"200":{"description":"The source and its full stored content.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"patch":{"operationId":"updateSource","summary":"Edit a training source","description":"Requires write scope. Send at least one field for the stored source type. Q&A entries accept title, questions and answer. Other sources accept title and content. The stored content, including serialized Q&A, is limited to 262,144 UTF-8 bytes. A successful edit replaces the source and its embeddings together.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/DocumentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSourceRequest"}}}},"responses":{"200":{"description":"The source and its full stored content.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceDetailResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"delete":{"operationId":"deleteSource","summary":"Delete a source","description":"Deletes one training source identified by its UUID.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/DocumentId"}],"responses":{"200":{"description":"Confirmation that the source was deleted.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/contacts":{"get":{"operationId":"listContacts","summary":"List contacts","description":"Lists contacts in reverse creation order, optionally filtered by a case-insensitive substring search.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"name":"search","in":"query","required":false,"description":"Case-insensitive substring search across external ID, email, name, and phone.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of contacts.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"upsertContact","summary":"Create or update a contact","description":"Upserts one contact by external ID. Omitted profile fields preserve stored values; null or empty values clear them. Custom attributes accept JSON values.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertContactRequest"}}}},"responses":{"201":{"description":"The inserted or updated contact.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Contact"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/contacts/import":{"post":{"operationId":"importContacts","summary":"Import contacts","description":"Bulk upserts one to 1,000 contacts and keeps the last row for duplicate external IDs.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportContactsRequest"}}}},"responses":{"200":{"description":"Counts of processed and deduplicated rows.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportContactsResult"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/leads":{"get":{"operationId":"listLeads","summary":"List captured leads","description":"Lists captured leads in reverse submission order with optional inclusive datetime bounds.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"},{"name":"createdAfter","in":"query","required":false,"description":"Inclusive lower bound as an ISO 8601 datetime.","schema":{"type":"string","format":"date-time"}},{"name":"createdBefore","in":"query","required":false,"description":"Inclusive upper bound as an ISO 8601 datetime.","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"A page of captured leads.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadList"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/settings/ai":{"get":{"operationId":"getAiSettings","summary":"Get AI settings","description":"Returns the current AI settings as a bare object. Unset settings produce an empty object.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The current AI settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSettings"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateAiSettings","summary":"Update AI settings","description":"Updates the model, instruction preset, or instruction prompt. At least one field is required.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAiSettingsRequest"}}}},"responses":{"200":{"description":"The updated AI settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiSettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/settings/design":{"get":{"operationId":"getDesignSettings","summary":"Get design settings","description":"Returns the current title, language, position, branding, and conversation settings.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The current design settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DesignSettings"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateDesignSettings","summary":"Update design settings","description":"Updates design fields and returns the complete persisted settings object. At least one field is required.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDesignSettingsRequest"}}}},"responses":{"200":{"description":"The complete updated agent settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/settings/security":{"get":{"operationId":"getSecuritySettings","summary":"Get security settings","description":"Returns the current security settings as a bare object. Unset settings produce an empty object.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The current security settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecuritySettings"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateSecuritySettings","summary":"Update security settings","description":"Updates privacy, rate-limit, or allowed-domain settings. At least one top-level field is required.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSecuritySettingsRequest"}}}},"responses":{"200":{"description":"The updated security settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecuritySettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/settings/notifications":{"get":{"operationId":"getNotificationSettings","summary":"Get notification settings","description":"Returns the current notification settings as a bare object. Unset settings produce an empty object.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The current notification settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSettings"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateNotificationSettings","summary":"Update notification settings","description":"Updates daily conversation, daily email, or quota alert preferences. At least one field is required.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNotificationSettingsRequest"}}}},"responses":{"200":{"description":"The updated notification settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationSettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/settings/training":{"get":{"operationId":"getTrainingSettings","summary":"Get training settings","description":"Returns the current training settings as a bare object. Unset settings produce an empty object.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The current training settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingSettings"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateTrainingSettings","summary":"Update training settings","description":"Enables or disables automatic retraining for the agent.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTrainingSettingsRequest"}}}},"responses":{"200":{"description":"The updated training settings.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingSettings"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/train":{"get":{"operationId":"getTrainingStatus","summary":"Get training status","description":"Returns document counts, the last training time, and the most recent active training job.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The current training status.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"startTraining","summary":"Start web-source retraining","description":"Starts retraining for indexed web URLs. If no web source exists, no job is created.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"No web sources were available to retrain.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingJob"}}}},"202":{"description":"Retraining was queued.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingJob"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/instagram":{"get":{"operationId":"getInstagramChannel","summary":"Get the Instagram channel","description":"Returns the connection, all four automations, conversation starters, and persistent menu. An unconnected agent returns connected false.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The Instagram channel summary.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramChannel"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/instagram/automations/{key}":{"get":{"operationId":"getInstagramAutomation","summary":"Get an Instagram automation","description":"Returns one configured Instagram automation or its default configuration.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/AutomationKey"}],"responses":{"200":{"description":"The automation status and configuration.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramAutomation"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateInstagramAutomation","summary":"Update an Instagram automation","description":"Saves the complete automation configuration, changes its status, or does both. At least one field is required. The accepted config shape is fixed by the key in the path: respond_to_dms takes RespondToDmsConfig, comment_to_dm takes CommentToDmConfig, story_leads takes StoryLeadsConfig, story_mentions takes StoryMentionsConfig.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/AutomationKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInstagramAutomationRequest"}}}},"responses":{"200":{"description":"The saved automation status and configuration.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramAutomation"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/instagram/automations/{key}/instances":{"get":{"operationId":"listInstagramAutomationInstances","summary":"List Instagram automation instances","description":"Lists every saved row of a many-instance automation kind (comment_to_dm or story_leads), oldest first. Each instance carries its own id, status and configuration; at most one live instance may target a given post or story and at most one live catch-all may exist per kind. The legacy /automations/{key} route keeps addressing the oldest instance.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/AutomationInstanceKey"}],"responses":{"200":{"description":"The automation instances, oldest first.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/InstagramAutomationInstance"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"post":{"operationId":"createInstagramAutomationInstance","summary":"Create an Instagram automation instance","description":"Creates a new row of a many-instance automation kind from a complete configuration. Without a status the row is saved as a draft; status live validates the configuration and enforces live cardinality (409 INSTAGRAM_AUTOMATION_TARGET_TAKEN when another live instance already targets the same post or story, 409 INSTAGRAM_AUTOMATION_CATCH_ALL_EXISTS when a live catch-all already exists).","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/AutomationInstanceKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateInstagramAutomationInstanceRequest"}}}},"responses":{"201":{"description":"The created automation instance.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramAutomationInstance"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/instagram/automations/{key}/instances/{id}":{"get":{"operationId":"getInstagramAutomationInstance","summary":"Get an Instagram automation instance","description":"Returns one row of a many-instance automation kind by id. An id that belongs to another agent or another kind is a 404.","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/AutomationInstanceKey"},{"$ref":"#/components/parameters/AutomationInstanceId"}],"responses":{"200":{"description":"The automation instance.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramAutomationInstance"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateInstagramAutomationInstance","summary":"Update an Instagram automation instance","description":"Saves the complete configuration of one instance, changes its status, or both — the same rules as the legacy key route, applied to exactly this row. Status off is how an instance is retired; there is no delete. Going live enforces live cardinality (409 INSTAGRAM_AUTOMATION_TARGET_TAKEN / INSTAGRAM_AUTOMATION_CATCH_ALL_EXISTS).","parameters":[{"$ref":"#/components/parameters/AgentId"},{"$ref":"#/components/parameters/AutomationInstanceKey"},{"$ref":"#/components/parameters/AutomationInstanceId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInstagramAutomationInstanceRequest"}}}},"responses":{"200":{"description":"The saved automation instance.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramAutomationInstance"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/agents/{agentId}/channels/instagram/conversation-starters":{"get":{"operationId":"getInstagramConversationStarters","summary":"Get Instagram conversation starters","description":"Returns the saved draft and confirmed live conversation starters for the connected account.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The conversation starter state.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramConversationStarters"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateInstagramConversationStarters","summary":"Update Instagram conversation starters","description":"Saves starter prompts, changes their status, or does both. Publishing or clearing synchronizes with Instagram.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInstagramConversationStartersRequest"}}}},"responses":{"200":{"description":"The stored and confirmed conversation starter state.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramConversationStarters"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"502":{"$ref":"#/components/responses/BadGateway"}}}},"/agents/{agentId}/channels/instagram/menu":{"get":{"operationId":"getInstagramMenu","summary":"Get the Instagram persistent menu","description":"Returns the saved draft and confirmed live persistent menu for the connected account.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The persistent menu state.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramMenu"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}},"patch":{"operationId":"updateInstagramMenu","summary":"Update the Instagram persistent menu","description":"Saves menu items, changes menu status, or does both. Publishing or clearing synchronizes with Instagram.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInstagramMenuRequest"}}}},"responses":{"200":{"description":"The stored and confirmed persistent menu state.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramMenu"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"429":{"$ref":"#/components/responses/TooManyRequests"},"502":{"$ref":"#/components/responses/BadGateway"}}}},"/agents/{agentId}/channels/instagram/permissions/refresh":{"post":{"operationId":"refreshInstagramPermissions","summary":"Refresh Instagram permissions","description":"Checks the connected account permissions and returns the verification outcome and latest connection state.","parameters":[{"$ref":"#/components/parameters/AgentId"}],"responses":{"200":{"description":"The permission verification outcome.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramPermissionRefresh"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Send the workspace API key as Authorization: Bearer <key>. A key holds a subset of the scopes read, write, delete and export: GET needs read, POST, PUT and PATCH need write, DELETE needs delete, and the conversation export needs export. A request outside the key scopes returns 403 with {\"error\": \"insufficient_scope\", \"required\": \"<scope>\"}."},"sessionBearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"Supabase JWT","description":"A Supabase user access JWT. Also send X-Agentkit-Auth: session."}},"headers":{"RequestId":{"description":"Unique request identifier. Include this value when contacting support.","schema":{"type":"string","format":"uuid"}},"RetryAfter":{"description":"Seconds to wait before sending the request again.","schema":{"type":"integer","minimum":1}},"RateLimitLimit":{"description":"Requests the exceeded limit allows per window. Sent when an API request limit was exceeded.","schema":{"type":"integer","minimum":1}},"RateLimitRemaining":{"description":"Requests left in the current window, always 0 on a 429. Sent when an API request limit was exceeded.","schema":{"type":"integer","minimum":0}},"RateLimitReset":{"description":"Unix time in seconds when the current window ends. Sent when an API request limit was exceeded.","schema":{"type":"integer"}}},"parameters":{"OptionalSessionAuthMode":{"name":"X-Agentkit-Auth","in":"header","required":false,"description":"Set to session when Authorization contains a Supabase user access JWT. Required when selecting session authentication; omit when using a workspace API key.","schema":{"type":"string","const":"session"}},"SessionAuthMode":{"name":"X-Agentkit-Auth","in":"header","required":true,"description":"Selects explicit user-session authentication.","schema":{"type":"string","const":"session"}},"WidgetId":{"name":"widgetId","in":"path","required":true,"description":"Widget UUID.","schema":{"type":"string","format":"uuid"}},"ActionId":{"name":"actionId","in":"path","required":true,"description":"Custom API action UUID.","schema":{"type":"string","format":"uuid"}},"SecretName":{"name":"name","in":"path","required":true,"description":"Action secret name.","schema":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9_]{0,63}$"}},"WidgetVersionId":{"name":"versionId","in":"path","required":true,"description":"Immutable widget version UUID.","schema":{"type":"string","format":"uuid"}},"ChannelId":{"name":"channel","in":"path","required":true,"description":"Management channel identifier.","schema":{"type":"string","enum":["web","help_page","center_stage","instagram","whatsapp","email"]}},"BackstageSessionId":{"name":"sessionId","in":"path","required":true,"description":"Backstage session UUID.","schema":{"type":"string","format":"uuid"}},"BackstageChangeId":{"name":"changeId","in":"path","required":true,"description":"Backstage proposed-change UUID.","schema":{"type":"string","format":"uuid"}},"Limit":{"name":"limit","in":"query","required":false,"description":"Maximum number of records to return.","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},"Cursor":{"name":"cursor","in":"query","required":false,"description":"Opaque base64url cursor returned by the preceding page. Replay it unchanged.","schema":{"type":"string","contentEncoding":"base64url","pattern":"^[A-Za-z0-9_-]+$"}},"AgentId":{"name":"agentId","in":"path","required":true,"description":"Agent UUID.","schema":{"type":"string","format":"uuid"}},"ConversationId":{"name":"conversationId","in":"path","required":true,"description":"Public conversation reference ID.","schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{16}$"}},"MessageId":{"name":"messageId","in":"path","required":true,"description":"Positive numeric message ID serialized as a string.","schema":{"type":"string","pattern":"^[1-9][0-9]*$"}},"UserId":{"name":"userId","in":"path","required":true,"description":"Caller-supplied stable end-user ID.","schema":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-zA-Z0-9._-]+$"}},"DocumentId":{"name":"documentId","in":"path","required":true,"description":"Training source document UUID.","schema":{"type":"string","format":"uuid"}},"AutomationInstanceKey":{"name":"key","in":"path","required":true,"description":"A many-instance Instagram automation kind: comment_to_dm or story_leads. The singleton kinds have no instances.","schema":{"type":"string","enum":["comment_to_dm","story_leads"]}},"AutomationInstanceId":{"name":"id","in":"path","required":true,"description":"Instagram automation instance id.","schema":{"type":"string","format":"uuid"}},"AutomationKey":{"name":"key","in":"path","required":true,"description":"Instagram automation key.","schema":{"type":"string","enum":["respond_to_dms","comment_to_dm","story_leads","story_mentions"]}},"ConversationMessageSource":{"name":"source","in":"query","required":false,"description":"Conversation source. Omit it to include api_v2 and API Playground tests. Use all to include API v2, widget, Instagram, API Playground, Center Stage and Help Page conversations.","schema":{"type":"string","enum":["api_v2","widget","instagram","playground","center_stage","help_page","all"]}},"ConversationSource":{"name":"source","in":"query","required":false,"description":"Conversation source. Use all to include API v2, widget, Instagram, API Playground, Center Stage and Help Page conversations. Use playground to select API Playground tests.","schema":{"type":"string","enum":["api_v2","widget","instagram","playground","center_stage","help_page","all"],"default":"api_v2"}},"ConversationUnread":{"name":"unread","in":"query","required":false,"description":"Use true for unread conversations or false for read conversations. Omit it to include both. The parameter may appear once.","schema":{"type":"boolean"}}},"responses":{"BadRequest":{"description":"The request body, path value, or query value is invalid.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"The bearer API key is missing or invalid.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"The workspace plan does not permit the request, a quota was reached, or the API key lacks the scope this operation needs. A missing scope answers with the flat `InsufficientScope` body instead of the error envelope.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Error"},{"$ref":"#/components/schemas/InsufficientScope"}]}}}},"NotFound":{"description":"The requested agent or resource was not found.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalServerError":{"description":"The server could not complete the request.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"The request conflicts with the current resource state. For a concurrent source edit, read the latest source before retrying.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"UnprocessableEntity":{"description":"The request is well-formed but its content cannot be processed.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"A rate limit was exceeded. Every authenticated request counts against a per-credential limit of 300 requests per minute; chat and retry share 30 per minute per credential; source edits and URL, text and Q&A source creation share 60 per minute per agent; retraining allows 6 per hour per agent. These limits are the same on every plan, and `error.details.bucket` names the one that was exceeded (`general`, `chat`, `sources` or `training`). File upload URLs and Backstage requests have their own limits and send `Retry-After` without the `X-RateLimit-*` headers.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"},"Retry-After":{"$ref":"#/components/headers/RetryAfter"},"X-RateLimit-Limit":{"$ref":"#/components/headers/RateLimitLimit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/RateLimitRemaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/RateLimitReset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"BadGateway":{"description":"Instagram rejected or failed to confirm the change.","headers":{"x-request-id":{"$ref":"#/components/headers/RequestId"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"CustomApiDataInput":{"type":"object","additionalProperties":false,"required":["name","type","description","isArray"],"properties":{"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","number","boolean"]},"description":{"type":"string"},"isArray":{"type":"boolean"},"source":{"type":"string","enum":["model","trusted_email_or_model"],"description":"Where the value comes from. `trusted_email_or_model` lets a verified email address be substituted server-side and is accepted only on a scalar text parameter."}},"allOf":[{"if":{"properties":{"source":{"const":"trusted_email_or_model"}},"required":["source"]},"then":{"properties":{"type":{"const":"text"},"isArray":{"const":false}}}}]},"CustomApiKeyValue":{"type":"object","additionalProperties":false,"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"type":"string"}}},"CustomApiRequest":{"type":"object","additionalProperties":false,"required":["method","url","queryParams","headers","body"],"properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"url":{"type":"string"},"queryParams":{"type":"array","items":{"$ref":"#/components/schemas/CustomApiKeyValue"}},"headers":{"type":"array","items":{"$ref":"#/components/schemas/CustomApiKeyValue"}},"body":{"type":"string"}}},"CustomApiTestResponse":{"type":"object","additionalProperties":false,"required":["useExampleResponse","exampleResponse","testVariables","sampleResponse"],"properties":{"useExampleResponse":{"type":"boolean"},"exampleResponse":{"type":"string"},"testVariables":{"type":"array","items":{"$ref":"#/components/schemas/CustomApiKeyValue"}},"sampleResponse":{"type":"string"}},"allOf":[{"if":{"properties":{"useExampleResponse":{"const":true}},"required":["useExampleResponse"]},"then":{"properties":{"exampleResponse":{"type":"string","pattern":"\\S"}},"required":["exampleResponse"]}}]},"CustomApiDataAccess":{"type":"object","additionalProperties":false,"required":["mode"],"properties":{"mode":{"type":"string","enum":["full","limited"]},"selectedFields":{"type":"array","items":{"type":"string"}}}},"CustomApiActionFields":{"type":"object","additionalProperties":false,"required":["actionName","whenToUse","executionType","dataInputs","apiRequest","testResponse","dataAccess"],"properties":{"actionName":{"type":"string","minLength":1,"maxLength":255,"pattern":"[a-zA-Z0-9]","description":"Tool name exposed to the model. Spaces become underscores and any other character outside `[a-zA-Z0-9_]` is stripped, so the value must contain at least one letter or digit."},"whenToUse":{"type":"string","minLength":1},"executionType":{"type":"string","const":"server"},"dataInputs":{"type":"array","items":{"$ref":"#/components/schemas/CustomApiDataInput"}},"apiRequest":{"$ref":"#/components/schemas/CustomApiRequest"},"testResponse":{"$ref":"#/components/schemas/CustomApiTestResponse"},"dataAccess":{"$ref":"#/components/schemas/CustomApiDataAccess"}}},"CreateCustomApiActionRequest":{"allOf":[{"$ref":"#/components/schemas/CustomApiActionFields"}]},"UpdateCustomApiActionRequest":{"type":"object","additionalProperties":false,"required":["expectedUpdatedAt"],"properties":{"expectedUpdatedAt":{"type":"string","format":"date-time"},"actionName":{"type":"string","minLength":1,"maxLength":255,"pattern":"[a-zA-Z0-9]","description":"Tool name exposed to the model. Spaces become underscores and any other character outside `[a-zA-Z0-9_]` is stripped, so the value must contain at least one letter or digit."},"whenToUse":{"type":"string","minLength":1},"executionType":{"type":"string","const":"server"},"dataInputs":{"type":"array","items":{"$ref":"#/components/schemas/CustomApiDataInput"}},"apiRequest":{"$ref":"#/components/schemas/CustomApiRequest"},"testResponse":{"$ref":"#/components/schemas/CustomApiTestResponse"},"dataAccess":{"$ref":"#/components/schemas/CustomApiDataAccess"}},"anyOf":[{"required":["actionName"]},{"required":["whenToUse"]},{"required":["executionType"]},{"required":["dataInputs"]},{"required":["apiRequest"]},{"required":["testResponse"]},{"required":["dataAccess"]}]},"SetCustomApiActionStatusRequest":{"type":"object","additionalProperties":false,"required":["expectedUpdatedAt","enabled"],"properties":{"expectedUpdatedAt":{"type":"string","format":"date-time"},"enabled":{"type":"boolean"}}},"DeleteCustomApiActionRequest":{"type":"object","additionalProperties":false,"required":["expectedUpdatedAt"],"properties":{"expectedUpdatedAt":{"type":"string","format":"date-time"}}},"CustomApiAction":{"type":"object","additionalProperties":false,"required":["id","actionName","whenToUse","executionType","dataInputs","apiRequest","testResponse","dataAccess","enabled","createdAt","updatedAt"],"properties":{"id":{"type":"string","format":"uuid"},"actionName":{"type":"string","minLength":1,"maxLength":255,"pattern":"[a-zA-Z0-9]","description":"Tool name exposed to the model. Spaces become underscores and any other character outside `[a-zA-Z0-9_]` is stripped, so the value must contain at least one letter or digit."},"whenToUse":{"type":"string","minLength":1},"executionType":{"type":"string","const":"server"},"dataInputs":{"type":"array","items":{"$ref":"#/components/schemas/CustomApiDataInput"}},"apiRequest":{"$ref":"#/components/schemas/CustomApiRequest"},"testResponse":{"$ref":"#/components/schemas/CustomApiTestResponse"},"dataAccess":{"$ref":"#/components/schemas/CustomApiDataAccess"},"enabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"CustomApiActionList":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CustomApiAction"}}}},"SetAgentSecretRequest":{"type":"object","additionalProperties":false,"required":["value"],"properties":{"value":{"type":"string","minLength":1,"maxLength":16384,"writeOnly":true},"description":{"type":["string","null"],"maxLength":500}}},"SecretMetadata":{"type":"object","additionalProperties":false,"required":["name","description","hasValue","createdAt","updatedAt"],"properties":{"name":{"type":"string"},"description":{"type":["string","null"]},"hasValue":{"type":"boolean","const":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"SecretMetadataList":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SecretMetadata"}}}},"ChannelOverrideRequest":{"type":"object","additionalProperties":false,"required":["instructionMode","instructionOverride","actionAllowlist"],"properties":{"instructionMode":{"type":"string","enum":["inherit","custom"],"description":"The email channel accepts only `inherit`; every other channel accepts both."},"instructionOverride":{"type":["string","null"],"maxLength":8000},"actionAllowlist":{"type":["array","null"],"maxItems":500,"items":{"type":"string","format":"uuid"}}}},"WebPresentationRequest":{"type":"object","additionalProperties":false,"required":["expectedRevision"],"properties":{"widgetEnabled":{"type":"boolean"},"iframeEnabled":{"type":"boolean"},"expectedRevision":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"anyOf":[{"required":["widgetEnabled"]},{"required":["iframeEnabled"]}]},"CenterStageSettings":{"type":"object","additionalProperties":false,"required":["enabled","title","position","appearance","primaryColor","primaryColorHeader","profilePictureUrl","initialMessages","messagePlaceholder","suggestedPrompts","attachmentsEnabled","dictationEnabled"],"properties":{"enabled":{"type":"boolean"},"title":{"type":["string","null"],"minLength":1,"maxLength":80},"position":{"type":"string","enum":["bottom-left","bottom-right"]},"appearance":{"type":"string","enum":["Light","Dark"]},"primaryColor":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},"primaryColorHeader":{"type":"boolean"},"profilePictureUrl":{"type":["string","null"],"format":"uri"},"initialMessages":{"type":"array","maxItems":5,"items":{"type":"string","minLength":1,"maxLength":500}},"messagePlaceholder":{"type":"string","minLength":1,"maxLength":100},"suggestedPrompts":{"type":"object","additionalProperties":false,"required":["enabled","keepShowing","prompts"],"properties":{"enabled":{"type":"boolean"},"keepShowing":{"type":"boolean"},"prompts":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":120}}}},"attachmentsEnabled":{"type":"boolean"},"dictationEnabled":{"type":"boolean"}}},"CenterStageRequest":{"type":"object","additionalProperties":false,"required":["settings","expectedRevision"],"properties":{"settings":{"$ref":"#/components/schemas/CenterStageSettings"},"expectedRevision":{"type":"string","pattern":"^[a-f0-9]{64}$"}}},"CenterStageView":{"type":"object","required":["chatbotId","siteName","settings","widgetSettings","audience","configured","entitled","isPrivate","revision"],"properties":{"chatbotId":{"type":"string","format":"uuid"},"siteName":{"type":"string"},"settings":{"$ref":"#/components/schemas/CenterStageSettings"},"widgetSettings":{"type":"object","required":["position","branding","conversation","security","features"],"properties":{"title":{"type":"string"},"language":{"type":"string"},"position":{"type":"string","enum":["bottom-left","bottom-right"]},"branding":{"type":"object","required":["appearance","primaryColor","primaryColorHeader"],"properties":{"appearance":{"type":"string","enum":["Light","Dark"]},"primaryColor":{"type":"string"},"bubbleColor":{"type":"string"},"primaryColorHeader":{"type":"boolean"},"bubbleIconUrl":{"type":"string"},"profilePictureUrl":{"type":"string"},"hideBranding":{"type":"boolean"}}},"conversation":{"type":"object","required":["initialMessages","messagePlaceholder","defaultPrompts"],"properties":{"initialMessages":{"type":"array","items":{"type":"string"}},"messagePlaceholder":{"type":"string"},"showInitialMessageBubble":{"type":"boolean"},"defaultPrompts":{"type":"object","required":["enabled","keepShowing","prompts"],"properties":{"enabled":{"type":"boolean"},"keepShowing":{"type":"boolean"},"prompts":{"type":"array","items":{"type":"string"}}}}}},"security":{"type":"object","properties":{"rateLimit":{"type":"object","required":["maxMessages","windowSeconds","limitMessage"],"properties":{"maxMessages":{"type":"number"},"windowSeconds":{"type":"number"},"limitMessage":{"type":"string"}}}}},"features":{"type":"object","required":["attachments","dictation"],"properties":{"attachments":{"type":"boolean"},"dictation":{"type":"boolean"}}}}},"audience":{"const":"owner"},"configured":{"type":"boolean"},"bubbleTitle":{"type":"string"},"entitled":{"type":"boolean"},"isPrivate":{"type":"boolean"},"revision":{"type":"string","pattern":"^[a-f0-9]{64}$"}}},"ManagementChannel":{"type":"object","required":["id","state","visible","enabled","connected","entitled"],"properties":{"id":{"type":"string","enum":["web","help_page","center_stage","instagram","whatsapp","email"]},"state":{"type":"string","enum":["connected","enabled","disabled","needs_attention","unavailable","upgrade"]},"visible":{"type":"boolean"},"enabled":{"type":"boolean"},"connected":{"type":"boolean"},"entitled":{"type":"boolean"},"detail":{"type":["string","null"]},"widgetEnabled":{"type":"boolean"},"iframeEnabled":{"type":"boolean"}}},"ManagementChannelList":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ManagementChannel"}}}},"ChannelOverride":{"type":["object","null"],"additionalProperties":false,"properties":{"instructionMode":{"type":"string","enum":["inherit","custom"]},"instructionOverride":{"type":["string","null"]},"actionAllowlist":{"type":["array","null"],"items":{"type":"string","format":"uuid"}},"instructionAppendix":{"type":"string"}}},"ManagementChannelDetail":{"allOf":[{"$ref":"#/components/schemas/ManagementChannel"},{"type":"object","required":["override","effectiveInstructions","revision"],"properties":{"override":{"$ref":"#/components/schemas/ChannelOverride"},"effectiveInstructions":{"type":"string"},"revision":{"type":"string","pattern":"^[a-f0-9]{64}$"}}}]},"WidgetVariable":{"type":"object","additionalProperties":false,"required":["name","type"],"properties":{"name":{"type":"string","pattern":"^[a-z][a-zA-Z0-9_]{0,39}$"},"type":{"type":"string","enum":["string","number","boolean"]},"default":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]}}},"WidgetFunction":{"type":"object","required":["id","name","type"],"properties":{"id":{"type":"string","pattern":"^[a-z][a-zA-Z0-9_]{0,39}$"},"name":{"type":"string","maxLength":60},"description":{"type":"string","maxLength":300},"type":{"type":"string","enum":["server","client","send_message","link","dismiss","set_variables"]},"inputs":{"type":"array","items":{"type":"object","required":["name","type"],"properties":{"name":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean"]},"required":{"type":"boolean"},"description":{"type":"string"}}}},"loading":{"type":"string","enum":["none","self","container"]},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"url":{"type":"string"},"headers":{"type":"array","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"query":{"type":"array","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string"},"value":{"type":"string"}}}},"body":{"type":"string"},"returnFields":{"type":"array","items":{"type":"string"}},"tool":{"type":"string"},"awaitResponse":{"type":"boolean"},"text":{"type":"string"},"hideUserMessage":{"type":"boolean"},"target":{"type":"string","enum":["blank","self","parent"]},"variables":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]}}}},"WidgetStateCondition":{"oneOf":[{"type":"object","required":["field","operator"],"properties":{"field":{"type":"string"},"operator":{"type":"string","enum":["equals","not_equals","contains","not_contains","greater_than","less_than","empty","not_empty"]},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]}}},{"type":"object","required":["all"],"properties":{"all":{"type":"array","items":{"$ref":"#/components/schemas/WidgetStateCondition"}}}},{"type":"object","required":["any"],"properties":{"any":{"type":"array","items":{"$ref":"#/components/schemas/WidgetStateCondition"}}}}]},"WidgetState":{"type":"object","additionalProperties":false,"required":["name","visibility"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"visibility":{"type":"string","enum":["always","hidden","conditional"]},"condition":{"$ref":"#/components/schemas/WidgetStateCondition"}}},"WidgetSchemaNode":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["string","number","boolean","enum","literal","array","object","record","union"]},"optional":{"type":"boolean"},"nullable":{"type":"boolean"},"description":{"type":"string"},"default":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]},"format":{"type":"string","enum":["email","url","date","datetime"]},"minLength":{"type":"number"},"maxLength":{"type":"number"},"integer":{"type":"boolean"},"min":{"type":"number"},"max":{"type":"number"},"values":{"type":"array","items":{"type":"string"}},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"items":{"$ref":"#/components/schemas/WidgetSchemaNode"},"minItems":{"type":"number"},"maxItems":{"type":"number"},"properties":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["key","schema"],"properties":{"key":{"type":"string"},"schema":{"$ref":"#/components/schemas/WidgetSchemaNode"}}}},"options":{"type":"array","items":{"$ref":"#/components/schemas/WidgetSchemaNode"}}}},"WidgetExpression":{"oneOf":[{"type":"object","additionalProperties":false,"required":["k","v"],"properties":{"k":{"const":"lit"},"v":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}]}}},{"type":"object","additionalProperties":false,"required":["k","root","segs"],"properties":{"k":{"const":"path"},"root":{"type":"string","enum":["data","variables","scope"]},"segs":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"number"}]}}}},{"type":"object","additionalProperties":false,"required":["k","parts"],"properties":{"k":{"const":"tpl"},"parts":{"type":"array","items":{"oneOf":[{"type":"string"},{"$ref":"#/components/schemas/WidgetExpression"}]}}}},{"type":"object","additionalProperties":false,"required":["k","e"],"properties":{"k":{"const":"not"},"e":{"$ref":"#/components/schemas/WidgetExpression"}}},{"type":"object","additionalProperties":false,"required":["k","op","l","r"],"properties":{"k":{"const":"bin"},"op":{"type":"string","enum":["&&","||","==","!=","===","!==","<","<=",">",">="]},"l":{"$ref":"#/components/schemas/WidgetExpression"},"r":{"$ref":"#/components/schemas/WidgetExpression"}}},{"type":"object","additionalProperties":false,"required":["k","test","then","else"],"properties":{"k":{"const":"cond"},"test":{"$ref":"#/components/schemas/WidgetExpression"},"then":{"$ref":"#/components/schemas/WidgetExpression"},"else":{"$ref":"#/components/schemas/WidgetExpression"}}},{"type":"object","additionalProperties":false,"required":["k","entries"],"properties":{"k":{"const":"obj"},"entries":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["key","value"],"properties":{"key":{"type":"string"},"value":{"$ref":"#/components/schemas/WidgetExpression"}}}}}},{"type":"object","additionalProperties":false,"required":["k","items"],"properties":{"k":{"const":"arr"},"items":{"type":"array","items":{"$ref":"#/components/schemas/WidgetExpression"}}}},{"type":"object","additionalProperties":false,"required":["k","id"],"properties":{"k":{"const":"fn"},"id":{"type":"string"}}}]},"WidgetElementNode":{"type":"object","additionalProperties":false,"required":["t","tag","props","children"],"properties":{"t":{"const":"el"},"tag":{"type":"string"},"props":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/WidgetExpression"}},"children":{"type":"array","items":{"$ref":"#/components/schemas/WidgetAstNode"}}}},"WidgetAstNode":{"oneOf":[{"$ref":"#/components/schemas/WidgetElementNode"},{"type":"object","additionalProperties":false,"required":["t","value"],"properties":{"t":{"const":"text"},"value":{"type":"string"}}},{"type":"object","additionalProperties":false,"required":["t","expr"],"properties":{"t":{"const":"expr"},"expr":{"$ref":"#/components/schemas/WidgetExpression"}}},{"type":"object","additionalProperties":false,"required":["t","test","then"],"properties":{"t":{"const":"if"},"test":{"$ref":"#/components/schemas/WidgetExpression"},"then":{"type":"array","items":{"$ref":"#/components/schemas/WidgetAstNode"}},"else":{"type":"array","items":{"$ref":"#/components/schemas/WidgetAstNode"}}}},{"type":"object","additionalProperties":false,"required":["t","source","item","body"],"properties":{"t":{"const":"map"},"source":{"$ref":"#/components/schemas/WidgetExpression"},"item":{"type":"string"},"index":{"type":"string"},"body":{"type":"array","items":{"$ref":"#/components/schemas/WidgetAstNode"}}}},{"type":"object","additionalProperties":false,"required":["t","name","children"],"properties":{"t":{"const":"state"},"name":{"type":"string"},"children":{"type":"array","items":{"$ref":"#/components/schemas/WidgetAstNode"}}}}]},"WidgetAst":{"type":"object","additionalProperties":false,"required":["languageVersion","catalogVersion","root"],"properties":{"languageVersion":{"type":"integer"},"catalogVersion":{"type":"integer"},"root":{"$ref":"#/components/schemas/WidgetElementNode"}}},"WidgetDraft":{"type":"object","additionalProperties":false,"required":["source","schemaSource"],"properties":{"source":{"type":"string"},"schemaSource":{"type":"string","maxLength":16384},"examples":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["name","data"],"properties":{"name":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9 _-]{0,39}$"},"data":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]},"functionResults":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]}}}}},"functions":{"type":"array","items":{"$ref":"#/components/schemas/WidgetFunction"}},"states":{"type":"array","items":{"$ref":"#/components/schemas/WidgetState"}},"variables":{"type":"array","items":{"$ref":"#/components/schemas/WidgetVariable"}}}},"CreateWidgetRequest":{"type":"object","required":["name","draft"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":500},"draft":{"$ref":"#/components/schemas/WidgetDraft"}}},"SaveWidgetDraftRequest":{"type":"object","required":["expectedUpdatedAt","draft"],"properties":{"expectedUpdatedAt":{"type":"string","format":"date-time"},"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":["string","null"]},"draft":{"$ref":"#/components/schemas/WidgetDraft"}}},"SetWidgetStatusRequest":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["draft","archived"]}}},"PublishWidgetRequest":{"type":"object","required":["expectedUpdatedAt"],"properties":{"expectedUpdatedAt":{"type":"string","format":"date-time"}}},"Widget":{"type":"object","additionalProperties":false,"required":["id","account_id","chatbot_id","created_at","created_by","description","draft","name","published_version_id","status","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"account_id":{"type":"string","format":"uuid"},"chatbot_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"created_by":{"type":["string","null"],"format":"uuid"},"description":{"type":["string","null"]},"draft":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]},"name":{"type":"string"},"published_version_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"WidgetList":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Widget"}}}},"WidgetStatusResult":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["draft","archived"]}}},"DefinitionIssue":{"type":"object","required":["scope","message"],"properties":{"scope":{"type":"string","enum":["source","schema","examples","functions","states","variables","package"]},"message":{"type":"string"},"line":{"type":"integer"},"column":{"type":"integer"},"code":{"type":"string"}}},"WidgetVersionSummary":{"type":"object","required":["id","version_number","content_hash","language_version","catalog_version","created_at","created_by"],"properties":{"id":{"type":"string","format":"uuid"},"version_number":{"type":"integer"},"content_hash":{"type":"string","pattern":"^[a-f0-9]{64}$"},"language_version":{"type":"integer"},"catalog_version":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"created_by":{"type":["string","null"],"format":"uuid"}}},"WidgetVersionList":{"type":"array","items":{"$ref":"#/components/schemas/WidgetVersionSummary"}},"CompiledWidgetDefinition":{"type":"object","additionalProperties":false,"required":["languageVersion","catalogVersion","source","schemaSource","schema","ast","examples","functions","states","variables","dependencies","hash"],"properties":{"languageVersion":{"type":"integer"},"catalogVersion":{"type":"integer"},"source":{"type":"string"},"schemaSource":{"type":"string","maxLength":16384},"schema":{"$ref":"#/components/schemas/WidgetSchemaNode"},"ast":{"$ref":"#/components/schemas/WidgetAst"},"examples":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["name","data"],"properties":{"name":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9 _-]{0,39}$"},"data":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]},"functionResults":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]}}}}},"functions":{"type":"array","items":{"$ref":"#/components/schemas/WidgetFunction"}},"states":{"type":"array","items":{"$ref":"#/components/schemas/WidgetState"}},"variables":{"type":"array","items":{"$ref":"#/components/schemas/WidgetVariable"}},"dependencies":{"type":"object","additionalProperties":false,"required":["functions","states","variables"],"properties":{"functions":{"type":"array","items":{"type":"string"}},"states":{"type":"array","items":{"type":"string"}},"variables":{"type":"array","items":{"type":"string"}}}},"hash":{"type":"string","pattern":"^[a-f0-9]{64}$"}}},"WidgetVersion":{"allOf":[{"$ref":"#/components/schemas/WidgetVersionSummary"},{"type":"object","required":["chatbot_id","widget_id","definition"],"properties":{"chatbot_id":{"type":"string","format":"uuid"},"widget_id":{"type":"string","format":"uuid"},"definition":{"$ref":"#/components/schemas/CompiledWidgetDefinition"}}}]},"PublishedWidgetResult":{"type":"object","required":["ok","version","warnings"],"properties":{"ok":{"type":"boolean","const":true},"version":{"$ref":"#/components/schemas/WidgetVersion"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/DefinitionIssue"}}}},"WidgetMutationResult":{"type":"object","required":["ok","widget","warnings"],"properties":{"ok":{"type":"boolean","const":true},"widget":{"$ref":"#/components/schemas/Widget"},"warnings":{"type":"array","items":{"$ref":"#/components/schemas/DefinitionIssue"}}}},"WidgetPackage":{"type":"object","required":["manifest","widget"],"properties":{"manifest":{"type":"object","required":["format","version","languageVersion","catalogVersion","hash"],"properties":{"format":{"type":"string"},"version":{"type":"integer"},"languageVersion":{"type":"integer"},"catalogVersion":{"type":"integer"},"exportedAt":{"type":"string","format":"date-time"},"hash":{"type":"string","pattern":"^[a-f0-9]{64}$"}}},"widget":{"type":"object","required":["name","source","schemaSource","examples","functions","states","variables"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"source":{"type":"string"},"schemaSource":{"type":"string"},"examples":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["name","data"],"properties":{"name":{"type":"string","pattern":"^[A-Za-z][A-Za-z0-9 _-]{0,39}$"},"data":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]},"functionResults":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]}}}}},"functions":{"type":"array","items":{"$ref":"#/components/schemas/WidgetFunction"}},"states":{"type":"array","items":{"$ref":"#/components/schemas/WidgetState"}},"variables":{"type":"array","items":{"$ref":"#/components/schemas/WidgetVariable"}}}}}},"ImportWidgetRequest":{"type":"object","required":["package"],"properties":{"package":{"$ref":"#/components/schemas/WidgetPackage"}}},"BackstageOverview":{"type":"object","required":["agent","sourceCounts","sources","actions","procedures","channels"],"properties":{"agent":{"type":"object","required":["name","model","trainingState","sourceCount","enabledActionCount","activeProcedureCount","enabledChannelCount"],"properties":{"name":{"type":"string"},"model":{"type":"string"},"trainingState":{"type":"string","enum":["empty","ready","training","needs_attention"]},"sourceCount":{"type":"integer"},"enabledActionCount":{"type":"integer"},"activeProcedureCount":{"type":"integer"},"enabledChannelCount":{"type":"integer"}}},"sourceCounts":{"type":"array","items":{"type":"object","required":["type","count"],"properties":{"type":{"type":"string","enum":["web_crawl","file_upload","text_snippet","qna_entry"]},"count":{"type":"integer"}}}},"sources":{"type":"array","items":{"type":"object","required":["id","type","name","typeTrainingStatus","lastTrainedAt"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string"},"name":{"type":"string"},"typeTrainingStatus":{"type":"string","enum":["ready","training","failed"]},"lastTrainedAt":{"type":"string"}}}},"actions":{"type":"array","items":{"type":"object","required":["id","name","type","enabled","runCount"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string"},"enabled":{"type":"boolean"},"runCount":{"type":["integer","null"]}}}},"procedures":{"type":"array","items":{"type":"object","required":["id","name","status","runCount","pendingCount","failedCount"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string"},"runCount":{"type":"integer"},"pendingCount":{"type":"integer"},"failedCount":{"type":"integer"}}}},"channels":{"type":"array","items":{"$ref":"#/components/schemas/ManagementChannel"}}}},"BackstageSession":{"type":"object","required":["id","title","created_at","updated_at"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"BackstageSessionList":{"type":"object","required":["data","hasMore","nextCursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BackstageSession"}},"hasMore":{"type":"boolean"},"nextCursor":{"type":["string","null"]}}},"BackstageDisplayPart":{"oneOf":[{"type":"object","required":["type","text"],"properties":{"type":{"const":"text"},"text":{"type":"string"}}},{"type":"object","required":["type","title","items"],"properties":{"type":{"const":"metrics"},"title":{"type":"string"},"items":{"type":"array","items":{"type":"object","required":["label","value"],"properties":{"label":{"type":"string"},"value":{"oneOf":[{"type":"string"},{"type":"number"}]},"detail":{"type":"string"}}}}}},{"type":"object","required":["type","label","href"],"properties":{"type":{"const":"link"},"label":{"type":"string"},"href":{"type":"string"}}},{"type":"object","required":["type","title","chartType","xKey","series","data","tableColumns"],"properties":{"type":{"const":"chart"},"title":{"type":"string"},"chartType":{"type":"string","enum":["bar","line","area"]},"xKey":{"type":"string"},"series":{"type":"array","items":{"type":"object","required":["key","label"],"properties":{"key":{"type":"string"},"label":{"type":"string"}}}},"data":{"type":"array","items":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"}]}}},"tableColumns":{"type":"array","items":{"type":"string"}}}},{"type":"object","required":["type","title","columns","rows"],"properties":{"type":{"const":"table"},"title":{"type":"string"},"columns":{"type":"array","items":{"type":"object","required":["key","label"],"properties":{"key":{"type":"string"},"label":{"type":"string"}}}},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]}}}}},{"type":"object","required":["type","changeSetId","summary","expiresAt","changes"],"properties":{"type":{"const":"changes"},"changeSetId":{"type":"string","format":"uuid"},"summary":{"type":"string"},"expiresAt":{"type":["string","null"],"format":"date-time"},"changes":{"type":"array","items":{"$ref":"#/components/schemas/BackstageChangeDisplay"}}}}]},"BackstageStoredPart":{"oneOf":[{"type":"object","required":["type","text"],"properties":{"type":{"const":"text"},"text":{"type":"string"}}},{"type":"object","required":["type","data"],"properties":{"type":{"const":"data-display"},"data":{"$ref":"#/components/schemas/BackstageDisplayPart"}}},{"type":"object","required":["type","data"],"properties":{"type":{"const":"data-trace"},"data":{"type":"object","required":["durationMs"],"properties":{"durationMs":{"type":"number","minimum":0}}}}},{"type":"object","required":["type","data"],"properties":{"type":{"const":"data-suggestions"},"data":{"type":"array","maxItems":3,"items":{"type":"string"}}}},{"type":"object","required":["type","toolName","toolCallId","state","input","output"],"properties":{"type":{"const":"dynamic-tool"},"toolName":{"type":"string"},"toolCallId":{"type":"string"},"state":{"const":"output-available"},"input":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{}},{"type":"object","additionalProperties":true}]},"output":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"}}}}}]},"BackstageMessage":{"type":"object","required":["id","role","parts"],"properties":{"id":{"type":"string"},"role":{"type":"string","enum":["user","assistant"]},"parts":{"type":"array","items":{"$ref":"#/components/schemas/BackstageStoredPart"}}}},"BackstageSessionDetail":{"allOf":[{"$ref":"#/components/schemas/BackstageSession"},{"type":"object","required":["activeRunId","messages","messageLimit"],"properties":{"activeRunId":{"type":["string","null"],"format":"uuid"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/BackstageMessage"}},"messageLimit":{"type":"integer","const":40}}}]},"BackstageChangeDisplay":{"type":"object","required":["id","position","operation","title","target","body","href"],"properties":{"id":{"type":"string","format":"uuid"},"position":{"type":"integer"},"operation":{"type":"string"},"eligibility":{"type":"string","enum":["ready","upgrade-required","setup-required"]},"title":{"type":"string"},"target":{"type":"string"},"body":{"oneOf":[{"type":"object","required":["kind","before","after"],"properties":{"kind":{"const":"diff"},"before":{"type":"string"},"after":{"type":"string"}}},{"type":"object","required":["kind","rows"],"properties":{"kind":{"const":"table"},"rows":{"type":"array","items":{"type":"object","required":["label","before","after"],"properties":{"label":{"type":"string"},"before":{"type":["string","null"]},"after":{"type":["string","null"]}}}}}}]},"href":{"type":["string","null"]}}},"BackstageChangeState":{"type":"object","required":["id","status","errorCode","href"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","executing","executed","queued","running","rejected","stale","failed","expired","superseded"]},"errorCode":{"type":["string","null"]},"href":{"type":["string","null"]}}},"BackstageChange":{"allOf":[{"$ref":"#/components/schemas/BackstageChangeState"},{"type":"object","required":["display"],"properties":{"display":{"$ref":"#/components/schemas/BackstageChangeDisplay"}}}]},"BackstageDecisionRequest":{"type":"object","additionalProperties":false,"required":["decision"],"properties":{"decision":{"type":"string","enum":["approve","reject"]},"acknowledgeUntested":{"type":"boolean"}}},"BackstageMessageRequest":{"type":"object","additionalProperties":false,"required":["message","clientMessageId"],"properties":{"message":{"type":"string","minLength":1,"maxLength":4000},"clientMessageId":{"type":"string","minLength":1,"maxLength":128},"sessionId":{"type":"string","format":"uuid"},"testChangeId":{"type":"string","format":"uuid"}}},"BackstageRunAdmission":{"type":"object","required":["runId","sessionId","status"],"properties":{"runId":{"type":"string","format":"uuid"},"sessionId":{"type":["string","null"],"format":"uuid"},"status":{"type":"string"},"remaining":{"type":"integer","minimum":0}}},"BackstageRun":{"type":"object","required":["id","session_id","status","parts"],"properties":{"id":{"type":"string","format":"uuid"},"session_id":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["queued","running","completed","failed","cancelled"]},"parts":{"type":"array","items":{"$ref":"#/components/schemas/BackstageStoredPart"}},"error_code":{"type":["string","null"]}}},"EmailEnableRequest":{"type":"object","properties":{"address":{"type":"string","minLength":1,"maxLength":64}},"additionalProperties":false},"EmailSettingsRequest":{"type":"object","properties":{"autoSendEnabled":{"type":"boolean"},"signatureEnabled":{"type":"boolean"},"signatureHtml":{"type":"string","maxLength":2000},"displayName":{"type":"string","minLength":1,"maxLength":120}},"additionalProperties":false,"minProperties":1},"EmailAddressRequest":{"type":"object","properties":{"address":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"}},"required":["address"],"additionalProperties":false},"EmailVerifyRequest":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"],"additionalProperties":false},"EmailDiscardRequest":{"type":"object","properties":{"draftId":{"anyOf":[{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},{"type":"null"}]},"draftEditedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"inboundMessageId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["draftId","draftEditedAt"],"additionalProperties":false,"anyOf":[{"required":["inboundMessageId"],"properties":{"inboundMessageId":{"type":"string","format":"uuid"}}},{"required":["draftId","draftEditedAt"],"properties":{"draftId":{"type":"string","format":"uuid"},"draftEditedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}}}]},"EmailRestoreRequest":{"type":"object","properties":{"expectedRevision":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"}},"required":["expectedRevision"],"additionalProperties":false},"EmailForwardRequest":{"type":"object","properties":{"to":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"note":{"default":"","type":"string","maxLength":4000},"submissionId":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"}},"required":["to","submissionId"],"additionalProperties":false},"EmailSendRequest":{"type":"object","properties":{"expectedRevision":{"type":"string","pattern":"^\\d+$"}},"required":["expectedRevision"],"additionalProperties":false},"EmailEditRequest":{"type":"object","properties":{"expectedRevision":{"type":"string","pattern":"^\\d+$"},"bodyText":{"type":"string","minLength":1,"maxLength":12000},"subject":{"type":"string","minLength":1,"maxLength":300}},"required":["expectedRevision","bodyText"],"additionalProperties":false},"EmailThreadList":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["to_review","sent","discarded"]},"discarded":{"type":"boolean"},"discardSource":{"anyOf":[{"type":"string"},{"type":"null"}]},"discardReason":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"customerName":{"type":"string"},"customerEmail":{"type":"string"},"subject":{"type":"string"},"lastActivityAt":{"type":"string"},"revision":{"type":"string"}},"required":["id","status","discarded","discardSource","discardReason","customerName","customerEmail","subject","lastActivityAt","revision"]}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasMore":{"type":"boolean"}},"required":["limit","nextCursor","hasMore"]}},"required":["data","pagination"]},"EmailThreadDetail":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["to_review","sent","discarded"]},"discarded":{"type":"boolean"},"discardSource":{"anyOf":[{"type":"string"},{"type":"null"}]},"discardReason":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"customerName":{"type":"string"},"customerEmail":{"type":"string"},"subject":{"type":"string"},"lastActivityAt":{"type":"string"},"revision":{"type":"string"},"emailAddressId":{"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"direction":{"type":"string"},"draftId":{"anyOf":[{"type":"string"},{"type":"null"}]},"providerEmailId":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromAddress":{"type":"string"},"toAddresses":{"type":"array","items":{"type":"string"}},"ccAddresses":{"type":"array","items":{"type":"string"}},"bccAddresses":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"headers":{},"createdAt":{"type":"string"},"processingDisposition":{"type":"string"},"discardReason":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","threadId","direction","draftId","providerEmailId","fromAddress","toAddresses","ccAddresses","bccAddresses","subject","text","html","headers","createdAt","processingDisposition","discardReason"]}},"drafts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"status":{"type":"string"},"subject":{"type":"string"},"bodyText":{"type":"string"},"reviewCategory":{"anyOf":[{"type":"string"},{"type":"null"}]},"reviewReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatedAt":{"type":"string"},"sentAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"string"},"deliveryStatus":{"type":"string","enum":["not_sent","sent","unknown"]}},"required":["id","threadId","status","subject","bodyText","reviewCategory","reviewReason","editedAt","generatedAt","sentAt","revision","deliveryStatus"]}},"draft":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"status":{"type":"string"},"subject":{"type":"string"},"bodyText":{"type":"string"},"reviewCategory":{"anyOf":[{"type":"string"},{"type":"null"}]},"reviewReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatedAt":{"type":"string"},"sentAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"string"},"deliveryStatus":{"type":"string","enum":["not_sent","sent","unknown"]}},"required":["id","threadId","status","subject","bodyText","reviewCategory","reviewReason","editedAt","generatedAt","sentAt","revision","deliveryStatus"]},{"type":"null"}]},"forwards":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"submissionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"messageId":{"type":"string"},"to":{"type":"string"},"createdAt":{"type":"string"},"status":{"type":"string","enum":["delivered","failed","unknown"]}},"required":["id","submissionId","messageId","to","createdAt","status"]}}},"required":["id","status","discarded","discardSource","discardReason","customerName","customerEmail","subject","lastActivityAt","revision","emailAddressId","messages","drafts","draft","forwards"]}},"required":["data"]},"EmailMessageDetail":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"direction":{"type":"string"},"draftId":{"anyOf":[{"type":"string"},{"type":"null"}]},"providerEmailId":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromAddress":{"type":"string"},"toAddresses":{"type":"array","items":{"type":"string"}},"ccAddresses":{"type":"array","items":{"type":"string"}},"bccAddresses":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"headers":{},"createdAt":{"type":"string"},"processingDisposition":{"type":"string"},"discardReason":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","threadId","direction","draftId","providerEmailId","fromAddress","toAddresses","ccAddresses","bccAddresses","subject","text","html","headers","createdAt","processingDisposition","discardReason"]}},"required":["data"]},"EmailDraftList":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"status":{"type":"string"},"subject":{"type":"string"},"bodyText":{"type":"string"},"reviewCategory":{"anyOf":[{"type":"string"},{"type":"null"}]},"reviewReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatedAt":{"type":"string"},"sentAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"string"},"deliveryStatus":{"type":"string","enum":["not_sent","sent","unknown"]}},"required":["id","threadId","status","subject","bodyText","reviewCategory","reviewReason","editedAt","generatedAt","sentAt","revision","deliveryStatus"]}},"pagination":{"type":"object","properties":{"limit":{"type":"number"},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]},"hasMore":{"type":"boolean"}},"required":["limit","nextCursor","hasMore"]}},"required":["data","pagination"]},"EmailDraftDetail":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"status":{"type":"string"},"subject":{"type":"string"},"bodyText":{"type":"string"},"reviewCategory":{"anyOf":[{"type":"string"},{"type":"null"}]},"reviewReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatedAt":{"type":"string"},"sentAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"string"},"deliveryStatus":{"type":"string","enum":["not_sent","sent","unknown"]}},"required":["id","threadId","status","subject","bodyText","reviewCategory","reviewReason","editedAt","generatedAt","sentAt","revision","deliveryStatus"]}},"required":["data"]},"EmailChannelResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"settings":{"type":"object","properties":{"enabled":{"type":"boolean"},"displayName":{"type":"string"},"autoSendEnabled":{"type":"boolean"},"emailPromptAddition":{"type":"string"},"disclaimerEnabled":{"type":"boolean"},"disclaimerText":{"type":"string"},"signatureEnabled":{"type":"boolean"},"signatureHtml":{"type":"string"},"actionAllowlist":{"type":"array","items":{"type":"string"}},"automatedSenders":{"type":"array","items":{"type":"string"}}},"required":["enabled","displayName","autoSendEnabled","emailPromptAddition","disclaimerEnabled","disclaimerText","signatureEnabled","signatureHtml","actionAllowlist","automatedSenders"]},"addresses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"businessEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"domain":{"anyOf":[{"type":"string"},{"type":"null"}]},"agentEmailAddress":{"type":"string"},"forwardingStatus":{"type":"string","enum":["pending","verified"]},"verifiedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","businessEmail","domain","agentEmailAddress","forwardingStatus","verifiedAt"]}},"availableActions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["settings","addresses","availableActions"]}},"required":["data"]},"EmailReplyAddressResponse":{"type":"object","properties":{"data":{"type":"object","properties":{"settings":{"type":"object","properties":{"enabled":{"type":"boolean"},"displayName":{"type":"string"},"autoSendEnabled":{"type":"boolean"},"emailPromptAddition":{"type":"string"},"disclaimerEnabled":{"type":"boolean"},"disclaimerText":{"type":"string"},"signatureEnabled":{"type":"boolean"},"signatureHtml":{"type":"string"},"actionAllowlist":{"type":"array","items":{"type":"string"}},"automatedSenders":{"type":"array","items":{"type":"string"}}},"required":["enabled","displayName","autoSendEnabled","emailPromptAddition","disclaimerEnabled","disclaimerText","signatureEnabled","signatureHtml","actionAllowlist","automatedSenders"]},"addresses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"businessEmail":{"anyOf":[{"type":"string"},{"type":"null"}]},"domain":{"anyOf":[{"type":"string"},{"type":"null"}]},"agentEmailAddress":{"type":"string"},"forwardingStatus":{"type":"string","enum":["pending","verified"]},"verifiedAt":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","businessEmail","domain","agentEmailAddress","forwardingStatus","verifiedAt"]}},"availableActions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["settings","addresses","availableActions"]},"status":{"type":"string","enum":["sent","send_failed","rate_limited","already_verified"]},"verified":{"type":"boolean"}},"required":["data"]},"EmailAutomatedSendersResponse":{"type":"object","properties":{"data":{"type":"array","items":{"type":"string"}}},"required":["data"]},"EmailMutationResponse":{"type":"object","properties":{"status":{"type":"string"},"data":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["to_review","sent","discarded"]},"discarded":{"type":"boolean"},"discardSource":{"anyOf":[{"type":"string"},{"type":"null"}]},"discardReason":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"customerName":{"type":"string"},"customerEmail":{"type":"string"},"subject":{"type":"string"},"lastActivityAt":{"type":"string"},"revision":{"type":"string"},"emailAddressId":{"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"direction":{"type":"string"},"draftId":{"anyOf":[{"type":"string"},{"type":"null"}]},"providerEmailId":{"anyOf":[{"type":"string"},{"type":"null"}]},"fromAddress":{"type":"string"},"toAddresses":{"type":"array","items":{"type":"string"}},"ccAddresses":{"type":"array","items":{"type":"string"}},"bccAddresses":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"anyOf":[{"type":"string"},{"type":"null"}]},"headers":{},"createdAt":{"type":"string"},"processingDisposition":{"type":"string"},"discardReason":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]}},"required":["id","threadId","direction","draftId","providerEmailId","fromAddress","toAddresses","ccAddresses","bccAddresses","subject","text","html","headers","createdAt","processingDisposition","discardReason"]}},"drafts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"status":{"type":"string"},"subject":{"type":"string"},"bodyText":{"type":"string"},"reviewCategory":{"anyOf":[{"type":"string"},{"type":"null"}]},"reviewReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatedAt":{"type":"string"},"sentAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"string"},"deliveryStatus":{"type":"string","enum":["not_sent","sent","unknown"]}},"required":["id","threadId","status","subject","bodyText","reviewCategory","reviewReason","editedAt","generatedAt","sentAt","revision","deliveryStatus"]}},"draft":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"threadId":{"type":"string"},"status":{"type":"string"},"subject":{"type":"string"},"bodyText":{"type":"string"},"reviewCategory":{"anyOf":[{"type":"string"},{"type":"null"}]},"reviewReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"editedAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"generatedAt":{"type":"string"},"sentAt":{"anyOf":[{"type":"string"},{"type":"null"}]},"revision":{"type":"string"},"deliveryStatus":{"type":"string","enum":["not_sent","sent","unknown"]}},"required":["id","threadId","status","subject","bodyText","reviewCategory","reviewReason","editedAt","generatedAt","sentAt","revision","deliveryStatus"]},{"type":"null"}]},"forwards":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"submissionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"messageId":{"type":"string"},"to":{"type":"string"},"createdAt":{"type":"string"},"status":{"type":"string","enum":["delivered","failed","unknown"]}},"required":["id","submissionId","messageId","to","createdAt","status"]}}},"required":["id","status","discarded","discardSource","discardReason","customerName","customerEmail","subject","lastActivityAt","revision","emailAddressId","messages","drafts","draft","forwards"]},{"type":"null"}]}},"required":["status","data"]},"DeviceCodeRequest":{"type":"object","required":["client_name"],"properties":{"client_name":{"type":"string","description":"A label for the device, usually its hostname. Trimmed and cut to 64 printable characters."}}},"DeviceCode":{"type":"object","required":["device_code","user_code","verification_uri","verification_uri_complete","expires_in","interval"],"properties":{"device_code":{"type":"string","description":"Opaque. Keep it secret."},"user_code":{"type":"string","examples":["BCDF-GHJK"]},"verification_uri":{"type":"string","format":"uri"},"verification_uri_complete":{"type":"string","format":"uri"},"expires_in":{"type":"integer","description":"Seconds."},"interval":{"type":"integer","description":"Seconds to wait between polls."}}},"DeviceTokenRequest":{"type":"object","required":["device_code"],"properties":{"device_code":{"type":"string"}}},"DeviceToken":{"type":"object","required":["api_key","key","account"],"properties":{"api_key":{"type":"string"},"key":{"type":"object","required":["id","name","source","scopes"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"source":{"type":"string","enum":["cli"]},"scopes":{"type":"array","items":{"type":"string","enum":["read","write","delete","export"]}}}},"account":{"type":"object","required":["id","slug","name"],"properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":["string","null"]},"name":{"type":"string"}}}}},"DeviceTokenError":{"type":"object","required":["error"],"properties":{"error":{"type":"string","enum":["authorization_pending","slow_down","expired_token","access_denied","invalid_grant"]},"interval":{"type":"integer","description":"Present with `slow_down`: the new polling interval."}}},"CurrentCredential":{"type":"object","required":["account","credential"],"properties":{"account":{"oneOf":[{"type":"object","required":["id","slug","name"],"properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":["string","null"]},"name":{"type":"string"}}},{"type":"null"}]},"credential":{"type":"object","required":["source","key_id","name","scopes"],"properties":{"source":{"type":"string","enum":["manual","cli","session"]},"key_id":{"type":["string","null"],"format":"uuid"},"name":{"type":["string","null"]},"scopes":{"type":"array","items":{"type":"string","enum":["read","write","delete","export"]}}}}}},"InsufficientScope":{"type":"object","required":["error","required"],"properties":{"error":{"type":"string","enum":["insufficient_scope"]},"required":{"type":"string","enum":["read","write","delete","export"]}}},"Error":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"object","additionalProperties":false,"required":["code","message"],"properties":{"code":{"type":"string","enum":["VALIDATION_INVALID_BODY","VALIDATION_INVALID_JSON","AUTH_MISSING_API_KEY","AUTH_INVALID_API_KEY","AUTH_EXPIRED_API_KEY","SUBSCRIPTION_PLAN_REQUIRED","SUBSCRIPTION_API_RESTRICTED_PLAN","AUTH_INSUFFICIENT_PERMISSIONS","AGENT_NOT_FOUND","RESOURCE_NOT_FOUND","RESOURCE_CONFLICT","RESOURCE_DOCUMENT_NOT_FOUND","RESOURCE_MESSAGE_NOT_FOUND","RESOURCE_MESSAGE_NOT_ASSISTANT","RESOURCE_TOOL_CALL_NOT_FOUND","QUOTA_CHATBOT_LIMIT","QUOTA_STORAGE_LIMIT","CHAT_MODEL_NOT_ALLOWED","CHAT_CREDITS_EXHAUSTED","CHAT_AGENT_CREDITS_EXHAUSTED","CHAT_CONVERSATION_MISMATCH","CHAT_RETRY_MESSAGE_NOT_FOUND","CHAT_RETRY_NO_USER_MESSAGE","CHAT_RETRY_CONFLICT","INSTAGRAM_NOT_CONNECTED","INSTAGRAM_RECONNECT_REQUIRED","INSTAGRAM_AUTOMATION_TARGET_TAKEN","INSTAGRAM_AUTOMATION_CATCH_ALL_EXISTS","INSTAGRAM_SYNC_FAILED","RATE_LIMIT_TOO_MANY_REQUESTS","INTERNAL_SERVER_ERROR"]},"message":{"type":"string"},"details":{}}}}},"JsonValue":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"},{"type":"array","items":{"$ref":"#/components/schemas/JsonValue"}},{"type":"object","additionalProperties":{"$ref":"#/components/schemas/JsonValue"}}]},"Health":{"type":"object","additionalProperties":false,"required":["status","timestamp"],"properties":{"status":{"type":"string","const":"ok"},"timestamp":{"type":"integer","description":"Unix seconds."}}},"Pagination":{"type":"object","additionalProperties":false,"required":["cursor","hasMore","total"],"properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"total":{"type":"integer","minimum":0}}},"AgentSettings":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/JsonValue"}},"Agent":{"type":"object","additionalProperties":false,"required":["id","name","url","createdAt","settings"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":["string","null"]},"createdAt":{"type":["integer","null"]},"settings":{"$ref":"#/components/schemas/AgentSettings"}}},"AgentList":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"CreateAgentRequest":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","const":""},{"type":"null"}]}}},"UpdateAgentRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string","const":""},{"type":"null"}]}}},"Deleted":{"type":"object","additionalProperties":false,"required":["deleted"],"properties":{"deleted":{"type":"boolean","const":true}}},"ChatRequest":{"type":"object","additionalProperties":false,"required":["message"],"properties":{"channel":{"type":"string","enum":["api_v2","playground"],"default":"api_v2","description":"Playground classifies test chats separately. Continue with the same channel as the original conversation."},"message":{"type":"string","minLength":1,"maxLength":32000},"conversationId":{"type":"string","pattern":"^[A-Za-z0-9_-]{16}$","description":"Reference ID returned by a previous chat response. Omit it to start a new conversation."},"stream":{"type":"boolean","default":true},"userId":{"type":"string","minLength":1,"maxLength":128,"pattern":"^[a-zA-Z0-9._-]+$"}}},"TextPart":{"type":"object","additionalProperties":false,"required":["type","text"],"properties":{"type":{"type":"string","const":"text"},"text":{"type":"string"}}},"Usage":{"type":"object","additionalProperties":false,"required":["credits"],"properties":{"credits":{"type":"integer","const":1}}},"ChatResponse":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"object","additionalProperties":false,"required":["id","role","parts","pendingToolCall","metadata"],"properties":{"id":{"type":["string","null"],"pattern":"^[1-9][0-9]*$"},"role":{"type":"string","const":"assistant"},"parts":{"type":"array","minItems":1,"maxItems":1,"items":{"$ref":"#/components/schemas/TextPart"}},"pendingToolCall":{"type":["object","null"],"description":"Set when the reply paused on a client-side tool call; submit its result to the tool-result endpoint.","additionalProperties":false,"required":["id","name","arguments"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"arguments":{"$ref":"#/components/schemas/JsonValue"}}},"metadata":{"type":"object","additionalProperties":false,"required":["userMessageId","conversationId","userId","finishReason","usage"],"properties":{"userMessageId":{"type":["string","null"],"pattern":"^[1-9][0-9]*$"},"conversationId":{"type":"string"},"userId":{"type":["string","null"]},"finishReason":{"type":"string","const":"stop"},"usage":{"$ref":"#/components/schemas/Usage"}}}}}}},"EventStream":{"type":"string","description":"Server-Sent Events containing message-start, text-start, Markdown text-delta, text-end, message-metadata, finish, optional error, and a final [DONE] sentinel. When the reply pauses on a client-side action the stream also emits a tool-call event with { id, name, arguments }; submit the outcome to the tool-result endpoint to resume the conversation."},"Conversation":{"type":"object","additionalProperties":false,"required":["id","title","createdAt","updatedAt","userId","source","status","unread"],"properties":{"id":{"type":"string"},"title":{"type":"string","maxLength":80},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"},"userId":{"type":["string","null"]},"source":{"type":["string","null"]},"status":{"type":"string"},"unread":{"type":"boolean","description":"Shared unread state from Chat Logs. API reads leave this state intact."}}},"Message":{"type":"object","additionalProperties":false,"required":["id","role","parts","createdAt","feedback","metadata"],"properties":{"id":{"type":"string","pattern":"^[1-9][0-9]*$"},"role":{"type":"string","enum":["assistant","user"]},"parts":{"type":"array","minItems":1,"maxItems":1,"items":{"$ref":"#/components/schemas/TextPart"}},"createdAt":{"type":"integer"},"feedback":{"type":["string","null"],"enum":["positive","negative",null]},"metadata":{"$ref":"#/components/schemas/JsonValue"}}},"ConversationWithMessages":{"type":"object","additionalProperties":false,"required":["id","title","createdAt","updatedAt","userId","source","status","unread","messages"],"properties":{"id":{"type":"string"},"title":{"type":"string","maxLength":80},"createdAt":{"type":"integer"},"updatedAt":{"type":"integer"},"userId":{"type":["string","null"]},"source":{"type":["string","null"]},"status":{"type":"string"},"unread":{"type":"boolean","description":"Shared unread state from Chat Logs. API reads leave this state intact."},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}}},"ConversationList":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"ConversationExportList":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ConversationWithMessages"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"ConversationDetail":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"$ref":"#/components/schemas/ConversationWithMessages"},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"MessageList":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"MessageEnvelope":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Message"}}},"FeedbackRequest":{"type":"object","additionalProperties":false,"required":["feedback"],"properties":{"feedback":{"type":["string","null"],"enum":["positive","negative",null]}}},"RetryRequest":{"type":"object","additionalProperties":false,"required":["messageId"],"properties":{"messageId":{"oneOf":[{"type":"integer","minimum":1},{"type":"string","pattern":"^0*[1-9][0-9]*$"}]},"stream":{"type":"boolean","default":true}}},"RetryResponse":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"object","additionalProperties":false,"required":["id","role","parts","metadata"],"properties":{"id":{"type":"string","pattern":"^[1-9][0-9]*$"},"role":{"type":"string","const":"assistant"},"parts":{"type":"array","minItems":1,"maxItems":1,"items":{"$ref":"#/components/schemas/TextPart"}},"metadata":{"type":"object","additionalProperties":false,"required":["conversationId","finishReason","usage"],"properties":{"conversationId":{"type":"string"},"finishReason":{"type":"string","const":"stop"},"usage":{"$ref":"#/components/schemas/Usage"}}}}}}},"ToolResultRequest":{"type":"object","additionalProperties":false,"required":["toolCallId","output"],"properties":{"toolCallId":{"type":"string","minLength":1},"output":{}}},"Source":{"type":"object","additionalProperties":false,"required":["id","title","sourceType","createdAt","lastCrawledAt","sourceMetadata"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"sourceType":{"type":"string"},"createdAt":{"type":["integer","null"]},"lastCrawledAt":{"type":["integer","null"]},"sourceMetadata":{"$ref":"#/components/schemas/JsonValue"}}},"SourceDetailResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"object","additionalProperties":false,"required":["id","title","sourceType","createdAt","lastCrawledAt","sourceMetadata","content"],"properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"sourceType":{"type":"string"},"createdAt":{"type":["integer","null"]},"lastCrawledAt":{"type":["integer","null"]},"sourceMetadata":{"$ref":"#/components/schemas/JsonValue"},"content":{"type":"string"},"questions":{"type":"array","items":{"type":"string"}},"answer":{"type":"string"}}}}},"UpdateSourceRequest":{"anyOf":[{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","minLength":1,"maxLength":262144,"description":"Must contain non-whitespace text and encode to at most 262,144 UTF-8 bytes."}}},{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"title":{"type":"string","minLength":1,"maxLength":200},"questions":{"type":"array","maxItems":10,"contains":{"type":"string","pattern":"\\S"},"minContains":1,"items":{"type":"string","maxLength":500}},"answer":{"type":"string","minLength":1,"maxLength":262144,"description":"Must contain non-whitespace text and encode to at most 262,144 UTF-8 bytes."}}}]},"SourceList":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Source"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"CreateTextSourceRequest":{"type":"object","additionalProperties":false,"required":["title","content"],"properties":{"title":{"type":"string","minLength":1,"maxLength":200},"content":{"type":"string","minLength":1,"maxLength":262144,"description":"Must contain non-whitespace text and encode to at most 262,144 UTF-8 bytes."}}},"CreateQnaSourceRequest":{"type":"object","additionalProperties":false,"required":["title","questions","answer"],"properties":{"title":{"type":"string","minLength":1,"maxLength":200},"questions":{"type":"array","maxItems":10,"contains":{"type":"string","pattern":"\\S"},"minContains":1,"items":{"type":"string","maxLength":500}},"answer":{"type":"string","minLength":1,"maxLength":262144,"description":"Must contain non-whitespace text and encode to at most 262,144 UTF-8 bytes."}}},"CreateUrlSourceRequest":{"type":"object","additionalProperties":false,"required":["url"],"properties":{"url":{"type":"string","minLength":1,"pattern":"^(?:[hH][tT][tT][pP][sS]?://)?[^\\s/@:]+(?:\\.[^\\s/@:]+)+(?::\\d+)?(?:[/?#].*)?$","description":"Public http(s) URL with a multi-label domain. A missing protocol is normalized to https before validation. URLs with credentials, and hosts that resolve to loopback, private, or link-local addresses, are rejected."}}},"DocumentCreated":{"type":"object","additionalProperties":false,"required":["documentId"],"properties":{"documentId":{"type":"string","format":"uuid"}}},"UrlSourceJob":{"type":"object","additionalProperties":false,"required":["jobId","isRetrain"],"properties":{"jobId":{"type":"integer"},"isRetrain":{"type":"boolean"}}},"FileName":{"type":"object","additionalProperties":false,"required":["fileName"],"properties":{"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"\\.(?:[pP][dD][fF]|[tT][xX][tT]|[mM][dD]|[dD][oO][cC][xX]|[xX][lL][sS][xX]|[pP][pP][tT][xX])$"},"size":{"type":"integer","minimum":1,"maximum":52428800,"description":"File size in bytes. Reserved against the account upload budget; the uploaded object must not exceed it. Omitting it reserves the 50 MB maximum."}}},"CreateFileUploadUrlsRequest":{"type":"object","additionalProperties":false,"required":["files"],"properties":{"files":{"type":"array","minItems":1,"maxItems":20,"items":{"$ref":"#/components/schemas/FileName"}}}},"FileUploadUrls":{"type":"object","additionalProperties":false,"required":["files"],"properties":{"files":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["fileName","storagePath","uploadUrl","token"],"properties":{"fileName":{"type":"string"},"storagePath":{"type":"string"},"uploadUrl":{"type":"string","format":"uri"},"token":{"type":"string"}}}}}},"RegisterFilesRequest":{"type":"object","additionalProperties":false,"required":["files"],"properties":{"files":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","additionalProperties":false,"required":["storagePath","fileName"],"properties":{"storagePath":{"type":"string","minLength":1},"fileName":{"type":"string","minLength":1,"maxLength":255,"pattern":"\\.(?:[pP][dD][fF]|[tT][xX][tT]|[mM][dD]|[dD][oO][cC][xX]|[xX][lL][sS][xX]|[pP][pP][tT][xX])$"}}}}}},"FileProcessingJob":{"type":"object","additionalProperties":false,"required":["jobId","fileCount"],"properties":{"jobId":{"type":"integer"},"fileCount":{"type":"integer","minimum":1,"maximum":20}}},"Contact":{"type":"object","additionalProperties":false,"required":["id","externalId","name","email","phone","customAttributes","createdAt","updatedAt","lastSeenAt"],"properties":{"id":{"type":"string","format":"uuid"},"externalId":{"type":"string"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"customAttributes":{"type":["object","null"],"additionalProperties":true},"createdAt":{"type":["integer","null"]},"updatedAt":{"type":["integer","null"]},"lastSeenAt":{"type":["integer","null"]}}},"ContactList":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Contact"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"UpsertContactRequest":{"type":"object","additionalProperties":false,"required":["externalId"],"properties":{"externalId":{"type":"string","minLength":1,"maxLength":255},"name":{"type":["string","null"],"maxLength":255},"email":{"anyOf":[{"type":"string","format":"email","maxLength":320},{"type":"string","const":""},{"type":"null"}]},"phone":{"type":["string","null"],"maxLength":50},"customAttributes":{"type":"object","additionalProperties":true}}},"ImportContactRow":{"type":"object","additionalProperties":false,"required":["external_id"],"properties":{"external_id":{"type":"string","minLength":1,"maxLength":255},"name":{"type":["string","null"],"maxLength":255},"email":{"anyOf":[{"type":"string","format":"email","maxLength":320},{"type":"string","const":""},{"type":"null"}]},"phone":{"type":["string","null"],"maxLength":50},"customAttributes":{"type":"object","additionalProperties":true}}},"ImportContactsRequest":{"type":"object","additionalProperties":false,"required":["rows"],"properties":{"rows":{"type":"array","minItems":1,"maxItems":1000,"items":{"$ref":"#/components/schemas/ImportContactRow"}}}},"ImportContactsResult":{"type":"object","additionalProperties":false,"required":["processed","skipped"],"properties":{"processed":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0}}},"Lead":{"type":"object","additionalProperties":false,"required":["id","name","email","phone","conversationId","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":["string","null"]},"email":{"type":["string","null"]},"phone":{"type":["string","null"]},"conversationId":{"type":["string","null"]},"createdAt":{"type":"integer"}}},"LeadList":{"type":"object","additionalProperties":false,"required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"AiSettings":{"type":"object","additionalProperties":false,"properties":{"model":{"type":"string","description":"The stored model identifier. New values come from the Model enum; settings saved before a model was renamed can hold a historical identifier."},"instructionsPreset":{"type":"string","description":"The stored preset. New values come from the InstructionsPreset enum."},"instructionsPrompt":{"type":"string"}}},"Model":{"type":"string","enum":["openai/gpt-6-astra","openai/gpt-6-sol","openai/gpt-6-luna","openai/gpt-5.6-sol","openai/gpt-5.6-terra","anthropic/claude-fable-5.1","anthropic/claude-opus-5.5","anthropic/claude-opus-5","anthropic/claude-sonnet-5","anthropic/claude-haiku-4-5","google/gemini-3.7-flash","google/gemini-3.1-pro-preview","openai/gpt-5.6-luna","openai/gpt-5.5","openai/gpt-5.4","openai/gpt-5.4-mini","openai/gpt-5.4-nano","anthropic/claude-opus-4.7","anthropic/claude-opus-4-6","anthropic/claude-sonnet-4-6","google/gemini-3-flash-preview","google/gemini-3.6-flash"]},"InstructionsPreset":{"type":"string","enum":["custom","ai-chatbot","customer-support","sales-agent","language-tutor","coding-expert","life-coach"]},"UpdateAiSettingsRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"model":{"$ref":"#/components/schemas/Model"},"instructionsPreset":{"$ref":"#/components/schemas/InstructionsPreset"},"instructionsPrompt":{"type":"string"}}},"BrandingSettings":{"type":"object","additionalProperties":true,"properties":{"appearance":{"type":"string","enum":["Light","Dark"]},"primaryColor":{"type":"string"},"bubbleColor":{"type":"string"},"primaryColorHeader":{"type":"boolean"},"bubbleIconUrl":{"type":"string"},"profilePictureUrl":{"type":"string"},"hideBranding":{"type":"boolean"}}},"ConversationDesignSettings":{"type":"object","additionalProperties":true,"properties":{"initialMessages":{"type":"array","maxItems":5,"items":{"type":"string","maxLength":140}},"messagePlaceholder":{"type":"string","maxLength":100},"showInitialMessageBubble":{"type":"boolean"},"defaultPrompts":{"type":"object","additionalProperties":false,"required":["enabled","keepShowing","prompts"],"properties":{"enabled":{"type":"boolean"},"keepShowing":{"type":"boolean"},"prompts":{"type":"array","maxItems":4,"items":{"type":"string","maxLength":80}}}}}},"DesignSettings":{"type":"object","additionalProperties":false,"properties":{"title":{"type":"string"},"language":{"type":["string","null"],"description":"Stored widget locale, normalized to one of en, de, es, fr, it, nl, pl, pt, zh-tw. Null when unset or when the stored value is not a supported locale."},"position":{"type":"string","enum":["bottom-left","bottom-right"]},"branding":{"$ref":"#/components/schemas/BrandingSettings"},"conversation":{"$ref":"#/components/schemas/ConversationDesignSettings"}}},"UpdateDesignSettingsRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"title":{"type":"string"},"language":{"type":["string","null"],"description":"Widget locale. Canonical values: en, de, es, fr, it, nl, pl, pt, zh-tw. Region and script subtags are normalized (en-US to en; zh-TW, zh-HK, zh-MO, and zh-Hant to zh-tw), underscores are treated as hyphens, and matching is case-insensitive. Any other language — including zh-Hans — is rejected. Null clears the setting."},"appearance":{"type":"string","enum":["Light","Dark"]},"primaryColor":{"type":"string"},"bubbleColor":{"type":"string"},"primaryColorHeader":{"type":"boolean"},"position":{"type":"string","enum":["bottom-left","bottom-right"]},"showInitialMessageBubble":{"type":"boolean"},"initialMessages":{"oneOf":[{"type":"array","maxItems":5,"items":{"type":"string","maxLength":140}},{"type":"string","description":"Legacy newline-delimited form. At most five nonblank lines of at most 140 characters each once trimmed; anything else returns 400 VALIDATION_INVALID_BODY. Prefer the array form, whose limits are machine-readable."}]},"messagePlaceholder":{"type":"string","maxLength":100},"bubbleIconUrl":{"type":["string","null"],"format":"uri"},"profilePictureUrl":{"type":["string","null"],"format":"uri"},"hideBranding":{"type":"boolean"},"keepShowing":{"type":"boolean"},"prompts":{"type":"array","maxItems":4,"items":{"type":"string","maxLength":80}}}},"RateLimitSettings":{"type":"object","additionalProperties":false,"required":["maxMessages","windowSeconds","limitMessage"],"properties":{"maxMessages":{"type":"number","minimum":1,"maximum":100},"windowSeconds":{"type":"number","minimum":10,"maximum":3600},"limitMessage":{"type":"string","minLength":1,"maxLength":500}}},"AllowedDomains":{"type":"object","additionalProperties":false,"required":["enabled","domains"],"allOf":[{"if":{"required":["enabled"],"properties":{"enabled":{"const":true}}},"then":{"properties":{"domains":{"minItems":1}}}}],"properties":{"enabled":{"type":"boolean"},"domains":{"type":"array","items":{"type":"string","minLength":1,"pattern":"^(https?://)?(\\*\\.)?(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9])(:\\d+)?(/[^\\s]*)?$"}}}},"SecuritySettings":{"type":"object","additionalProperties":false,"properties":{"isPrivate":{"type":"boolean"},"rateLimit":{"$ref":"#/components/schemas/RateLimitSettings"},"allowedDomains":{"$ref":"#/components/schemas/AllowedDomains"}}},"UpdateSecuritySettingsRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"isPrivate":{"type":"boolean"},"rateLimit":{"$ref":"#/components/schemas/RateLimitSettings"},"allowedDomains":{"$ref":"#/components/schemas/AllowedDomains"}}},"NotificationSettings":{"type":"object","additionalProperties":false,"properties":{"dailyConversations":{"type":"boolean"},"dailyEmails":{"type":"boolean"},"quotaAlerts":{"type":"boolean"}}},"UpdateNotificationSettingsRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"dailyConversations":{"type":"boolean"},"dailyEmails":{"type":"boolean"},"quotaAlerts":{"type":"boolean"}}},"TrainingSettings":{"type":"object","additionalProperties":false,"properties":{"autoRetrainEnabled":{"type":"boolean"}}},"UpdateTrainingSettingsRequest":{"type":"object","additionalProperties":false,"required":["autoRetrainEnabled"],"properties":{"autoRetrainEnabled":{"type":"boolean"}}},"TrainingStatus":{"type":"object","additionalProperties":false,"required":["status","documentCount","lastTrainedAt","activeJob"],"properties":{"status":{"type":"string","enum":["training","trained","idle"]},"documentCount":{"type":"integer","minimum":0},"lastTrainedAt":{"type":["integer","null"]},"activeJob":{"anyOf":[{"$ref":"#/components/schemas/ActiveTrainingJob"},{"type":"null"}]}}},"ActiveTrainingJob":{"type":"object","additionalProperties":false,"required":["id","status","tasksCount","tasksCompletedCount","createdAt"],"properties":{"id":{"type":"integer"},"status":{"type":"string"},"tasksCount":{"type":"integer","minimum":0},"tasksCompletedCount":{"type":"integer","minimum":0},"createdAt":{"type":["integer","null"]}}},"TrainingJob":{"type":"object","additionalProperties":false,"required":["jobId","count","message"],"properties":{"jobId":{"type":["integer","null"]},"count":{"type":"integer","minimum":0},"message":{"type":"string"}}},"InstagramLoginKind":{"type":"string","enum":["instagram_login","facebook_login","facebook_business_login"]},"InstagramLink":{"type":"object","additionalProperties":false,"required":["label","url"],"properties":{"label":{"type":"string"},"url":{"type":"string"}}},"InstagramIntent":{"type":"object","additionalProperties":false,"required":["name","description"],"properties":{"name":{"type":"string"},"description":{"type":"string"}}},"RespondToDmsConfig":{"type":"object","additionalProperties":false,"required":["mode","keywords","message","links"],"properties":{"mode":{"type":"string","enum":["all","keywords"]},"keywords":{"type":"string"},"message":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/components/schemas/InstagramLink"}},"intentsEnabled":{"type":"boolean","default":false},"intents":{"type":"array","items":{"$ref":"#/components/schemas/InstagramIntent"},"default":[]},"fallbackEnabled":{"type":"boolean","default":false},"fallbackMessage":{"type":"string","maxLength":1000,"default":""},"followUpEnabled":{"type":"boolean","default":false},"followUpMessage":{"type":"string"},"requireFollow":{"type":"boolean","default":false},"notFollowerReply":{"type":"string"},"askEmailEnabled":{"type":"boolean","default":false},"askEmailPrompt":{"type":"string"},"askEmailRetryMessage":{"type":"string"},"askEmailConfirmMessage":{"type":"string"}}},"CommentToDmConfig":{"type":"object","additionalProperties":false,"required":["postScope","mediaId","filter","keywords","publicReplyEnabled","publicReplies","openingMessage","linkMessage","links"],"properties":{"postScope":{"type":"string","enum":["specific","any","next"]},"mediaId":{"type":"string"},"filter":{"type":"string","enum":["specific","any"]},"keywords":{"type":"string"},"publicReplyEnabled":{"type":"boolean"},"publicReplies":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["value"],"properties":{"value":{"type":"string"}}}},"openingMessage":{"type":"string"},"buttonLabel":{"type":"string"},"linkMessage":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/components/schemas/InstagramLink"}},"requireFollow":{"type":"boolean","default":false},"notFollowerReply":{"type":"string"},"noClickFollowUpEnabled":{"type":"boolean","default":false},"noClickFollowUpMessage":{"type":"string"}}},"StoryLeadsConfig":{"type":"object","additionalProperties":false,"required":["storyScope","storyId","filter","keywords","reactions","message","links","followUpEnabled"],"properties":{"storyScope":{"type":"string","enum":["any","specific"]},"storyId":{"type":"string"},"filter":{"type":"string","enum":["specific","any"]},"keywords":{"type":"string"},"reactions":{"type":"array","items":{"type":"string"}},"message":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/components/schemas/InstagramLink"}},"followUpEnabled":{"type":"boolean"},"followUpMessage":{"type":"string"},"requireFollow":{"type":"boolean","default":false},"notFollowerReply":{"type":"string"},"reactToReplyEnabled":{"type":"boolean","default":false},"askEmailEnabled":{"type":"boolean","default":false},"askEmailPrompt":{"type":"string"},"askEmailRetryMessage":{"type":"string"},"askEmailConfirmMessage":{"type":"string"}}},"StoryMentionsConfig":{"type":"object","additionalProperties":false,"required":["message","links"],"properties":{"message":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/components/schemas/InstagramLink"}}}},"InstagramAutomationConfig":{"oneOf":[{"$ref":"#/components/schemas/RespondToDmsConfig"},{"$ref":"#/components/schemas/CommentToDmConfig"},{"$ref":"#/components/schemas/StoryLeadsConfig"},{"$ref":"#/components/schemas/StoryMentionsConfig"}]},"InstagramAutomationInstanceConfig":{"oneOf":[{"$ref":"#/components/schemas/CommentToDmConfig"},{"$ref":"#/components/schemas/StoryLeadsConfig"}]},"InstagramAutomation":{"type":"object","additionalProperties":false,"required":["key","status","config"],"properties":{"key":{"type":"string","enum":["respond_to_dms","comment_to_dm","story_leads","story_mentions"]},"status":{"type":"string","enum":["draft","live","off"]},"config":{"$ref":"#/components/schemas/InstagramAutomationConfig"}}},"InstagramAutomationInstance":{"type":"object","additionalProperties":false,"required":["id","key","status","config"],"properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","enum":["comment_to_dm","story_leads"]},"status":{"type":"string","enum":["draft","live","off"]},"config":{"$ref":"#/components/schemas/InstagramAutomationInstanceConfig"}}},"CreateInstagramAutomationInstanceRequest":{"type":"object","additionalProperties":false,"required":["config"],"properties":{"config":{"$ref":"#/components/schemas/InstagramAutomationInstanceConfig","description":"The complete configuration for the kind in the path: comment_to_dm takes CommentToDmConfig, story_leads takes StoryLeadsConfig."},"status":{"type":"string","enum":["draft","live","off"]}}},"UpdateInstagramAutomationRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"config":{"$ref":"#/components/schemas/InstagramAutomationConfig","description":"Each key accepts exactly one config shape: respond_to_dms takes RespondToDmsConfig, comment_to_dm takes CommentToDmConfig, story_leads takes StoryLeadsConfig, and story_mentions takes StoryMentionsConfig. A config for the wrong key is rejected with VALIDATION_INVALID_BODY."},"status":{"type":"string","enum":["draft","live","off"]}}},"UpdateInstagramAutomationInstanceRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"config":{"$ref":"#/components/schemas/InstagramAutomationInstanceConfig","description":"The complete configuration for the kind in the path: comment_to_dm takes CommentToDmConfig, story_leads takes StoryLeadsConfig. A config for the wrong key is rejected with VALIDATION_INVALID_BODY."},"status":{"type":"string","enum":["draft","live","off"]}}},"InstagramConversationStarter":{"type":"object","additionalProperties":false,"required":["question","message","links"],"properties":{"question":{"type":"string","maxLength":80},"message":{"type":"string","maxLength":640},"links":{"type":"array","maxItems":3,"items":{"$ref":"#/components/schemas/InstagramLink"}}}},"InstagramConversationStarterList":{"type":"array","maxItems":4,"items":{"$ref":"#/components/schemas/InstagramConversationStarter"}},"InstagramConversationStarters":{"type":"object","additionalProperties":false,"required":["status","draft_prompts","live_prompts","synced_at","last_sync_error"],"properties":{"status":{"type":"string","enum":["draft","live","off"]},"draft_prompts":{"$ref":"#/components/schemas/InstagramConversationStarterList"},"live_prompts":{"anyOf":[{"$ref":"#/components/schemas/InstagramConversationStarterList"},{"type":"null"}]},"synced_at":{"type":["string","null"],"format":"date-time"},"last_sync_error":{"type":["string","null"]}}},"UpdateInstagramConversationStartersRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"prompts":{"$ref":"#/components/schemas/InstagramConversationStarterList"},"status":{"type":"string","enum":["draft","live","off"]}}},"InstagramMenuItem":{"type":"object","additionalProperties":false,"required":["id","title","action"],"properties":{"id":{"type":"string","minLength":1},"title":{"type":"string","maxLength":30},"action":{"oneOf":[{"type":"object","additionalProperties":false,"required":["kind","url"],"properties":{"kind":{"type":"string","const":"web_url"},"url":{"type":"string"}}},{"type":"object","additionalProperties":false,"required":["kind","reply"],"properties":{"kind":{"type":"string","const":"postback"},"reply":{"type":"string","maxLength":1000}}}]}}},"InstagramMenuItems":{"type":"array","maxItems":5,"uniqueItems":true,"description":"At most five items. Each id must be unique across the array after trimming; duplicates return 400 VALIDATION_INVALID_BODY.","items":{"$ref":"#/components/schemas/InstagramMenuItem"}},"InstagramMenu":{"type":"object","additionalProperties":false,"required":["status","draft_items","live_items","synced_at","last_sync_error"],"properties":{"status":{"type":"string","enum":["draft","live","off","sync_error"]},"draft_items":{"$ref":"#/components/schemas/InstagramMenuItems"},"live_items":{"anyOf":[{"$ref":"#/components/schemas/InstagramMenuItems"},{"type":"null"}]},"synced_at":{"type":["string","null"],"format":"date-time"},"last_sync_error":{"type":["string","null"]}}},"UpdateInstagramMenuRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"items":{"$ref":"#/components/schemas/InstagramMenuItems"},"status":{"type":"string","enum":["draft","live","off"]}},"allOf":[{"if":{"type":"object","required":["status","items"],"properties":{"status":{"const":"live"},"items":{}}},"then":{"properties":{"items":{"minItems":1}}}}]},"InstagramPermissionRefresh":{"type":"object","additionalProperties":false,"required":["outcome","lastVerifiedAt","loginKind"],"properties":{"outcome":{"type":"string","enum":["verified","reconnect_required","repair_submitted_unverified","retryable_error"]},"code":{"type":"string","enum":["token_invalid","missing_scopes","missing_page_mapping","missing_ig_mapping","grant_readback_unavailable","subscription_readback_unavailable","subscription_readback_mismatch","rate_limited","meta_5xx","network","parse"]},"missingScopes":{"type":"array","items":{"type":"string"}},"lastVerifiedAt":{"type":["string","null"],"format":"date-time"},"loginKind":{"$ref":"#/components/schemas/InstagramLoginKind"}}},"InstagramChannel":{"oneOf":[{"type":"object","additionalProperties":false,"required":["connected"],"properties":{"connected":{"type":"boolean","const":false}}},{"type":"object","additionalProperties":false,"required":["connected","id","instagram_username","instagram_user_id","facebook_page_name","profile_picture_url","login_kind","status","scopes","last_error_message","last_verified_at","automations","conversation_starters","menu"],"properties":{"connected":{"type":"boolean","const":true},"id":{"type":"string","format":"uuid"},"instagram_username":{"type":["string","null"]},"instagram_user_id":{"type":"string"},"facebook_page_name":{"type":["string","null"]},"profile_picture_url":{"type":["string","null"],"format":"uri"},"login_kind":{"$ref":"#/components/schemas/InstagramLoginKind"},"status":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"last_error_message":{"type":["string","null"]},"last_verified_at":{"type":["string","null"],"format":"date-time"},"automations":{"type":"array","minItems":4,"maxItems":4,"items":{"$ref":"#/components/schemas/InstagramAutomation"}},"conversation_starters":{"$ref":"#/components/schemas/InstagramConversationStarters"},"menu":{"$ref":"#/components/schemas/InstagramMenu"}}}]}}}}