{
  "openapi": "3.1.0",
  "info": {
    "title": "Outlit API",
    "summary": "Public Outlit Platform and Ingest APIs.",
    "description": "Canonical OpenAPI specification for the public Outlit API surfaces documented at docs.outlit.ai.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://app.outlit.ai"
    }
  ],
  "tags": [
    {
      "name": "Platform API",
      "description": "Authenticated API key routes for customer intelligence tools and integration management."
    },
    {
      "name": "Ingest API",
      "description": "Public-key event ingestion routes used by Outlit SDKs."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/validate-api-key": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Validate API key",
        "description": "Verify that the API key in the Authorization header can authenticate Platform API requests.",
        "operationId": "validateApiKey",
        "responses": {
          "200": {
            "description": "The API key is valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateApiKeySuccess"
                },
                "example": {
                  "valid": true,
                  "organizationId": "org_123",
                  "createdById": "user_123"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/tools/call": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Call customer intelligence tool",
        "description": "Call a public customer intelligence tool through the shared Outlit tool gateway.",
        "operationId": "callTool",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToolCallRequest"
              },
              "example": {
                "tool": "outlit_search_customer_context",
                "input": {
                  "customer": "acme.com",
                  "query": "What renewal concerns came up recently?",
                  "topK": 5
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tool-specific JSON result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON, unknown tool name, or invalid tool input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "error": "Invalid tool input",
                  "details": [
                    {
                      "path": ["limit"],
                      "message": "Too big: expected number to be <=1000"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "429": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/agent-templates": {
      "get": {
        "tags": ["Platform API"],
        "summary": "List agent templates",
        "description": "List Outlit agent templates that can be created by API, CLI, or MCP clients. This route is read-only.",
        "operationId": "listAgentTemplates",
        "responses": {
          "200": {
            "description": "Available agent templates.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentTemplatesCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/agent-actions": {
      "get": {
        "tags": ["Platform API"],
        "summary": "List agent actions",
        "description": "List action capabilities that an Outlit agent may reference. This route is read-only and does not grant actions to any agent.",
        "operationId": "listAgentActions",
        "responses": {
          "200": {
            "description": "Available agent action capabilities.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentActionsCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/agents": {
      "get": {
        "tags": ["Platform API"],
        "summary": "List agents",
        "description": "List configured Outlit agents for the authenticated organization. Read-only.",
        "operationId": "listAgents",
        "responses": {
          "200": {
            "description": "Configured agents were returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAgentsCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not list agents.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Platform API"],
        "summary": "Create agent",
        "description": "Create an Outlit agent. Use type=template for supported templates or type=custom for a custom hosted agent.",
        "operationId": "createAgent",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAgentRequest"
              },
              "examples": {
                "template": {
                  "summary": "Create from template",
                  "value": {
                    "type": "template",
                    "templateKey": "churn",
                    "mode": "draft"
                  }
                },
                "custom": {
                  "summary": "Create custom agent",
                  "value": {
                    "type": "custom",
                    "displayName": "Renewal risk",
                    "instructions": "Find risk.",
                    "surfaceCriteria": "Surface risky customers.",
                    "actionKeys": ["send_slack_notification"]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAgentCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON or unsupported agent create request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested template or agent conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/{id}": {
      "get": {
        "tags": ["Platform API"],
        "summary": "Get agent",
        "description": "Get one configured Outlit agent by id. Read-only.",
        "operationId": "getAgent",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Agent ID to fetch.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The configured agent was returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAgentCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No agent was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not get the agent.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Platform API"],
        "summary": "Update agent",
        "description": "Patch one configured Outlit agent. Only provided fields are changed.",
        "operationId": "updateAgent",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Agent ID.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAgentRequest"
              },
              "example": {
                "displayName": "Renewal risk",
                "instructions": "Prioritize recent support escalations.",
                "actionKeys": ["send_slack_notification"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateAgentCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/integrations": {
      "get": {
        "tags": ["Platform API"],
        "summary": "List integrations",
        "description": "List available integrations and current connection status for the authenticated organization.",
        "operationId": "listIntegrations",
        "parameters": [
          {
            "name": "connectedOnly",
            "in": "query",
            "description": "When true, only returns currently connected integrations.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Integration list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["items"],
                  "properties": {
                    "items": {
                      "type": "array",
                      "maxItems": 12,
                      "items": {
                        "$ref": "#/components/schemas/Integration"
                      }
                    }
                  },
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/integrations/capabilities": {
      "get": {
        "tags": ["Platform API"],
        "summary": "Get integration setup capabilities",
        "description": "Inspect setup mode, required credential fields, and follow-up steps for one provider or all providers.",
        "operationId": "getIntegrationCapabilities",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "description": "Optional public provider ID or CLI alias. When omitted, returns all provider capabilities.",
            "schema": {
              "$ref": "#/components/schemas/ProviderId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider capability metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationCapabilitiesResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/integrations/setup-step": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Run provider setup step",
        "description": "Run a supported follow-up setup step for a connected provider, such as CRM mappings or webhook setup.",
        "operationId": "runIntegrationSetupStep",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationSetupStepRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Step-specific setup response.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/integrations/connect": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Connect integration",
        "description": "Connect a provider with direct credentials or create a browser-auth connection session.",
        "operationId": "connectIntegration",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationConnectRequest"
              },
              "example": {
                "provider": "posthog",
                "config": {
                  "apiKey": "phx_...",
                  "region": "us",
                  "projectId": "12345"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Direct credential connection or browser session response.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/IntegrationDirectConnectionResponse"
                    },
                    {
                      "$ref": "#/components/schemas/IntegrationBrowserSessionResponse"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/PlanConnectionLimit"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/integrations/connect/status": {
      "get": {
        "tags": ["Platform API"],
        "summary": "Poll connection status",
        "description": "Poll the state of a browser-auth integration connection session.",
        "operationId": "getIntegrationConnectionStatus",
        "parameters": [
          {
            "name": "sessionId",
            "in": "query",
            "required": true,
            "description": "Session ID returned by POST /api/integrations/connect.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current connection session status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationConnectionStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/integrations/disconnect": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Disconnect integration",
        "description": "Disconnect a currently connected provider for the authenticated organization.",
        "operationId": "disconnectIntegration",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IntegrationDisconnectRequest"
              },
              "example": {
                "provider": "stripe"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Integration disconnected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationDisconnectResponse"
                },
                "example": {
                  "success": true
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "description": "The provider is valid but no active connection exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationDisconnectNotConnectedResponse"
                },
                "example": {
                  "success": false,
                  "message": "Integration is not connected"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/integrations/sync-status": {
      "get": {
        "tags": ["Platform API"],
        "summary": "Get integration sync status",
        "description": "Inspect the connection and model sync status for one public provider.",
        "operationId": "getIntegrationSyncStatus",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "description": "Public provider ID from the provider table.",
            "schema": {
              "$ref": "#/components/schemas/ProviderId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider sync status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IntegrationSyncStatusResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/api/i/v1/{publicKey}/events": {
      "post": {
        "tags": ["Ingest API"],
        "summary": "Ingest events",
        "description": "Send tracking events to Outlit. The public key in the URL path identifies the workspace; no secret bearer token is required for this endpoint.",
        "operationId": "ingestEvents",
        "security": [],
        "parameters": [
          {
            "name": "publicKey",
            "in": "path",
            "required": true,
            "description": "Your organization's public key. Starts with pk_.",
            "schema": {
              "type": "string",
              "pattern": "^pk_"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IngestEventsRequest"
              },
              "example": {
                "visitorId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
                "source": "client",
                "events": [
                  {
                    "type": "pageview",
                    "url": "https://example.com/pricing",
                    "path": "/pricing",
                    "title": "Pricing - Example",
                    "timestamp": 1699999999999
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Events accepted.",
            "headers": {
              "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/IngestEventsSuccess"
                },
                "example": {
                  "success": true
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body or event payload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestEventsError"
                }
              }
            }
          },
          "403": {
            "description": "Invalid public key or unauthorized domain.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestEventsError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestEventsError"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestEventsError"
                }
              }
            }
          }
        }
      }
    },
    "/api/automations": {
      "get": {
        "tags": ["Platform API"],
        "summary": "List automations",
        "description": "List configured Outlit automations for the authenticated organization. Read-only.",
        "operationId": "listAutomations",
        "responses": {
          "200": {
            "description": "Configured automations were returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListAutomationsCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not list automations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Platform API"],
        "summary": "Create automation",
        "description": "Create an agent automation. Provide agentId; Outlit maps it to the hosted-agent processor internally.",
        "operationId": "createAutomation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAutomationRequest"
              },
              "example": {
                "agentId": "10000000-0000-4000-8000-000000000004",
                "name": "Churn response",
                "description": null,
                "enabled": false,
                "triggerType": "SIGNAL_OCCURRENCE",
                "signalIds": ["10000000-0000-4000-8000-000000000002"],
                "destinationIds": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Automation was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAutomationCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/automations/{id}": {
      "get": {
        "tags": ["Platform API"],
        "summary": "Get automation",
        "description": "Get one configured Outlit automation by id. Read-only and does not include run history.",
        "operationId": "getAutomation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Automation ID to fetch.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The configured automation was returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAutomationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No automation was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not get the automation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Platform API"],
        "summary": "Update automation",
        "description": "Update an agent automation with a full configuration body. Provide agentId, name, enabled, and triggerType; Outlit maps agentId to the hosted-agent processor internally.",
        "operationId": "updateAutomation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Automation ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateAutomationRequest"
              },
              "example": {
                "agentId": "10000000-0000-4000-8000-000000000004",
                "name": "Churn response",
                "description": null,
                "enabled": false,
                "triggerType": "SIGNAL_OCCURRENCE",
                "signalIds": ["10000000-0000-4000-8000-000000000002"],
                "destinationIds": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Automation was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateAutomationCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/signals": {
      "get": {
        "tags": ["Platform API"],
        "summary": "List signals",
        "description": "List configured Outlit automation signals for the authenticated organization. Read-only.",
        "operationId": "listSignals",
        "responses": {
          "200": {
            "description": "Configured signals were returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSignalsCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not list signals.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Platform API"],
        "summary": "Create signal",
        "description": "Create a UI-managed Outlit automation signal.",
        "operationId": "createSignal",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSignalRequest"
              },
              "example": {
                "kind": "EVENT_MATCH",
                "name": "Workspace inactive",
                "description": null,
                "definition": {
                  "grain": "customer",
                  "subjectResolver": "event_customer",
                  "eventNames": ["workspace_inactive"],
                  "propertyConditions": [],
                  "conditionMode": "ALL"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signal was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSignalCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/destinations": {
      "get": {
        "tags": ["Platform API"],
        "summary": "List destinations",
        "description": "List configured Outlit automation destinations with masked configuration only. Read-only.",
        "operationId": "listDestinations",
        "responses": {
          "200": {
            "description": "Configured destinations were returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListDestinationsCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not list destinations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": ["Platform API"],
        "summary": "Create destination",
        "description": "Create one automation destination. Responses include masked configuration only.",
        "operationId": "createDestination",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDestinationRequest"
              },
              "example": {
                "type": "WEBHOOK_ENDPOINT",
                "name": "Customer ops",
                "description": null,
                "enabled": true,
                "url": "https://hooks.example.com/outlit"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Destination was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateDestinationCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/{id}/enable": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Enable agent",
        "description": "Enable one configured Outlit agent by id. Does not run the agent immediately.",
        "operationId": "enableAgent",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Agent ID.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Enable agent completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableAgentCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/{id}/disable": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Disable agent",
        "description": "Disable one configured Outlit agent by id. Disabled agents will not run from schedules or automations.",
        "operationId": "disableAgent",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Agent ID.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Disable agent completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisableAgentCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/{id}/rename": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Rename agent",
        "description": "Rename one configured Outlit agent display name.",
        "operationId": "renameAgent",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Agent ID.",
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rename agent completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RenameAgentCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenameAgentRequest"
              }
            }
          }
        }
      }
    },
    "/api/automations/{id}/enable": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Enable automation",
        "description": "Enable one configured Outlit automation by id after validating required resources.",
        "operationId": "enableAutomation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Automation ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Enable automation completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableAutomationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/automations/{id}/disable": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Disable automation",
        "description": "Disable one configured Outlit automation by id.",
        "operationId": "disableAutomation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Automation ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Disable automation completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisableAutomationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/automations/{id}/archive": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Archive automation",
        "description": "Archive one UI-managed Outlit automation by id. Archived automations are disabled and removed from normal lists.",
        "operationId": "archiveAutomation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Automation ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archive automation completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveAutomationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/signals/{id}": {
      "get": {
        "tags": ["Platform API"],
        "summary": "Get signal",
        "description": "Get one configured Outlit automation signal by id. Read-only.",
        "operationId": "getSignal",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Signal ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Get signal completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSignalCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No signal was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Platform API"],
        "summary": "Update signal",
        "description": "Update one UI-managed Outlit automation signal with a full signal configuration body.",
        "operationId": "updateSignal",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Signal ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSignalRequest"
              },
              "example": {
                "kind": "EVENT_MATCH",
                "name": "Workspace inactive",
                "description": null,
                "definition": {
                  "grain": "customer",
                  "subjectResolver": "event_customer",
                  "eventNames": ["workspace_inactive"],
                  "propertyConditions": [],
                  "conditionMode": "ALL"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signal was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateSignalCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/signals/{id}/archive": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Archive signal",
        "description": "Archive one UI-managed Outlit automation signal by id.",
        "operationId": "archiveSignal",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Signal ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archive signal completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveSignalCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/destinations/{id}": {
      "get": {
        "tags": ["Platform API"],
        "summary": "Get destination",
        "description": "Get one configured Outlit automation destination by id with masked configuration only. Read-only.",
        "operationId": "getDestination",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Destination ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Get destination completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetDestinationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent read scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No destination was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": ["Platform API"],
        "summary": "Update destination",
        "description": "Update one automation destination. Responses include masked configuration only.",
        "operationId": "updateDestination",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Destination ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDestinationRequest"
              },
              "example": {
                "type": "WEBHOOK_ENDPOINT",
                "name": "Customer ops",
                "description": null,
                "enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Destination was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateDestinationCommandSuccess"
                }
              }
            }
          },
          "400": {
            "description": "The request body failed command validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/destinations/{id}/enable": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Enable destination",
        "description": "Enable one configured Outlit automation destination by id. Does not test or send to the destination.",
        "operationId": "enableDestination",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Destination ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Enable destination completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnableDestinationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/destinations/{id}/disable": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Disable destination",
        "description": "Disable one configured Outlit automation destination by id.",
        "operationId": "disableDestination",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Destination ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Disable destination completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisableDestinationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/destinations/{id}/archive": {
      "post": {
        "tags": ["Platform API"],
        "summary": "Archive destination",
        "description": "Archive one configured Outlit automation destination by id. Archived destinations are disabled and removed from normal lists.",
        "operationId": "archiveDestination",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Destination ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Archive destination completed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArchiveDestinationCommandSuccess"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The API key is valid but does not have the required agent write scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "No resource was found for the authenticated organization and requested id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "The requested lifecycle change conflicts with the current platform state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "503": {
            "description": "The platform could not complete the command.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandErrorEnvelope"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Outlit API key using the Bearer ok_... format."
      }
    },
    "headers": {
      "RateLimitLimit": {
        "description": "Maximum requests allowed in the current window.",
        "schema": {
          "type": "integer",
          "example": 100
        }
      },
      "RateLimitRemaining": {
        "description": "Requests remaining in the current window.",
        "schema": {
          "type": "integer",
          "example": 95
        }
      },
      "RateLimitReset": {
        "description": "Unix timestamp when the current rate limit window resets.",
        "schema": {
          "type": "integer",
          "example": 1699999999
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid request body or parameters.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Invalid request"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Invalid or missing API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Invalid credentials"
            }
          }
        }
      },
      "PlanLimit": {
        "description": "Plan API-call limit reached.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlanLimitError"
            }
          }
        }
      },
      "PlanConnectionLimit": {
        "description": "Plan integration connection limit reached.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PlanConnectionLimitError"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal server error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "error": "Internal server error"
            }
          }
        }
      }
    },
    "schemas": {
      "ValidateApiKeySuccess": {
        "type": "object",
        "required": ["valid", "organizationId"],
        "properties": {
          "valid": {
            "type": "boolean",
            "const": true
          },
          "organizationId": {
            "type": "string"
          },
          "createdById": {
            "type": ["string", "null"]
          }
        },
        "additionalProperties": false
      },
      "ToolCallRequest": {
        "type": "object",
        "required": ["tool"],
        "properties": {
          "tool": {
            "type": "string",
            "description": "Customer intelligence tool name from @outlit/tools.",
            "enum": [
              "outlit_list_customers",
              "outlit_list_users",
              "outlit_list_workspace_users",
              "outlit_get_customer",
              "outlit_get_timeline",
              "outlit_list_facts",
              "outlit_get_fact",
              "outlit_get_source",
              "outlit_list_sources",
              "outlit_search_customer_context",
              "outlit_query",
              "outlit_schema",
              "outlit_send_notification"
            ]
          },
          "input": {
            "type": "object",
            "description": "Tool-specific input object validated against the shared @outlit/tools contract.",
            "additionalProperties": true,
            "default": {}
          }
        },
        "additionalProperties": false
      },
      "CommandResource": {
        "type": "object",
        "required": ["type", "id"],
        "properties": {
          "type": {
            "type": "string"
          },
          "id": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CommandResultBase": {
        "type": "object",
        "required": ["operationId", "status", "resources", "data", "warnings"],
        "properties": {
          "operationId": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "const": "completed"
          },
          "resources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommandResource"
            }
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "auditId": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CommandErrorEnvelope": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "error"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "commandId": {
            "type": "string"
          },
          "commandVersion": {
            "type": "integer",
            "minimum": 1
          },
          "error": {
            "type": "object",
            "required": ["code", "message", "correlationId", "retryable"],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "validation_failed",
                  "authorization_denied",
                  "conflict",
                  "not_found",
                  "rate_limited",
                  "transient_failure"
                ]
              },
              "message": {
                "type": "string"
              },
              "correlationId": {
                "type": "string"
              },
              "retryable": {
                "type": "boolean"
              },
              "details": {
                "type": "object",
                "additionalProperties": true
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "AgentTemplateKey": {
        "type": "string",
        "enum": ["churn"]
      },
      "AgentTemplateMode": {
        "type": "string",
        "enum": ["draft"]
      },
      "AgentTemplateSummary": {
        "type": "object",
        "required": [
          "key",
          "version",
          "name",
          "description",
          "creates",
          "defaultMode",
          "supportedModes"
        ],
        "properties": {
          "key": {
            "$ref": "#/components/schemas/AgentTemplateKey"
          },
          "version": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "creates": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["agent", "signal", "automation"]
            }
          },
          "defaultMode": {
            "$ref": "#/components/schemas/AgentTemplateMode"
          },
          "supportedModes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AgentTemplateMode"
            }
          }
        },
        "additionalProperties": false
      },
      "AgentActionSummary": {
        "type": "object",
        "required": ["key", "version", "label", "category", "subjectTypes"],
        "properties": {
          "key": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "minimum": 1
          },
          "label": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "subjectTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["CUSTOMER"]
            }
          }
        },
        "additionalProperties": false
      },
      "AgentStatus": {
        "type": "string",
        "enum": ["ENABLED", "DISABLED"]
      },
      "AgentScheduleSummary": {
        "type": "object",
        "required": ["enabled", "nextRunAt", "lastRunAt", "lastSuccessfulRunAt"],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "nextRunAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "lastRunAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "lastSuccessfulRunAt": {
            "type": ["string", "null"],
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "AgentSummary": {
        "type": "object",
        "required": [
          "id",
          "agentKey",
          "displayName",
          "status",
          "templateVersion",
          "actionKeys",
          "schedule",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "agentKey": {
            "type": "string"
          },
          "displayName": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/AgentStatus"
          },
          "templateVersion": {
            "type": "string"
          },
          "actionKeys": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "schedule": {
            "$ref": "#/components/schemas/AgentScheduleSummary"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "ListAgentTemplatesCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.listTemplates"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.templates.list"
                  },
                  "data": {
                    "type": "object",
                    "required": ["templates"],
                    "properties": {
                      "templates": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/AgentTemplateSummary"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ListAgentActionsCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.listAvailableActions"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.availableActions.list"
                  },
                  "data": {
                    "type": "object",
                    "required": ["actions"],
                    "properties": {
                      "actions": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/AgentActionSummary"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ListAgentsCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.list"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.list"
                  },
                  "data": {
                    "type": "object",
                    "required": ["agents"],
                    "properties": {
                      "agents": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/AgentSummary"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "GetAgentCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.get"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.get"
                  },
                  "data": {
                    "type": "object",
                    "required": ["agent"],
                    "properties": {
                      "agent": {
                        "$ref": "#/components/schemas/AgentSummary"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateAgentTemplateRequest": {
        "type": "object",
        "required": ["type", "templateKey"],
        "properties": {
          "type": {
            "type": "string",
            "const": "template"
          },
          "templateKey": {
            "$ref": "#/components/schemas/AgentTemplateKey"
          },
          "mode": {
            "$ref": "#/components/schemas/AgentTemplateMode"
          }
        },
        "additionalProperties": false
      },
      "CreateAgentRequest": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CreateAgentTemplateRequest"
          },
          {
            "$ref": "#/components/schemas/CreateAgentCustomRequest"
          }
        ]
      },
      "CreateAgentCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.create"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.create"
                  },
                  "data": {
                    "type": "object",
                    "required": ["agent"],
                    "properties": {
                      "agent": {
                        "$ref": "#/components/schemas/AgentSummary"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ProviderId": {
        "type": "string",
        "description": "Public integration provider ID.",
        "enum": [
          "hubspot",
          "attio",
          "slack",
          "fireflies",
          "granola",
          "google-calendar",
          "google-mail",
          "posthog",
          "stripe",
          "supabase",
          "clerk",
          "pylon"
        ]
      },
      "Integration": {
        "type": "object",
        "required": ["id", "name", "category", "status"],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "examples": ["billing", "crm", "analytics"]
          },
          "status": {
            "type": "string",
            "enum": ["connected", "not_connected"]
          },
          "connectionId": {
            "type": ["string", "null"]
          },
          "lastDataReceivedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "syncStatus": {
            "type": ["string", "null"],
            "examples": ["SUCCESS"]
          },
          "errorMessage": {
            "type": ["string", "null"]
          }
        },
        "additionalProperties": false
      },
      "IntegrationCapabilitiesResponse": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ProviderCapabilityEnvelope"
          },
          {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/ProviderCapability"
            }
          }
        ]
      },
      "ProviderCapabilityEnvelope": {
        "type": "object",
        "required": ["provider"],
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/ProviderCapability"
          }
        },
        "additionalProperties": false
      },
      "ProviderCapability": {
        "type": "object",
        "required": ["cliName", "providerId", "setupMode"],
        "properties": {
          "cliName": {
            "type": "string"
          },
          "providerId": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "setupMode": {
            "type": "string",
            "examples": ["direct_api_key", "browser_session"]
          },
          "credentialType": {
            "type": ["string", "null"],
            "examples": ["api_token"]
          },
          "requiredFields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderCredentialField"
            }
          },
          "commands": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "postConnectSteps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderPostConnectStep"
            }
          }
        },
        "additionalProperties": true
      },
      "ProviderCredentialField": {
        "type": "object",
        "required": ["key", "label"],
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "secret": {
            "type": "boolean"
          }
        },
        "additionalProperties": true
      },
      "ProviderPostConnectStep": {
        "type": "object",
        "required": ["id", "required", "supported"],
        "properties": {
          "id": {
            "type": "string",
            "examples": ["webhook-setup", "mappings"]
          },
          "required": {
            "type": "boolean"
          },
          "supported": {
            "type": "boolean"
          },
          "command": {
            "type": "string"
          }
        },
        "additionalProperties": true
      },
      "IntegrationSetupStepRequest": {
        "type": "object",
        "required": ["provider", "step"],
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "step": {
            "type": "string",
            "minLength": 1,
            "examples": ["mappings", "webhooks"]
          },
          "config": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "IntegrationConnectRequest": {
        "type": "object",
        "required": ["provider"],
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "config": {
            "type": "object",
            "description": "Direct credential config. Omit to create a browser-auth connection session.",
            "additionalProperties": true
          }
        },
        "additionalProperties": false
      },
      "IntegrationDisconnectRequest": {
        "type": "object",
        "required": ["provider"],
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/ProviderId"
          }
        },
        "additionalProperties": false
      },
      "IntegrationDirectConnectionResponse": {
        "type": "object",
        "required": ["connected", "connectionId", "alreadyConnected"],
        "properties": {
          "connected": {
            "type": "boolean"
          },
          "connectionId": {
            "type": "string"
          },
          "alreadyConnected": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "IntegrationDisconnectResponse": {
        "type": "object",
        "required": ["success"],
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          }
        },
        "additionalProperties": false
      },
      "IntegrationDisconnectNotConnectedResponse": {
        "type": "object",
        "required": ["success", "message"],
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "IntegrationBrowserSessionResponse": {
        "type": "object",
        "required": ["sessionId", "connectUrl", "alreadyConnected"],
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "connectUrl": {
            "type": "string",
            "format": "uri"
          },
          "alreadyConnected": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "IntegrationConnectionStatusResponse": {
        "type": "object",
        "required": ["status", "provider"],
        "properties": {
          "status": {
            "type": "string",
            "enum": ["pending", "connected", "failed", "expired"]
          },
          "provider": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "error": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "IntegrationSyncStatusResponse": {
        "type": "object",
        "required": ["provider", "name", "category", "status", "syncs"],
        "properties": {
          "provider": {
            "$ref": "#/components/schemas/ProviderId"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": ["connected", "not_connected"]
          },
          "syncs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationSync"
            }
          }
        },
        "additionalProperties": false
      },
      "IntegrationSync": {
        "type": "object",
        "required": ["model", "status"],
        "properties": {
          "model": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "examples": ["SUCCESS", "FAILED", "PENDING"]
          },
          "lastSyncedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "errorMessage": {
            "type": ["string", "null"]
          }
        },
        "additionalProperties": false
      },
      "IngestEventsRequest": {
        "type": "object",
        "required": ["events"],
        "properties": {
          "visitorId": {
            "type": "string",
            "format": "uuid",
            "description": "Browser visitor identifier. Required for client tracking."
          },
          "source": {
            "type": "string",
            "enum": ["client", "server", "integration"],
            "default": "client"
          },
          "userIdentity": {
            "$ref": "#/components/schemas/UserIdentity"
          },
          "customerIdentity": {
            "$ref": "#/components/schemas/CustomerIdentity"
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/IngestEvent"
            }
          }
        },
        "additionalProperties": false
      },
      "UserIdentity": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "userId": {
            "type": "string"
          },
          "traits": {
            "$ref": "#/components/schemas/JsonObject"
          }
        },
        "additionalProperties": false
      },
      "CustomerIdentity": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "string"
          },
          "customerTraits": {
            "$ref": "#/components/schemas/JsonObject"
          }
        },
        "additionalProperties": false
      },
      "IngestEvent": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PageviewEvent"
          },
          {
            "$ref": "#/components/schemas/CustomEvent"
          },
          {
            "$ref": "#/components/schemas/FormEvent"
          },
          {
            "$ref": "#/components/schemas/IdentifyEvent"
          },
          {
            "$ref": "#/components/schemas/EngagementEvent"
          },
          {
            "$ref": "#/components/schemas/CalendarEvent"
          },
          {
            "$ref": "#/components/schemas/StageEvent"
          },
          {
            "$ref": "#/components/schemas/BillingEvent"
          }
        ]
      },
      "BaseEventFields": {
        "type": "object",
        "required": ["type"],
        "properties": {
          "type": {
            "type": "string"
          },
          "timestamp": {
            "type": "number",
            "description": "Unix timestamp in milliseconds."
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "path": {
            "type": "string"
          },
          "referrer": {
            "type": "string"
          },
          "utm": {
            "$ref": "#/components/schemas/UtmParameters"
          }
        }
      },
      "PageviewEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type"],
            "properties": {
              "type": {
                "const": "pageview"
              },
              "title": {
                "type": "string"
              }
            }
          }
        ]
      },
      "CustomEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type", "eventName"],
            "properties": {
              "type": {
                "const": "custom"
              },
              "eventName": {
                "type": "string"
              },
              "properties": {
                "$ref": "#/components/schemas/JsonObject"
              }
            }
          }
        ]
      },
      "FormEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type"],
            "properties": {
              "type": {
                "const": "form"
              },
              "formId": {
                "type": "string"
              },
              "formFields": {
                "$ref": "#/components/schemas/JsonObject"
              }
            }
          }
        ]
      },
      "IdentifyEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type"],
            "properties": {
              "type": {
                "const": "identify"
              },
              "email": {
                "type": "string",
                "format": "email"
              },
              "userId": {
                "type": "string"
              },
              "customerId": {
                "type": "string"
              },
              "traits": {
                "$ref": "#/components/schemas/JsonObject"
              },
              "customerTraits": {
                "$ref": "#/components/schemas/JsonObject"
              }
            }
          }
        ]
      },
      "EngagementEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type", "activeTimeMs", "totalTimeMs", "sessionId"],
            "properties": {
              "type": {
                "const": "engagement"
              },
              "activeTimeMs": {
                "type": "number",
                "minimum": 0
              },
              "totalTimeMs": {
                "type": "number",
                "minimum": 0
              },
              "sessionId": {
                "type": "string",
                "format": "uuid"
              }
            }
          }
        ]
      },
      "CalendarEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type", "provider"],
            "properties": {
              "type": {
                "const": "calendar"
              },
              "provider": {
                "type": "string",
                "enum": ["cal.com", "calendly", "unknown"]
              },
              "eventType": {
                "type": "string"
              },
              "startTime": {
                "type": "string",
                "format": "date-time"
              },
              "endTime": {
                "type": "string",
                "format": "date-time"
              },
              "duration": {
                "type": "number"
              },
              "isRecurring": {
                "type": "boolean"
              },
              "inviteeEmail": {
                "type": "string",
                "format": "email"
              },
              "inviteeName": {
                "type": "string"
              }
            }
          }
        ]
      },
      "StageEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type", "stage"],
            "properties": {
              "type": {
                "const": "stage"
              },
              "stage": {
                "type": "string",
                "enum": ["activated", "engaged", "inactive"]
              },
              "properties": {
                "$ref": "#/components/schemas/JsonObject"
              }
            }
          }
        ]
      },
      "BillingEvent": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BaseEventFields"
          },
          {
            "type": "object",
            "required": ["type", "status"],
            "properties": {
              "type": {
                "const": "billing"
              },
              "status": {
                "type": "string",
                "enum": ["trialing", "paid", "churned"]
              },
              "customerId": {
                "type": "string"
              },
              "stripeCustomerId": {
                "type": "string"
              },
              "properties": {
                "$ref": "#/components/schemas/JsonObject"
              }
            }
          }
        ]
      },
      "UtmParameters": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string"
          },
          "medium": {
            "type": "string"
          },
          "campaign": {
            "type": "string"
          },
          "term": {
            "type": "string"
          },
          "content": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "JsonObject": {
        "type": "object",
        "additionalProperties": true
      },
      "IngestEventsSuccess": {
        "type": "object",
        "required": ["success"],
        "properties": {
          "success": {
            "type": "boolean",
            "const": true
          }
        },
        "additionalProperties": true
      },
      "IngestEventsError": {
        "type": "object",
        "required": ["success", "message"],
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationIssue"
            }
          }
        },
        "additionalProperties": true
      },
      "ValidationIssue": {
        "type": "object",
        "required": ["path", "message"],
        "properties": {
          "path": {
            "type": "array",
            "items": {
              "type": ["string", "number"]
            }
          },
          "message": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string"
          },
          "details": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationIssue"
            }
          }
        },
        "additionalProperties": true
      },
      "PlanLimitError": {
        "type": "object",
        "required": ["error", "code"],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "examples": ["api_limit_exceeded"]
          },
          "plan": {
            "type": "string"
          },
          "feature": {
            "type": "string",
            "examples": ["api_calls"]
          },
          "resetAt": {
            "type": "number"
          }
        },
        "additionalProperties": true
      },
      "PlanConnectionLimitError": {
        "type": "object",
        "required": ["error", "code"],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "examples": ["plan_connection_limit_exceeded"]
          },
          "feature": {
            "type": "string",
            "examples": ["integration_connections"]
          },
          "plan": {
            "type": "string"
          },
          "currentConnections": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          }
        },
        "additionalProperties": true
      },
      "PlatformActionManagedBy": {
        "type": "string",
        "enum": ["UI", "CODE"]
      },
      "SignalKind": {
        "type": "string",
        "enum": ["EVENT_MATCH", "EVENT_PATTERN"]
      },
      "AutomationTriggerType": {
        "type": "string",
        "enum": ["SIGNAL_OCCURRENCE", "SCHEDULE"]
      },
      "AutomationOutcomeType": {
        "type": "string",
        "enum": ["DIRECT_DELIVERY", "AGENT_PROCESSOR"]
      },
      "AutomationMatchMode": {
        "type": "string",
        "enum": ["ANY", "ALL", "AT_LEAST"]
      },
      "AutomationRunStatus": {
        "type": "string",
        "enum": [
          "PENDING",
          "SKIPPED",
          "RUNNING_PROCESSOR",
          "READY_FOR_DELIVERY",
          "PENDING_DELIVERY",
          "DELIVERED",
          "PARTIAL_FAILURE",
          "FAILED"
        ]
      },
      "DestinationProvider": {
        "type": "string",
        "enum": ["SLACK", "OUTPOST", "WEBHOOK"]
      },
      "DestinationKind": {
        "type": "string",
        "enum": ["SLACK_CHANNEL", "WEBHOOK_ENDPOINT"]
      },
      "DestinationSyncStatus": {
        "type": "string",
        "enum": ["PENDING_PROVIDER_SYNC", "SYNCED", "PROVIDER_ERROR", "DISABLED_BY_PROVIDER"]
      },
      "SignalRead": {
        "type": "object",
        "required": [
          "id",
          "key",
          "managedBy",
          "name",
          "description",
          "kind",
          "definition",
          "schemaVersion",
          "configHash",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "managedBy": {
            "$ref": "#/components/schemas/PlatformActionManagedBy"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "kind": {
            "$ref": "#/components/schemas/SignalKind"
          },
          "definition": {},
          "schemaVersion": {
            "type": "string"
          },
          "configHash": {
            "type": ["string", "null"]
          },
          "archivedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "DestinationRead": {
        "type": "object",
        "required": [
          "id",
          "key",
          "name",
          "description",
          "provider",
          "kind",
          "enabled",
          "maskedConfig",
          "syncStatus",
          "lastSyncedAt",
          "providerErrorCode",
          "providerErrorMessage",
          "isDefault",
          "schemaVersion",
          "configHash",
          "archivedAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "provider": {
            "$ref": "#/components/schemas/DestinationProvider"
          },
          "kind": {
            "$ref": "#/components/schemas/DestinationKind"
          },
          "enabled": {
            "type": "boolean"
          },
          "maskedConfig": {
            "anyOf": [
              {
                "type": "object",
                "additionalProperties": true
              },
              {
                "type": "null"
              }
            ]
          },
          "syncStatus": {
            "$ref": "#/components/schemas/DestinationSyncStatus"
          },
          "lastSyncedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "providerErrorCode": {
            "type": ["string", "null"]
          },
          "providerErrorMessage": {
            "type": ["string", "null"]
          },
          "isDefault": {
            "type": "boolean"
          },
          "schemaVersion": {
            "type": "string"
          },
          "configHash": {
            "type": ["string", "null"]
          },
          "archivedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "AutomationRead": {
        "type": "object",
        "required": [
          "id",
          "key",
          "managedBy",
          "name",
          "description",
          "enabled",
          "triggerType",
          "triggerJson",
          "audienceFilterJson",
          "agentId",
          "matchMode",
          "schemaVersion",
          "configHash",
          "archivedAt",
          "lastRunAt",
          "lastRunStatus",
          "nextRunAt",
          "createdAt",
          "updatedAt",
          "signals",
          "destinations",
          "activeSignalCount",
          "activeDestinationCount"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "managedBy": {
            "$ref": "#/components/schemas/PlatformActionManagedBy"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": ["string", "null"]
          },
          "enabled": {
            "type": "boolean"
          },
          "triggerType": {
            "$ref": "#/components/schemas/AutomationTriggerType"
          },
          "triggerJson": {},
          "audienceFilterJson": {},
          "matchMode": {
            "$ref": "#/components/schemas/AutomationMatchMode"
          },
          "schemaVersion": {
            "type": "string"
          },
          "configHash": {
            "type": ["string", "null"]
          },
          "archivedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "lastRunAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "lastRunStatus": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AutomationRunStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "nextRunAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "signals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignalRead"
            }
          },
          "destinations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DestinationRead"
            }
          },
          "activeSignalCount": {
            "type": "integer",
            "minimum": 0
          },
          "activeDestinationCount": {
            "type": "integer",
            "minimum": 0
          },
          "agentId": {
            "type": ["string", "null"],
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "ListAutomationsCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "automation.list"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "automation.list"
                  },
                  "data": {
                    "type": "object",
                    "required": ["automations"],
                    "properties": {
                      "automations": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/AutomationRead"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "GetAutomationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "automation.get"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "automation.get"
                  },
                  "data": {
                    "type": "object",
                    "required": ["automation"],
                    "properties": {
                      "automation": {
                        "$ref": "#/components/schemas/AutomationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ListSignalsCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "signal.list"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "signal.list"
                  },
                  "data": {
                    "type": "object",
                    "required": ["signals"],
                    "properties": {
                      "signals": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/SignalRead"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ListDestinationsCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "destination.list"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "destination.list"
                  },
                  "data": {
                    "type": "object",
                    "required": ["destinations"],
                    "properties": {
                      "destinations": {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/DestinationRead"
                        }
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ArchivedResource": {
        "type": "object",
        "required": ["id", "archivedAt"],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "RenameAgentRequest": {
        "type": "object",
        "required": ["displayName"],
        "properties": {
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          }
        },
        "additionalProperties": false
      },
      "EnableAgentCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.enable"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.enable"
                  },
                  "data": {
                    "type": "object",
                    "required": ["agent"],
                    "properties": {
                      "agent": {
                        "$ref": "#/components/schemas/AgentSummary"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "DisableAgentCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.disable"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.disable"
                  },
                  "data": {
                    "type": "object",
                    "required": ["agent"],
                    "properties": {
                      "agent": {
                        "$ref": "#/components/schemas/AgentSummary"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "RenameAgentCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.rename"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.rename"
                  },
                  "data": {
                    "type": "object",
                    "required": ["agent"],
                    "properties": {
                      "agent": {
                        "$ref": "#/components/schemas/AgentSummary"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "EnableAutomationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "automation.enable"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "automation.enable"
                  },
                  "data": {
                    "type": "object",
                    "required": ["automation"],
                    "properties": {
                      "automation": {
                        "$ref": "#/components/schemas/AutomationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "DisableAutomationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "automation.disable"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "automation.disable"
                  },
                  "data": {
                    "type": "object",
                    "required": ["automation"],
                    "properties": {
                      "automation": {
                        "$ref": "#/components/schemas/AutomationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ArchiveAutomationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "automation.archive"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "automation.archive"
                  },
                  "data": {
                    "type": "object",
                    "required": ["automation"],
                    "properties": {
                      "automation": {
                        "$ref": "#/components/schemas/ArchivedResource"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "GetSignalCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "signal.get"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "signal.get"
                  },
                  "data": {
                    "type": "object",
                    "required": ["signal"],
                    "properties": {
                      "signal": {
                        "$ref": "#/components/schemas/SignalRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ArchiveSignalCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "signal.archive"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "signal.archive"
                  },
                  "data": {
                    "type": "object",
                    "required": ["signal"],
                    "properties": {
                      "signal": {
                        "$ref": "#/components/schemas/ArchivedResource"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "GetDestinationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "destination.get"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "destination.get"
                  },
                  "data": {
                    "type": "object",
                    "required": ["destination"],
                    "properties": {
                      "destination": {
                        "$ref": "#/components/schemas/DestinationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "EnableDestinationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "destination.enable"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "destination.enable"
                  },
                  "data": {
                    "type": "object",
                    "required": ["destination"],
                    "properties": {
                      "destination": {
                        "$ref": "#/components/schemas/DestinationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "DisableDestinationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "destination.disable"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "destination.disable"
                  },
                  "data": {
                    "type": "object",
                    "required": ["destination"],
                    "properties": {
                      "destination": {
                        "$ref": "#/components/schemas/DestinationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "ArchiveDestinationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "destination.archive"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "destination.archive"
                  },
                  "data": {
                    "type": "object",
                    "required": ["destination"],
                    "properties": {
                      "destination": {
                        "$ref": "#/components/schemas/ArchivedResource"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateAgentCustomRequest": {
        "type": "object",
        "required": ["type", "displayName", "instructions", "surfaceCriteria"],
        "properties": {
          "type": {
            "type": "string",
            "const": "custom"
          },
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "instructions": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "surfaceCriteria": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "skipCriteria": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "maxItemsToSurface": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "default": 10
          },
          "actionKeys": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          }
        },
        "additionalProperties": false
      },
      "UpdateAgentRequest": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "displayName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "instructions": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10000
          },
          "actionKeys": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "additionalProperties": false
      },
      "CreateAutomationRequest": {
        "type": "object",
        "required": ["agentId", "name", "triggerType"],
        "properties": {
          "agentId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "type": ["string", "null"],
            "maxLength": 1000,
            "default": null
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "triggerType": {
            "$ref": "#/components/schemas/AutomationTriggerType"
          },
          "signalIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 50,
            "default": []
          },
          "matchMode": {
            "$ref": "#/components/schemas/AutomationMatchMode"
          },
          "triggerWindow": {
            "type": "object",
            "properties": {
              "value": {
                "type": "integer",
                "minimum": 1
              },
              "unit": {
                "type": "string",
                "enum": ["hour", "day"]
              }
            },
            "required": ["value", "unit"],
            "additionalProperties": false
          },
          "triggerThresholdCount": {
            "type": "integer",
            "minimum": 2,
            "maximum": 5
          },
          "schedule": {
            "type": "object",
            "properties": {
              "cadence": {
                "type": "string",
                "enum": ["hourly", "daily", "weekly"]
              },
              "localTime": {
                "type": "object",
                "properties": {
                  "hour": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 23
                  },
                  "minute": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 59
                  },
                  "second": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 59,
                    "default": 0
                  },
                  "millisecond": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 999,
                    "default": 0
                  }
                },
                "required": ["hour", "minute"],
                "additionalProperties": false
              },
              "timezone": {
                "type": "string",
                "default": "America/Los_Angeles"
              },
              "weekday": {
                "type": "string",
                "enum": [
                  "monday",
                  "tuesday",
                  "wednesday",
                  "thursday",
                  "friday",
                  "saturday",
                  "sunday"
                ]
              }
            },
            "required": ["cadence"],
            "additionalProperties": false
          },
          "audienceFilter": {
            "$ref": "#/components/schemas/AutomationAudienceFilter"
          },
          "processorPolicy": {
            "type": "object",
            "properties": {
              "subjectHandling": {
                "type": "string",
                "enum": ["event_customer", "scheduled_customer_pool"],
                "default": "event_customer"
              },
              "maxCustomersPerRun": {
                "type": "integer",
                "minimum": 1,
                "maximum": 500
              },
              "maxConcurrentRuns": {
                "type": "integer",
                "const": 1
              },
              "cooldownHours": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2160
              }
            },
            "additionalProperties": false
          },
          "deliveryPolicy": {
            "type": "object",
            "properties": {
              "requireAllDestinations": {
                "type": "boolean",
                "default": false
              }
            },
            "additionalProperties": false,
            "default": {
              "requireAllDestinations": false
            }
          },
          "destinationIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 25,
            "default": []
          }
        },
        "additionalProperties": false
      },
      "UpdateAutomationRequest": {
        "type": "object",
        "required": ["agentId", "name", "enabled", "triggerType"],
        "properties": {
          "agentId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "type": ["string", "null"],
            "maxLength": 1000,
            "default": null
          },
          "enabled": {
            "type": "boolean"
          },
          "triggerType": {
            "$ref": "#/components/schemas/AutomationTriggerType"
          },
          "signalIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 50,
            "default": []
          },
          "matchMode": {
            "$ref": "#/components/schemas/AutomationMatchMode"
          },
          "triggerWindow": {
            "type": "object",
            "properties": {
              "value": {
                "type": "integer",
                "minimum": 1
              },
              "unit": {
                "type": "string",
                "enum": ["hour", "day"]
              }
            },
            "required": ["value", "unit"],
            "additionalProperties": false
          },
          "triggerThresholdCount": {
            "type": "integer",
            "minimum": 2,
            "maximum": 5
          },
          "schedule": {
            "type": "object",
            "properties": {
              "cadence": {
                "type": "string",
                "enum": ["hourly", "daily", "weekly"]
              },
              "localTime": {
                "type": "object",
                "properties": {
                  "hour": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 23
                  },
                  "minute": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 59
                  },
                  "second": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 59,
                    "default": 0
                  },
                  "millisecond": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 999,
                    "default": 0
                  }
                },
                "required": ["hour", "minute"],
                "additionalProperties": false
              },
              "timezone": {
                "type": "string",
                "default": "America/Los_Angeles"
              },
              "weekday": {
                "type": "string",
                "enum": [
                  "monday",
                  "tuesday",
                  "wednesday",
                  "thursday",
                  "friday",
                  "saturday",
                  "sunday"
                ]
              }
            },
            "required": ["cadence"],
            "additionalProperties": false
          },
          "audienceFilter": {
            "$ref": "#/components/schemas/AutomationAudienceFilter"
          },
          "processorPolicy": {
            "type": "object",
            "properties": {
              "subjectHandling": {
                "type": "string",
                "enum": ["event_customer", "scheduled_customer_pool"],
                "default": "event_customer"
              },
              "maxCustomersPerRun": {
                "type": "integer",
                "minimum": 1,
                "maximum": 500
              },
              "maxConcurrentRuns": {
                "type": "integer",
                "const": 1
              },
              "cooldownHours": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2160
              }
            },
            "additionalProperties": false
          },
          "deliveryPolicy": {
            "type": "object",
            "properties": {
              "requireAllDestinations": {
                "type": "boolean",
                "default": false
              }
            },
            "additionalProperties": false,
            "default": {
              "requireAllDestinations": false
            }
          },
          "destinationIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 25,
            "default": []
          }
        },
        "additionalProperties": false
      },
      "CreateSignalRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": ["kind", "name", "definition"],
            "properties": {
              "kind": {
                "type": "string",
                "const": "EVENT_MATCH"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": ["string", "null"],
                "maxLength": 1000,
                "default": null
              },
              "definition": {
                "$ref": "#/components/schemas/EventMatchSignalDefinition"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": ["kind", "name", "definition"],
            "properties": {
              "kind": {
                "type": "string",
                "const": "EVENT_PATTERN"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": ["string", "null"],
                "maxLength": 1000,
                "default": null
              },
              "definition": {
                "$ref": "#/components/schemas/AuthoredSignalDefinition"
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "UpdateSignalRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": ["kind", "name", "definition"],
            "properties": {
              "kind": {
                "type": "string",
                "const": "EVENT_MATCH"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": ["string", "null"],
                "maxLength": 1000,
                "default": null
              },
              "definition": {
                "$ref": "#/components/schemas/EventMatchSignalDefinition"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": ["kind", "name", "definition"],
            "properties": {
              "kind": {
                "type": "string",
                "const": "EVENT_PATTERN"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": ["string", "null"],
                "maxLength": 1000,
                "default": null
              },
              "definition": {
                "$ref": "#/components/schemas/AuthoredSignalDefinition"
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "CreateDestinationRequest": {
        "type": "object",
        "required": ["name", "url"],
        "properties": {
          "type": {
            "type": "string",
            "const": "WEBHOOK_ENDPOINT",
            "default": "WEBHOOK_ENDPOINT"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "description": {
            "type": ["string", "null"],
            "maxLength": 1000,
            "default": null
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^(https://|http://(localhost|127\\.0\\.0\\.1|\\[::1\\]|::1)([:/]|$))"
          }
        },
        "additionalProperties": false
      },
      "UpdateDestinationRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": ["type"],
            "minProperties": 2,
            "properties": {
              "type": {
                "type": "string",
                "const": "WEBHOOK_ENDPOINT"
              },
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "description": {
                "type": ["string", "null"],
                "maxLength": 1000
              },
              "enabled": {
                "type": "boolean"
              },
              "url": {
                "type": "string",
                "format": "uri",
                "pattern": "^(https://|http://(localhost|127\\.0\\.0\\.1|\\[::1\\]|::1)([:/]|$))"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": ["type"],
            "minProperties": 2,
            "properties": {
              "type": {
                "type": "string",
                "const": "SLACK_CHANNEL"
              },
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "enabled": {
                "type": "boolean"
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "UpdateAgentCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "agent.update"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "agent.update"
                  },
                  "data": {
                    "type": "object",
                    "required": ["agent"],
                    "properties": {
                      "agent": {
                        "$ref": "#/components/schemas/AgentSummary"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateAutomationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "automation.create"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "automation.create"
                  },
                  "data": {
                    "type": "object",
                    "required": ["automation"],
                    "properties": {
                      "automation": {
                        "$ref": "#/components/schemas/AutomationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "UpdateAutomationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "automation.update"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "automation.update"
                  },
                  "data": {
                    "type": "object",
                    "required": ["automation"],
                    "properties": {
                      "automation": {
                        "$ref": "#/components/schemas/AutomationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateSignalCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "signal.create"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "signal.create"
                  },
                  "data": {
                    "type": "object",
                    "required": ["signal"],
                    "properties": {
                      "signal": {
                        "$ref": "#/components/schemas/SignalRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "UpdateSignalCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "signal.update"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "signal.update"
                  },
                  "data": {
                    "type": "object",
                    "required": ["signal"],
                    "properties": {
                      "signal": {
                        "$ref": "#/components/schemas/SignalRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateDestinationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "destination.create"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "destination.create"
                  },
                  "data": {
                    "type": "object",
                    "required": ["destination"],
                    "properties": {
                      "destination": {
                        "$ref": "#/components/schemas/DestinationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "UpdateDestinationCommandSuccess": {
        "type": "object",
        "required": ["ok", "commandId", "commandVersion", "correlationId", "result"],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "commandId": {
            "type": "string",
            "const": "destination.update"
          },
          "commandVersion": {
            "type": "integer",
            "const": 1
          },
          "correlationId": {
            "type": "string"
          },
          "result": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommandResultBase"
              },
              {
                "type": "object",
                "properties": {
                  "operationId": {
                    "type": "string",
                    "const": "destination.update"
                  },
                  "data": {
                    "type": "object",
                    "required": ["destination"],
                    "properties": {
                      "destination": {
                        "$ref": "#/components/schemas/DestinationRead"
                      }
                    },
                    "additionalProperties": false
                  }
                }
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "SignalPropertyCondition": {
        "oneOf": [
          {
            "type": "object",
            "required": ["key", "operator"],
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "operator": {
                "type": "string",
                "const": "exists"
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": ["key", "operator", "value"],
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "operator": {
                "type": "string",
                "enum": ["equals", "not_equals"]
              },
              "value": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "number"
                  },
                  {
                    "type": "boolean"
                  }
                ]
              }
            },
            "additionalProperties": false
          },
          {
            "type": "object",
            "required": ["key", "operator", "value"],
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "operator": {
                "type": "string",
                "const": "starts_with"
              },
              "value": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        ]
      },
      "EventChannel": {
        "type": "string",
        "enum": [
          "PRODUCT",
          "COMMUNICATION",
          "MEETING",
          "CRM",
          "BILLING",
          "SUPPORT",
          "IDENTITY",
          "DOCUMENT",
          "SYSTEM"
        ]
      },
      "EventMatchSignalDefinition": {
        "type": "object",
        "required": ["grain", "subjectResolver", "eventNames"],
        "properties": {
          "grain": {
            "type": "string",
            "enum": ["organization", "customer", "segment"]
          },
          "subjectResolver": {
            "type": "string",
            "enum": ["organization", "event_customer", "segment"]
          },
          "eventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "maxItems": 50,
            "minItems": 1
          },
          "eventChannels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventChannel"
            },
            "maxItems": 9
          },
          "propertyConditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignalPropertyCondition"
            },
            "maxItems": 5,
            "default": []
          },
          "conditionMode": {
            "type": "string",
            "const": "ALL",
            "default": "ALL"
          }
        },
        "additionalProperties": false
      },
      "SignalWindow": {
        "type": "object",
        "required": ["value", "unit"],
        "properties": {
          "value": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "unit": {
            "type": "string",
            "enum": ["hour", "day"]
          }
        },
        "additionalProperties": false
      },
      "EventOccurredDetection": {
        "type": "object",
        "required": ["type", "eventNames"],
        "properties": {
          "type": {
            "type": "string",
            "const": "event_occurred"
          },
          "eventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "maxItems": 50,
            "minItems": 1
          },
          "eventChannels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventChannel"
            },
            "maxItems": 9
          },
          "propertyConditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignalPropertyCondition"
            },
            "maxItems": 5,
            "default": []
          }
        },
        "additionalProperties": false
      },
      "EventCountThresholdDetection": {
        "type": "object",
        "required": ["type", "eventNames", "threshold", "window"],
        "properties": {
          "type": {
            "type": "string",
            "const": "event_count_threshold"
          },
          "eventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "maxItems": 50,
            "minItems": 1
          },
          "eventChannels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventChannel"
            },
            "maxItems": 9
          },
          "propertyConditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignalPropertyCondition"
            },
            "maxItems": 5,
            "default": []
          },
          "threshold": {
            "type": "object",
            "required": ["operator", "count"],
            "properties": {
              "operator": {
                "type": "string",
                "enum": [">=", ">"]
              },
              "count": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000
              }
            },
            "additionalProperties": false
          },
          "window": {
            "$ref": "#/components/schemas/SignalWindow"
          }
        },
        "additionalProperties": false
      },
      "EventAbsenceDetection": {
        "type": "object",
        "required": ["type", "window"],
        "properties": {
          "type": {
            "type": "string",
            "const": "event_absence"
          },
          "eventNameMode": {
            "type": "string",
            "enum": ["exact", "all_except"]
          },
          "eventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "maxItems": 50,
            "default": []
          },
          "excludeEventNames": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "maxItems": 50
          },
          "eventChannels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventChannel"
            },
            "maxItems": 9
          },
          "propertyConditions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignalPropertyCondition"
            },
            "maxItems": 5,
            "default": []
          },
          "window": {
            "type": "object",
            "required": ["value", "unit"],
            "properties": {
              "value": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30
              },
              "unit": {
                "type": "string",
                "const": "day"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "ActivityWindow": {
        "type": "object",
        "required": ["value", "unit"],
        "properties": {
          "value": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "unit": {
            "type": "string",
            "const": "day"
          }
        },
        "additionalProperties": false
      },
      "CustomerActivityThresholdDetection": {
        "type": "object",
        "required": ["type", "metric", "window", "operator", "count"],
        "properties": {
          "type": {
            "type": "string",
            "const": "customer_activity_threshold"
          },
          "metric": {
            "type": "string",
            "const": "active_days"
          },
          "window": {
            "$ref": "#/components/schemas/ActivityWindow"
          },
          "operator": {
            "type": "string",
            "enum": ["<=", "<", ">=", ">"]
          },
          "count": {
            "type": "integer",
            "minimum": 0,
            "maximum": 365
          },
          "minimumObservedAgeDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          }
        },
        "additionalProperties": false
      },
      "CustomerActivityDropDetection": {
        "type": "object",
        "required": [
          "type",
          "metric",
          "window",
          "baselineWindow",
          "dropPercent",
          "minimumBaselineActiveDays",
          "minimumBaselineEventCount"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "customer_activity_drop"
          },
          "metric": {
            "type": "string",
            "const": "active_days"
          },
          "window": {
            "$ref": "#/components/schemas/ActivityWindow"
          },
          "baselineWindow": {
            "$ref": "#/components/schemas/ActivityWindow"
          },
          "dropPercent": {
            "type": "number",
            "minimum": 1,
            "maximum": 100
          },
          "minimumBaselineActiveDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "minimumBaselineEventCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100000
          }
        },
        "additionalProperties": false
      },
      "RelatedUserInactivityDetection": {
        "type": "object",
        "required": [
          "type",
          "priorWindow",
          "inactiveWindow",
          "minimumPriorActiveDays",
          "minimumPreviouslyActiveUsers"
        ],
        "properties": {
          "type": {
            "type": "string",
            "const": "related_user_inactivity"
          },
          "priorWindow": {
            "$ref": "#/components/schemas/ActivityWindow"
          },
          "inactiveWindow": {
            "$ref": "#/components/schemas/ActivityWindow"
          },
          "minimumPriorActiveDays": {
            "type": "integer",
            "minimum": 1,
            "maximum": 365
          },
          "minimumPreviouslyActiveUsers": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          }
        },
        "additionalProperties": false
      },
      "SignalDetection": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/EventOccurredDetection"
          },
          {
            "$ref": "#/components/schemas/EventCountThresholdDetection"
          },
          {
            "$ref": "#/components/schemas/EventAbsenceDetection"
          },
          {
            "$ref": "#/components/schemas/CustomerActivityThresholdDetection"
          },
          {
            "$ref": "#/components/schemas/CustomerActivityDropDetection"
          },
          {
            "$ref": "#/components/schemas/RelatedUserInactivityDetection"
          }
        ]
      },
      "AuthoredSignalDefinition": {
        "type": "object",
        "required": ["schemaVersion", "subjectType", "detection"],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "2026-06-17"
          },
          "subjectType": {
            "type": "string",
            "const": "customer"
          },
          "catalogSource": {
            "type": "object",
            "required": ["provider", "key", "version"],
            "properties": {
              "provider": {
                "type": "string",
                "const": "outlit"
              },
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 191
              },
              "version": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              }
            },
            "additionalProperties": false
          },
          "detection": {
            "$ref": "#/components/schemas/SignalDetection"
          }
        },
        "additionalProperties": false
      },
      "AutomationAudienceRevenueFilter": {
        "type": "object",
        "required": ["metric", "operator", "value"],
        "properties": {
          "metric": {
            "type": "string",
            "enum": ["ARR", "MRR"]
          },
          "operator": {
            "type": "string",
            "enum": [">=", ">", "<=", "<"]
          },
          "value": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000
          },
          "currency": {
            "type": "string",
            "const": "USD"
          }
        },
        "additionalProperties": false
      },
      "AutomationAudienceFilter": {
        "type": "object",
        "properties": {
          "customer": {
            "type": "object",
            "properties": {
              "billingStatuses": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["NONE", "TRIALING", "PAYING", "PAST_DUE", "CHURNED"]
                }
              },
              "customerIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "revenue": {
                "$ref": "#/components/schemas/AutomationAudienceRevenueFilter"
              },
              "ownerUserIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 191
                }
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      }
    }
  }
}
