{
  "openapi": "3.0.3",
  "info": {
    "title": "Anlyon API",
    "description": "Anlyon is the production execution runtime for AI agents. An agent invokes a named\naction; Anlyon resolves the action and its version, checks the caller's scopes,\nevaluates policy, requests human approval when required, resolves credentials at\ndispatch, makes the production call itself, and records the outcome.\n\nThese guarantees cover actions routed through the hosted executor. A tool the\ncaller's own code invokes directly, with a credential that process holds, is not\nrouted through Anlyon and is not governed by it.\n\n## Authentication\n\nDeveloper API endpoints use a workspace API key as a bearer token:\n\n```\nAuthorization: Bearer anlyon_your_api_key\n```\n\n## API-key budget admission\n\nBudgets reserve supported logical operations in Postgres with integer sub-cent\ncost accounting. They cover messages, event publishes, cache lookups, memory\noperations and action invocations; external provider bills and session callers\nare outside these caps. UTC calendar months own the reservations. Batches\nreserve all planned items before execution; partial failures retain that amount.\nMemory ingest reserves one job admission, not each generated chunk or token.\nApproval-pending actions reserve one invocation admission even before dispatch.\nThese conservative admission estimates are distinct from invoice metering.\n\n429 BUDGET_EXCEEDED refuses the whole admission. 503\nBUDGET_RECONCILIATION_REQUIRED pauses keys whose legacy usage is unknown.\nA cached Idempotency-Key success replays normally. If that cache is lost or\nexpires but a durable budget reservation exists, 409\nBUDGET_EFFECT_ALREADY_RESERVED prevents executing the effect again. Investigate\nthe original outcome before choosing a new key; a new key can duplicate work.\nErrors after admission keep their reservations until an operator proves no\nwork occurred. Disabling or deleting a budget does not erase recorded usage.\n\n## Delivery signature environment attribution\n\nConfigured message and event-subscription signers emit legacy v1 plus signed\nenv/v2 attribution. v2 is HMAC-SHA256 over the exact UTF-8 string\n`anlyon-delivery-v2.${timestamp}.${environmentId}.${rawBody}`. Receivers must\nconfigure the expected environment independently; v1 alone provides no\nenvironment boundary. Signing keys remain workspace-wide unless a subscription\nuses its own secret. X-Anlyon-Environment-Id is reserved and informational,\nnot authority. Legacy queued work without recorded scope has no v2 claim.\nSee /verification for coverage, raw-body verification and staged migration.\n\n## Rate Limiting\n\nRate limits are per workspace, by plan, in one-minute windows and UTC clock hours:\n- **No plan and Early Beta Access**: 300 requests/minute, 10,000 requests/hour\n- **Starter and Pro**: 1,000 requests/minute, 30,000 requests/hour\n- **Team**: 1,000 requests/minute, 45,000 requests/hour\n- **Enterprise**: Custom\n\n## Error Handling\n\nAll errors follow a consistent format:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ERROR_CODE\",\n    \"message\": \"Human-readable error message\",\n    \"details\": {}\n  }\n}\n```\n\nCommon error codes:\n- `AUTHENTICATION_ERROR` - Invalid or missing API key\n- `RATE_LIMIT_EXCEEDED` - Too many requests: the workspace's per-minute or per-hour API request limit (429, with `Retry-After`)\n- `QUOTA_EXCEEDED` - Usage quota exceeded\n- `VALIDATION_ERROR` - Invalid request data\n- `NOT_FOUND` - Resource not found\n- `FEATURE_NOT_AVAILABLE` - Feature not available on your plan\n- `PAYMENT_REQUIRED` - The workspace has no plan, so actions are not run (402)\n- `PLAN_FEATURE_REQUIRED` - Creating or changing this needs the Team plan (403)\n- `PAID_PLANS_UNAVAILABLE` - Paid plans cannot be bought right now (403)\n- `FUNCTION_RUN_CONCURRENCY_LIMIT` - The plan's hosted function runs at once are all going (429)\n- `FUNCTION_RUN_RATE_LIMITED` - The plan's hosted function run starts a minute are used (429)\n",
    "version": "2.0.0",
    "contact": {
      "name": "Anlyon Support",
      "url": "https://anlyon.com/support",
      "email": "support@anlyon.com"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://anlyon.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://api.anlyon.com",
      "description": "Production server"
    },
    {
      "url": "http://localhost:4000",
      "description": "Local development server"
    }
  ],
  "tags": [
    {
      "name": "Messages",
      "description": "Publish and manage scheduled messages"
    },
    {
      "name": "Schedules",
      "description": "Create and manage recurring schedules (cron jobs)"
    },
    {
      "name": "URL Groups",
      "description": "Manage URL groups for broadcasting messages"
    },
    {
      "name": "Analytics",
      "description": "View analytics and usage statistics"
    },
    {
      "name": "Billing",
      "description": "Manage billing, plans, and usage"
    },
    {
      "name": "Notifications",
      "description": "Manage notifications and preferences"
    },
    {
      "name": "Sessions",
      "description": "Persist agent conversation threads and prompt-ready history"
    },
    {
      "name": "Context",
      "description": "Assemble memory and session state into prompt-ready context"
    },
    {
      "name": "Actions",
      "description": "Define and invoke secret-backed hosted tools"
    },
    {
      "name": "Impact Limits",
      "description": "Shared business-impact limits (money, resource mutations) that governed effects reserve before dispatch. Separate from Budgets, which cap Anlyon usage."
    },
    {
      "name": "Approval Policies",
      "description": "Configure the environment-scoped rules that decide whether a request needs approval, is auto-approved, or is auto-denied. Operator credentials only."
    },
    {
      "name": "Authentication",
      "description": "Inspect the credential making the request"
    },
    {
      "name": "Sign-offs",
      "description": "Changes an agent asked for that loosen a guardrail, waiting for a workspace admin. An agent may never loosen its own guardrails."
    },
    {
      "name": "Approvals",
      "description": "Create and decide human-in-the-loop safety gates"
    },
    {
      "name": "Audit",
      "description": "Audit streaming and the evidence export (Enterprise). Stored audit records in one versioned shape, streamed to a signed webhook, an S3-compatible bucket, Datadog or Splunk, with per-workspace retention."
    },
    {
      "name": "Budgets",
      "description": "Control per-API-key usage and estimated spend"
    },
    {
      "name": "Secrets",
      "description": "Store write-only credentials used by hosted actions"
    },
    {
      "name": "Secret stores",
      "description": "Enterprise. Your own AWS Secrets Manager or HashiCorp Vault, per environment. A secret of kind `external` points into one and is read at dispatch, never stored by Anlyon. Managing stores needs `secret-stores:read` or `secret-stores:write`, privileged scopes no key receives by default; secrets that point into a store use `secrets:*` like any other."
    },
    {
      "name": "Connected accounts",
      "description": "Connect an account at a provider through its own consent page. The result is a secret whose access token is fetched at dispatch and never returned."
    },
    {
      "name": "End users",
      "description": "Act for your users. Each of your end users connects their own accounts; every action your agent takes in them is limited, approved and receipted per end user. Your server names the end user in the `Anlyon-End-User` header; the model never does."
    },
    {
      "name": "Functions",
      "description": "Your own code, run with no network and no secrets. Its one way to change anything is to call your actions, and each call is limited, approved and receipted like any action call."
    },
    {
      "name": "Files",
      "description": "Upload, inspect, download, and delete workspace files"
    },
    {
      "name": "Cache",
      "description": "Store and semantically retrieve reusable model results"
    },
    {
      "name": "Events",
      "description": "Publish typed events and deliver them to filtered webhook subscriptions"
    },
    {
      "name": "DLQ",
      "description": "Inspect, retry, and permanently remove exhausted message deliveries"
    },
    {
      "name": "Flow Control",
      "description": "Coordinate per-key rate limits, parallelism, pausing, and delivery waitlists"
    },
    {
      "name": "Integrations",
      "description": "Connect Slack and Discord notification destinations without exposing stored credentials"
    },
    {
      "name": "Logs",
      "description": "Query, inspect, and export redacted message and schedule execution history"
    },
    {
      "name": "Queues",
      "description": "Configure isolated message streams with parallelism, pause/resume controls, and live lag"
    },
    {
      "name": "Workflows",
      "description": "Define callback-driven workflows, trigger runs, inspect steps, and resume event waits"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "SessionAuth": []
    }
  ],
  "paths": {
    "/api/v2/memory": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Remember (store a memory)",
        "description": "Store a piece of knowledge. Content is embedded synchronously and available to recall() immediately.",
        "operationId": "remember",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "content"
                ],
                "properties": {
                  "content": {
                    "type": "string",
                    "minLength": 1,
                    "description": "UTF-8 content up to 32 KB."
                  },
                  "collection": {
                    "type": "string",
                    "description": "Collection name or col_ id"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "ttlSeconds": {
                    "type": "integer",
                    "description": "Optional TTL in seconds"
                  },
                  "runId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Optional run in this API-key environment for the memory-write span."
                  },
                  "parentSpanId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Optional parent span within runId."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/MemoryRecord"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "List memories",
        "operationId": "listMemories",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "in": "query",
            "name": "collection",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "offset",
            "deprecated": true,
            "x-anlyon-replacement": "page",
            "x-anlyon-removal-date": "2027-07-13",
            "description": "Legacy offset; cannot be combined with page.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/batch": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Batch remember (v1.1)",
        "description": "Bulk-embed and store many memories in one call. Up to 100 items.",
        "operationId": "rememberMany",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items"
                ],
                "properties": {
                  "items": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "required": [
                        "content"
                      ],
                      "properties": {
                        "content": {
                          "type": "string"
                        },
                        "collection": {
                          "type": "string"
                        },
                        "metadata": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "ttlSeconds": {
                          "type": "integer"
                        },
                        "idempotencyKey": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "runId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Optional run in this API-key environment for the memory-write span."
                  },
                  "parentSpanId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Optional parent span within runId."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/MemoryBatch"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/recall": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Recall (semantic/hybrid search)",
        "operationId": "recall",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "query"
                ],
                "properties": {
                  "query": {
                    "type": "string"
                  },
                  "collection": {
                    "type": "string"
                  },
                  "topK": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "hybrid",
                      "semantic",
                      "keyword"
                    ]
                  },
                  "filter": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "minScore": {
                    "type": "number"
                  },
                  "rerank": {
                    "type": "boolean",
                    "description": "Enable LLM-as-judge rerank (v1.1)"
                  },
                  "runId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Optional run in this API-key environment for the memory-recall span."
                  },
                  "parentSpanId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "Optional parent span within runId."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryRecall"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/forget": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Batch forget by ids or documentId",
        "operationId": "forgetBatch",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "documentId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryDeletedCount"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/ingest": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Ingest a document (async)",
        "description": "Queue a document for async chunking + embedding. Supports inline text, URL, or fileKey (v1.1).",
        "operationId": "ingest",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "document"
                ],
                "properties": {
                  "collection": {
                    "type": "string"
                  },
                  "document": {
                    "type": "object",
                    "required": [
                      "name"
                    ],
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "content": {
                        "type": "string",
                        "description": "Inline text (up to 10 MB)"
                      },
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "URL to fetch (SSRF-guarded, v1.1)"
                      },
                      "fileKey": {
                        "type": "string",
                        "description": "R2 file key from POST /memory/files (v1.1)"
                      },
                      "metadata": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "runId": {
                    "type": "string",
                    "description": "Optional run ID; the worker emits a correlated terminal memory-write span."
                  },
                  "parentSpanId": {
                    "type": "string",
                    "description": "Optional parent span within runId."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/MemoryIngestAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/files": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Upload a file to R2 (v1.1)",
        "description": "Upload a file and get a fileKey for use with ingest().",
        "operationId": "uploadFile",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "File no larger than 10 MB."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/MemoryFileUploaded"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/summarize": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Summarize memories (sync, v1.1)",
        "description": "LLM-driven summary of a set of memories into one new memory.",
        "operationId": "summarize",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "collection": {
                    "type": "string"
                  },
                  "query": {
                    "type": "string"
                  },
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 50
                  },
                  "maxTokens": {
                    "type": "integer"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "ttlSeconds": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/MemorySummary"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/consolidate": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Consolidate memories (async, v1.1)",
        "description": "LLM-driven merge/dedupe of a collection's memories.",
        "operationId": "consolidate",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "collection"
                ],
                "properties": {
                  "collection": {
                    "type": "string"
                  },
                  "query": {
                    "type": "string"
                  },
                  "filter": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "strategy": {
                    "type": "string",
                    "enum": [
                      "merge",
                      "dedupe"
                    ]
                  },
                  "maxMemories": {
                    "type": "integer"
                  },
                  "runId": {
                    "type": "string",
                    "description": "Optional run ID; the worker emits a correlated terminal memory-write span."
                  },
                  "parentSpanId": {
                    "type": "string",
                    "description": "Optional parent span within runId."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/MemoryJobQueued"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/jobs/{jobId}": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "Get job status",
        "description": "Status + progress for ingest, consolidate, or reembed jobs.",
        "operationId": "getJob",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "in": "path",
            "name": "jobId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryJobStatus"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/{memoryId}": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "Get a single memory",
        "operationId": "getMemory",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "in": "path",
            "name": "memoryId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryRecord"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "Memory"
        ],
        "summary": "Forget a single memory",
        "operationId": "forget",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "in": "path",
            "name": "memoryId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryDeleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/collections": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Create a collection",
        "operationId": "createCollection",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "defaultTtlSeconds": {
                    "type": "integer",
                    "description": "Default TTL for memories (v1.1)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/MemoryCollection"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "List collections",
        "operationId": "listCollections",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryCollectionList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/collections/{collectionId}": {
      "get": {
        "tags": [
          "Memory"
        ],
        "summary": "Get a collection",
        "operationId": "getCollection",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "in": "path",
            "name": "collectionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryCollection"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "patch": {
        "tags": [
          "Memory"
        ],
        "summary": "Update a collection",
        "operationId": "updateCollection",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "in": "path",
            "name": "collectionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "defaultTtlSeconds": {
                    "type": "integer",
                    "nullable": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MemoryCollection"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "Memory"
        ],
        "summary": "Delete a collection (cascades to memories)",
        "operationId": "deleteCollection",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "in": "path",
            "name": "collectionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/memory/collections/{collectionId}/migrate": {
      "post": {
        "tags": [
          "Memory"
        ],
        "summary": "Migrate collection to new embedding model (v1.1)",
        "description": "Creates a new frozen collection and queues a re-embed job.",
        "operationId": "migrateCollection",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "memory:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "in": "path",
            "name": "collectionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "targetModel"
                ],
                "properties": {
                  "targetModel": {
                    "type": "string"
                  },
                  "targetDimensions": {
                    "type": "integer",
                    "enum": [
                      1536
                    ],
                    "default": 1536
                  },
                  "runId": {
                    "type": "string",
                    "description": "Optional run ID; the worker emits a correlated terminal memory-write span."
                  },
                  "parentSpanId": {
                    "type": "string",
                    "description": "Optional parent span within runId."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/MemoryMigrationAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/messages/publish": {
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Publish a single message",
        "description": "Publish immediately or schedule delivery with a Unix timestamp. The legacy scheduledFor field remains accepted for compatibility.",
        "operationId": "publishMessage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "messages:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "Anlyon-Queue",
            "in": "header",
            "required": false,
            "description": "Queue name; overrides the request-body queue.",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishMessageRequest"
              },
              "examples": {
                "immediate": {
                  "summary": "Immediate delivery",
                  "value": {
                    "url": "https://example.com/webhook",
                    "method": "POST",
                    "body": {
                      "event": "user_created",
                      "userId": 123
                    }
                  }
                },
                "scheduled": {
                  "summary": "Scheduled delivery using Unix seconds",
                  "value": {
                    "url": "https://example.com/webhook",
                    "method": "POST",
                    "body": {
                      "reminder": "meeting_soon"
                    },
                    "executeAt": 1798761599
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message published successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "messageId": {
                          "type": "string",
                          "example": "msg_1234567890abcdef"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "pending",
                            "scheduled"
                          ],
                          "example": "scheduled"
                        },
                        "scheduledFor": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true,
                          "example": "2024-12-31T23:59:59Z"
                        },
                        "queue": {
                          "type": "string",
                          "nullable": true,
                          "example": "critical"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/messages/batch": {
      "post": {
        "tags": [
          "Messages"
        ],
        "summary": "Publish multiple messages in batch",
        "description": "Publish up to 100 messages in a single request.\n\nAgainst a key budget a batch costs one unit per message, and admission\nis all-or-nothing: a batch that does not fit the remaining cap is\nrefused whole with `429 BUDGET_EXCEEDED` and none of its messages are\nenqueued. Split the batch or raise the cap.\n",
        "operationId": "publishBatch",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "messages:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "Anlyon-Queue",
            "in": "header",
            "required": false,
            "description": "Default queue for messages without a body-level queue.",
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]+$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "$ref": "#/components/schemas/PublishMessageRequest"
                    }
                  }
                }
              },
              "example": {
                "messages": [
                  {
                    "url": "https://example.com/webhook",
                    "method": "POST",
                    "body": {
                      "event": "user_created",
                      "userId": 123
                    }
                  },
                  {
                    "url": "https://example.com/webhook",
                    "method": "POST",
                    "body": {
                      "event": "user_created",
                      "userId": 124
                    },
                    "executeAt": 1798761599
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch published successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "published": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "messageId",
                              "index"
                            ],
                            "properties": {
                              "messageId": {
                                "type": "string",
                                "pattern": "^msg_",
                                "example": "msg_1234567890abcdef"
                              },
                              "index": {
                                "type": "integer",
                                "minimum": 0,
                                "example": 0
                              }
                            }
                          }
                        },
                        "failed": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "index",
                              "error"
                            ],
                            "properties": {
                              "index": {
                                "type": "integer",
                                "minimum": 0,
                                "example": 1
                              },
                              "error": {
                                "type": "string",
                                "example": "Destination URL is not allowed"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/messages": {
      "get": {
        "tags": [
          "Messages"
        ],
        "summary": "List messages",
        "description": "Retrieve a paginated list of messages with optional filters",
        "operationId": "listMessages",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "messages:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter by message status",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "scheduled",
                "processing",
                "delivered",
                "failed",
                "cancelled"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "description": "Filter messages created after this date",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "description": "Filter messages created before this date",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "url",
            "in": "query",
            "description": "Filter by destination URL",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeEventDeliveries",
            "in": "query",
            "description": "Include deliveries generated by the Events fan-out system. They are hidden by default.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Messages retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PublicMessage"
                      }
                    },
                    "pagination": {
                      "$ref": "#/components/schemas/OffsetPagination"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/messages/{messageId}": {
      "get": {
        "tags": [
          "Messages"
        ],
        "summary": "Get message status",
        "description": "Retrieve detailed information about a specific message",
        "operationId": "getMessage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "messages:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "description": "The message ID",
            "schema": {
              "type": "string",
              "example": "msg_1234567890abcdef"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Message details retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicMessage"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Messages"
        ],
        "summary": "Cancel a scheduled message",
        "description": "Cancel a message that is scheduled for future delivery. Only messages with status \"scheduled\" can be cancelled.",
        "operationId": "cancelMessage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "messages:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "description": "The message ID",
            "schema": {
              "type": "string",
              "example": "msg_1234567890abcdef"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Message cancelled successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Message cancelled successfully"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Cannot cancel message (invalid state)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/schedules": {
      "post": {
        "tags": [
          "Schedules"
        ],
        "summary": "Create a new schedule",
        "description": "Create a recurring schedule (cron job) to send messages at specified intervals. A `{{secret:NAME}}` reference in a header requires `secrets:read`.",
        "operationId": "createSchedule",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateScheduleRequest"
              },
              "example": {
                "name": "Daily Report",
                "cronExpression": "0 9 * * *",
                "timezone": "America/New_York",
                "url": "https://example.com/webhook",
                "method": "POST",
                "body": {
                  "type": "daily_report"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schedule created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicSchedule"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/FeatureNotAvailable"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitOrQuotaExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Schedules"
        ],
        "summary": "List all schedules",
        "description": "Retrieve all schedules for your workspace",
        "operationId": "listSchedules",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "description": "Schedules retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PublicSchedule"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/schedules/{scheduleId}": {
      "get": {
        "tags": [
          "Schedules"
        ],
        "summary": "Get a specific schedule",
        "description": "Retrieve detailed information about a specific schedule",
        "operationId": "getSchedule",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "description": "The schedule ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicSchedule"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Schedules"
        ],
        "summary": "Update a schedule",
        "description": "Update an existing schedule's configuration. A `{{secret:NAME}}` reference in a header requires `secrets:read`, as on create.",
        "operationId": "updateSchedule",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "description": "The schedule ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateScheduleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Schedule updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicSchedule"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Schedules"
        ],
        "summary": "Delete a schedule",
        "description": "Permanently delete a schedule",
        "operationId": "deleteSchedule",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "description": "The schedule ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Schedule deleted"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/schedules/{scheduleId}/pause": {
      "post": {
        "tags": [
          "Schedules"
        ],
        "summary": "Pause a schedule",
        "description": "Temporarily pause a schedule without deleting it",
        "operationId": "pauseSchedule",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "description": "The schedule ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule paused successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Schedule paused"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/schedules/{scheduleId}/resume": {
      "post": {
        "tags": [
          "Schedules"
        ],
        "summary": "Resume a paused schedule",
        "description": "Resume a previously paused schedule",
        "operationId": "resumeSchedule",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "scheduleId",
            "in": "path",
            "required": true,
            "description": "The schedule ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule resumed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Schedule resumed"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/url-groups": {
      "post": {
        "tags": [
          "URL Groups"
        ],
        "summary": "Create a URL group",
        "description": "Create a group of URLs for broadcasting messages. The group belongs to the\ncalling key's environment and is only visible to keys bound to it.\n",
        "operationId": "createUrlGroup",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUrlGroupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "URL group created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicUrlGroupWithEndpoints"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/FeatureNotAvailable"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitOrQuotaExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "URL Groups"
        ],
        "summary": "List URL groups",
        "description": "Retrieve the URL groups in the calling key's environment",
        "operationId": "listUrlGroups",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "description": "URL groups retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PublicUrlGroupWithEndpoints"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/url-groups/{groupId}": {
      "get": {
        "tags": [
          "URL Groups"
        ],
        "summary": "Get a URL group",
        "description": "Retrieve a specific URL group with all its endpoints",
        "operationId": "getUrlGroup",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "description": "The URL group ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "URL group retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicUrlGroupWithEndpoints"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "URL Groups"
        ],
        "summary": "Update a URL group",
        "description": "Update the name of a URL group",
        "operationId": "updateUrlGroup",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "description": "The URL group ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "example": "Production Webhooks"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "URL group updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicUrlGroupWithEndpoints"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "URL Groups"
        ],
        "summary": "Delete a URL group",
        "description": "Permanently delete a URL group",
        "operationId": "deleteUrlGroup",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "description": "The URL group ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "URL group deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "URL group deleted"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/url-groups/{groupId}/endpoints": {
      "post": {
        "tags": [
          "URL Groups"
        ],
        "summary": "Add an endpoint to a URL group",
        "description": "Add a new endpoint URL to an existing URL group",
        "operationId": "addEndpoint",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "description": "The URL group ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddEndpointRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Endpoint added successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicUrlGroupEndpoint"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/url-groups/{groupId}/endpoints/{endpointId}": {
      "delete": {
        "tags": [
          "URL Groups"
        ],
        "summary": "Remove an endpoint from a URL group",
        "description": "Remove a specific endpoint from a URL group",
        "operationId": "removeEndpoint",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "description": "The URL group ID",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endpointId",
            "in": "path",
            "required": true,
            "description": "The endpoint ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Endpoint removed successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Endpoint removed"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/url-groups/{groupId}/publish": {
      "post": {
        "tags": [
          "URL Groups"
        ],
        "summary": "Publish to all endpoints in a group",
        "description": "Send a message to all endpoints in a URL group. Fan-out is a publish, so\nit obeys the same rules as `POST /messages/publish`: the messages are\ncreated in the calling key's environment, a halted environment refuses\nan agent key's publish with `409`, and a `{{secret:NAME}}` reference in\na delivery header requires `secrets:read`.\n\nAgainst a key budget the publish costs one unit per endpoint in the\ngroup, and admission is all-or-nothing: a fan-out that does not fit the\nremaining cap is refused whole with `429 BUDGET_EXCEEDED` and no\nendpoint receives a message.\n",
        "operationId": "publishToGroup",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "url-groups:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "name": "groupId",
            "in": "path",
            "required": true,
            "description": "The URL group ID",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishGroupMessageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Messages published to group successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/PublicUrlGroupPublishResult"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/analytics/overview": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get cross-product analytics overview",
        "description": "Returns reliability, usage, and attention signals across the workspace's products.",
        "operationId": "getAnalyticsOverview",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "granularity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ],
              "default": "day"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "description": "Optional environment scope for session-authenticated requests.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AnalyticsOverview"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/agents": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get agent analytics",
        "description": "Returns agent run volume, outcomes, duration, tokens, costs, and top agents.",
        "operationId": "getAgentAnalytics",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "granularity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ],
              "default": "day"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AgentAnalytics"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/trust-control": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get trust and control analytics",
        "description": "Returns action invocation and approval decision outcomes, latency, and top entities.",
        "operationId": "getTrustControlAnalytics",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "granularity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ],
              "default": "day"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TrustControlAnalytics"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/delivery": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get delivery analytics",
        "description": "Returns message, schedule, workflow, destination, bandwidth, and error analytics.",
        "operationId": "getDeliveryAnalytics",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "granularity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ],
              "default": "day"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/DeliveryAnalytics"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/messages": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get message analytics",
        "description": "Retrieve aggregated message statistics for a date range",
        "operationId": "getMessageAnalytics",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageAnalytics"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/time-series": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get message time series data",
        "description": "Retrieve message counts over time with configurable granularity",
        "operationId": "getMessageTimeSeries",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "granularity",
            "in": "query",
            "description": "Time granularity for data points",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "day",
                "week",
                "month"
              ],
              "default": "day"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageTimeSeries"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/top-urls": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get top destination URLs",
        "description": "Retrieve the most frequently used destination URLs",
        "operationId": "getTopUrls",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Number of URLs to return",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TopUrls"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/usage/current": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get current usage",
        "description": "Retrieve current day usage statistics",
        "operationId": "getCurrentUsage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/CurrentAnalyticsUsage"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/usage/history": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get usage history",
        "description": "Retrieve historical usage data",
        "operationId": "getUsageHistory",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AnalyticsUsageHistory"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/schedules": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get schedule statistics",
        "description": "Counts schedules in the calling credential's environment. A key may only name its own environment; a session caller that names none reads the whole workspace.",
        "operationId": "getScheduleAnalytics",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "name": "environmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ScheduleAnalytics"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/schedule-executions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "List recent schedule execution summaries",
        "description": "Lists the most recent execution summary for schedules in the calling credential's environment. A key may only name its own environment; a session caller that names none reads the whole workspace.",
        "operationId": "listRecentScheduleExecutions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/RecentScheduleExecutionList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/errors": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get failed-message error distribution",
        "description": "Return the most frequent error messages in a date range, plus chart-ready data.",
        "operationId": "getErrorDistribution",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ErrorDistribution"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/analytics/onboarding": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get workspace onboarding progress",
        "description": "Report setup milestones and the first-message activation state, plus chart-ready progress data.",
        "operationId": "getOnboardingStatus",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "analytics:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/OnboardingStatus"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/budget": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Read workspace overage alert target",
        "description": "Alert-only configuration, not a spending hard stop.",
        "operationId": "getWorkspaceBillingBudget",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "responses": {
          "200": {
            "description": "Workspace alert configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkspaceBillingBudgetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/plan": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get current plan details",
        "description": "Retrieve details about your current pricing plan",
        "operationId": "getCurrentPlan",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingPlanDetails"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/usage/current": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get current billing period usage",
        "description": "Retrieve usage statistics for the current billing period",
        "operationId": "getCurrentBillingUsage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingCurrentUsage"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/plans": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List available plans",
        "description": "Retrieve all available pricing plans",
        "operationId": "listPlans",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingPlanList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/quota": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get current quota utilization",
        "operationId": "getBillingQuota",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingQuota"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/usage/history": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get daily billing usage history",
        "operationId": "getBillingUsageHistory",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "description": "Number of calendar days to include, capped at 90.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingUsageHistory"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/cost-estimate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Estimate current-month cost",
        "operationId": "getBillingCostEstimate",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingCostEstimate"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/billing/invoices": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "List workspace invoices",
        "description": "Invoices recorded by Anlyon before paid plans moved to Polar. Polar is the seller and keeps the invoices since then in its customer portal (`POST /api/v2/billing/portal`); `portalAvailable` says whether this workspace has one.",
        "operationId": "listBillingInvoices",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "billing:read"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BillingInvoiceList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "List notifications",
        "description": "Retrieve notifications for your workspace. For a caller with a user (a console session or an OAuth connection), types that user muted in their own preferences are left out of the list and the unread count.",
        "operationId": "listNotifications",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "unreadOnly",
            "in": "query",
            "description": "Filter to only unread notifications",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Number of notifications to return",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Notifications retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "notifications": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Notification"
                          }
                        },
                        "unreadCount": {
                          "type": "integer",
                          "example": 3
                        },
                        "total": {
                          "type": "integer",
                          "example": 10
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications/{id}/read": {
      "patch": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark notification as read",
        "description": "Mark a specific notification as read. Read state is shared by the whole workspace. Needs `notifications:write`.",
        "operationId": "markNotificationAsRead",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The notification ID",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Notification marked as read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "Notification marked as read"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications/read-all": {
      "patch": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark all notifications as read",
        "description": "Mark all notifications for your workspace as read. Read state is shared by the whole workspace. Needs `notifications:write`.",
        "operationId": "markAllNotificationsAsRead",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "description": "All notifications marked as read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "All notifications marked as read"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications/preferences": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Get notification preferences",
        "description": "Retrieve notification preferences for your workspace",
        "operationId": "getNotificationPreferences",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "responses": {
          "200": {
            "description": "Preferences retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NotificationPreferences"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Notifications"
        ],
        "summary": "Update notification preferences",
        "description": "Update notification settings for your workspace, including which channels and alert types are on and who receives alerts by email and webhook. Needs `notifications:manage`, which no key receives by default. A console session or an OAuth connection also needs the admin role.",
        "operationId": "updateNotificationPreferences",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:manage"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/RequestId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateNotificationPreferencesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preferences updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "$ref": "#/components/schemas/NotificationPreferences"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/queues": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Queues"
        ],
        "summary": "Create a queue",
        "description": "Queue names beginning with `__` are reserved for hidden platform queues.",
        "operationId": "createQueue",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "queues:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateQueueRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Queue"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Queues"
        ],
        "summary": "List queues",
        "description": "Hidden platform queues and soft-deleted queues are excluded. `lag` is read live from pending and scheduled Redis structures.",
        "operationId": "listQueues",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "queues:read"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "paused"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/QueueList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/queues/{queueId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/QueueId"
        }
      ],
      "get": {
        "tags": [
          "Queues"
        ],
        "summary": "Get a queue",
        "operationId": "getQueue",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "queues:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Queue"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Queues"
        ],
        "summary": "Update a queue",
        "operationId": "updateQueue",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "queues:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateQueueRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Queue"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Queues"
        ],
        "summary": "Soft-delete a queue",
        "description": "Remove a user queue from active routing and future reads. Hidden system queues cannot be deleted.",
        "operationId": "deleteQueue",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "queues:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/queues/{queueId}/pause": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/QueueId"
        }
      ],
      "post": {
        "tags": [
          "Queues"
        ],
        "summary": "Pause a queue",
        "operationId": "pauseQueue",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "queues:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/queues/{queueId}/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/QueueId"
        }
      ],
      "post": {
        "tags": [
          "Queues"
        ],
        "summary": "Resume a queue",
        "operationId": "resumeQueue",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "queues:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications/unread-count": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Get unread notification count",
        "operationId": "getUnreadNotificationCount",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/UnreadNotificationCount"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Notification UUID.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "delete": {
        "tags": [
          "Notifications"
        ],
        "summary": "Dismiss a notification",
        "description": "Delete a notification for the whole workspace. Needs `notifications:write`.",
        "operationId": "deleteNotification",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications/preferences/me": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "Get your own notification preferences",
        "description": "Returns the calling member's own preferences in this workspace. Needs a user, so a console session or an OAuth connection. An API key has no user and answers `403` `USER_IDENTITY_REQUIRED`.",
        "operationId": "getMyNotificationPreferences",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MyNotificationPreferences"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Notifications"
        ],
        "summary": "Update your own notification preferences",
        "description": "Replaces the notification types the calling member muted. A muted type is left out of that member's own list and unread count. It is still raised, still delivered to email, Slack, Discord and the webhook, and still shown to every other member. Needs `notifications:write` and a user. No role is needed. An API key has no user and answers `403` `USER_IDENTITY_REQUIRED`.",
        "operationId": "updateMyNotificationPreferences",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMyNotificationPreferencesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MyNotificationPreferences"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/notifications/preferences/test-webhook": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Send a test notification webhook",
        "description": "Send a synthetic signed notification through the SSRF-protected outbound client. The optional secret is never stored or returned. Needs `notifications:manage`, which no key receives by default. A console session or an OAuth connection also needs the admin role.",
        "operationId": "testNotificationWebhook",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "notifications:manage"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestNotificationWebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/logs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "Query unified execution logs",
        "description": "Returns message and schedule logs in one redacted, page-paginated timeline within the calling credential’s environment. Logs without a surviving environment-owned parent are omitted.",
        "operationId": "listExecutionLogs",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "logs:read"
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "message",
                "schedule",
                "all"
              ],
              "default": "all"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated status names.",
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "httpStatus",
            "in": "query",
            "description": "Comma-separated three-digit HTTP statuses.",
            "schema": {
              "type": "string",
              "pattern": "^\\\\d{3}(,\\\\s*\\\\d{3})*$"
            }
          },
          {
            "name": "minDuration",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "maxDuration",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "url",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "messageId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "scheduleId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "errorCode",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 1000
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "timestamp",
                "duration",
                "status",
                "httpStatus"
              ],
              "default": "timestamp"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/UnifiedLogList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/logs/stats": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "Get detailed execution-log statistics",
        "description": "Aggregates only logs whose parent belongs to the calling credential’s environment.",
        "operationId": "getExecutionLogStats",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "logs:read"
        ],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "message",
                "schedule",
                "all"
              ],
              "default": "all"
            }
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ExecutionLogStats"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/logs/export": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "Export up to 10,000 execution logs",
        "description": "Exports only logs whose parent belongs to the calling credential’s environment.",
        "operationId": "exportExecutionLogs",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "logs:read"
        ],
        "x-anlyon-response-envelope": "raw-export",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json"
              ],
              "default": "csv"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "message",
                "schedule",
                "all"
              ],
              "default": "all"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 500
            }
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "name": "httpStatus",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^\\\\d{3}(,\\\\s*\\\\d{3})*$"
            }
          },
          {
            "name": "minDuration",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "maxDuration",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "url",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "messageId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "scheduleId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ExecutionLogExport"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/messages/{messageId}/logs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "messageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^msg_"
          }
        }
      ],
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "List execution logs for a message",
        "description": "Returns the retained attempt history in ascending timestamp order with sensitive headers redacted.",
        "operationId": "listMessageExecutionLogs",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "messages:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageExecutionLogList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/schedules/{scheduleId}/logs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "scheduleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^sch_"
          }
        }
      ],
      "get": {
        "tags": [
          "Logs"
        ],
        "summary": "List execution logs for a schedule",
        "operationId": "listScheduleExecutionLogs",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "schedules:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ScheduleExecutionLogList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "List workspace integrations",
        "operationId": "listIntegrations",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/IntegrationList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/discord": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Integrations"
        ],
        "summary": "Create a Discord webhook integration",
        "description": "Validate and encrypt a Discord webhook URL; the URL is never returned.",
        "operationId": "createDiscordIntegration",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDiscordIntegrationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/DiscordIntegrationCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/discord/{id}/test": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/IntegrationId"
        }
      ],
      "post": {
        "tags": [
          "Integrations"
        ],
        "summary": "Send a Discord test notification",
        "operationId": "testDiscordIntegration",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/slack/{id}/channels": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/IntegrationId"
        }
      ],
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "List Slack channels",
        "operationId": "listSlackIntegrationChannels",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SlackChannelList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/slack/{id}/channel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/IntegrationId"
        }
      ],
      "patch": {
        "tags": [
          "Integrations"
        ],
        "summary": "Select a Slack channel",
        "description": "Attempt to join the channel, then persist it even when auto-join reports an error.",
        "operationId": "updateSlackIntegrationChannel",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSlackChannelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/SlackChannelUpdated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/slack/{id}/test": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/IntegrationId"
        }
      ],
      "post": {
        "tags": [
          "Integrations"
        ],
        "summary": "Send a Slack test notification",
        "operationId": "testSlackIntegration",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/IntegrationId"
        }
      ],
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Delete an integration",
        "operationId": "deleteIntegration",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/{id}/toggle": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/IntegrationId"
        }
      ],
      "patch": {
        "tags": [
          "Integrations"
        ],
        "summary": "Enable or disable an integration",
        "operationId": "toggleIntegration",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToggleIntegrationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/IntegrationToggled"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/integrations/{id}/events": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/IntegrationId"
        }
      ],
      "patch": {
        "tags": [
          "Integrations"
        ],
        "summary": "Update integration event types",
        "operationId": "updateIntegrationEventTypes",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "integrations:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateIntegrationEventTypesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/IntegrationEventTypesUpdated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Create a flow-control key",
        "description": "Creates a key in the calling credential’s environment. Names and runtime limits are independent between environments.",
        "operationId": "createFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFlowControlKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/FlowControlKeyCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Flow Control"
        ],
        "summary": "List flow-control keys",
        "description": "Lists only keys in the calling credential’s environment.",
        "operationId": "listFlowControlKeys",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:read"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/FlowControlKeyList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control/{flowControlKeyId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/FlowControlKeyId"
        }
      ],
      "get": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Get a flow-control key",
        "description": "Returns 404 for a key outside the calling credential’s environment.",
        "operationId": "getFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/FlowControlKey"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Update a flow-control key",
        "description": "Set a numeric control or clear it with null. Clear rate limit and window together.",
        "operationId": "updateFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateFlowControlKeyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/FlowControlKey"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Delete a flow-control key",
        "description": "Re-enqueue all waitlisted messages to their original streams before deleting configuration and live counters.",
        "operationId": "deleteFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control/{flowControlKeyId}/pause": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/FlowControlKeyId"
        }
      ],
      "post": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Pause waitlist release",
        "operationId": "pauseFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control/{flowControlKeyId}/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/FlowControlKeyId"
        }
      ],
      "post": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Resume waitlist release",
        "operationId": "resumeFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control/{flowControlKeyId}/pin": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/FlowControlKeyId"
        }
      ],
      "post": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Pin flow-control configuration",
        "description": "Prevent per-message publishing options from overriding this key's stored controls.",
        "operationId": "pinFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control/{flowControlKeyId}/unpin": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/FlowControlKeyId"
        }
      ],
      "post": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Unpin flow-control configuration",
        "operationId": "unpinFlowControlKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control/{flowControlKeyId}/reset-rate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/FlowControlKeyId"
        }
      ],
      "post": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Reset the current rate counter",
        "description": "Remove current and previous Redis window counters. This is a no-op when the key has no rate window.",
        "operationId": "resetFlowControlRate",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/flow-control/{flowControlKeyId}/status": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/FlowControlKeyId"
        }
      ],
      "get": {
        "tags": [
          "Flow Control"
        ],
        "summary": "Get live flow-control status",
        "description": "Read active, waitlist, and current-window rate counters from Redis with persisted pause/pin state.",
        "operationId": "getFlowControlStatus",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "flow-control:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/FlowControlStatus"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/dlq": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "DLQ"
        ],
        "summary": "List failed messages",
        "description": "Lists failed messages in the calling credential's environment.",
        "operationId": "listDLQMessages",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "dlq:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/DLQMessageList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "DLQ"
        ],
        "summary": "Permanently clear the DLQ",
        "description": "Permanently delete failed messages in the calling credential's environment, up to 1000 per call; `remaining` reports what is left. Another environment's failures are untouched. This cannot be undone.",
        "operationId": "clearDLQ",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "dlq:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/DLQClearResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/dlq/stats": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "DLQ"
        ],
        "summary": "Get DLQ statistics",
        "description": "Counts failed messages in the calling credential's environment.",
        "operationId": "getDLQStats",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "dlq:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/DLQStats"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/dlq/retry-all": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "DLQ"
        ],
        "summary": "Retry failed messages",
        "description": "Queue each failed message in the calling credential's environment independently, up to 1000 per call, and report how many succeeded; individual retry failures do not abort the batch and `remaining` reports what is left.",
        "operationId": "retryAllDLQMessages",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "dlq:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/DLQRetryAllResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/dlq/{messageId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "messageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^msg_"
          }
        }
      ],
      "get": {
        "tags": [
          "DLQ"
        ],
        "summary": "Get a failed message",
        "operationId": "getDLQMessage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "dlq:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/DLQMessage"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "DLQ"
        ],
        "summary": "Permanently delete a failed message",
        "operationId": "deleteDLQMessage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "dlq:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/dlq/{messageId}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "messageId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^msg_"
          }
        }
      ],
      "post": {
        "tags": [
          "DLQ"
        ],
        "summary": "Retry a failed message",
        "description": "Reset attempts and failure state, then place the message back on the delivery stream it was published to, with the environment, flow-control key and queue it was published under. Only the calling credential's environment is visible.",
        "operationId": "retryDLQMessage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "dlq:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/DLQRetryResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/events/topics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "List event topics",
        "description": "List workspace topics, including the reserved `anlyon` platform topic after it has been created.",
        "operationId": "listEventTopics",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventTopicList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Create an event topic",
        "description": "Create a named workspace topic. The name `anlyon` is reserved for platform lifecycle events.",
        "operationId": "createEventTopic",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEventTopicRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/EventTopicCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/events/topics/{ref}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "ref",
          "in": "path",
          "required": true,
          "description": "Public topic ID (`top_...`) or topic name.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "Get an event topic",
        "operationId": "getEventTopic",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventTopic"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Events"
        ],
        "summary": "Update an event topic",
        "description": "Rename a topic or change its description. The reserved platform topic can only be re-described.",
        "operationId": "updateEventTopic",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEventTopicRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventTopic"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Events"
        ],
        "summary": "Delete an event topic",
        "description": "Delete a topic and its subscriptions and events. The reserved platform topic cannot be deleted.",
        "operationId": "deleteEventTopic",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/events/topics/{ref}/subscriptions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "ref",
          "in": "path",
          "required": true,
          "description": "Public topic ID (`top_...`) or topic name. Using `anlyon` on create lazily creates the reserved topic.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "List topic subscriptions",
        "operationId": "listEventSubscriptions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventSubscriptionList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Create a webhook subscription",
        "description": "Subscribe a URL to matching event types. With `generateSecret`, the plaintext signing secret is returned exactly once. A `{{secret:NAME}}` reference in a header requires `secrets:read`; credential headers are redacted when the subscription is returned.",
        "operationId": "createEventSubscription",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEventSubscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/EventSubscriptionCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/events/subscriptions/{subscriptionId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "subscriptionId",
          "in": "path",
          "required": true,
          "description": "Public event subscription identifier.",
          "schema": {
            "type": "string",
            "pattern": "^sub_"
          }
        }
      ],
      "patch": {
        "tags": [
          "Events"
        ],
        "summary": "Update a webhook subscription",
        "description": "A `{{secret:NAME}}` reference in a header requires `secrets:read`, as on create. Credential headers are redacted in the response.",
        "operationId": "updateEventSubscription",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEventSubscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventSubscription"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Events"
        ],
        "summary": "Delete a webhook subscription",
        "operationId": "deleteEventSubscription",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/events/subscriptions/{subscriptionId}/rotate-secret": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "subscriptionId",
          "in": "path",
          "required": true,
          "description": "Public event subscription identifier.",
          "schema": {
            "type": "string",
            "pattern": "^sub_"
          }
        }
      ],
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Rotate a subscription signing secret",
        "description": "Replace the signing secret and return the new plaintext value exactly once.",
        "operationId": "rotateEventSubscriptionSecret",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventSubscriptionSecret"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/events": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Publish an event",
        "description": "Accept an event for asynchronous fan-out. Publishing to the reserved `anlyon` topic is blocked.\n`idempotencyKey` provides durable topic-scoped deduplication; `Idempotency-Key` protects an HTTP retry.\n",
        "operationId": "publishEvent",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishEventRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventPublishDeduplicated"
          },
          "202": {
            "$ref": "#/components/responses/EventPublishAccepted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "List published events",
        "operationId": "listEvents",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:read"
        ],
        "parameters": [
          {
            "name": "topic",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": "Public topic ID or name."
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/events/{eventId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "eventId",
          "in": "path",
          "required": true,
          "description": "Public event identifier.",
          "schema": {
            "type": "string",
            "pattern": "^evt_"
          }
        }
      ],
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "Get an event and its deliveries",
        "operationId": "getEvent",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventWithDeliveries"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/secrets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Secrets"
        ],
        "summary": "List secret metadata",
        "description": "List names and metadata only. Secret values are never returned.",
        "operationId": "listSecrets",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SecretList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/secrets/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "Uppercase secret name referenced by action templates.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Z0-9_]+$"
          }
        }
      ],
      "get": {
        "tags": [
          "Secrets"
        ],
        "summary": "Get secret metadata",
        "description": "Return metadata only; the stored value is never returned.",
        "operationId": "getSecret",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Secret"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "put": {
        "tags": [
          "Secrets"
        ],
        "summary": "Create or rotate a secret",
        "description": "Store a new encrypted value or replace the existing value. The response contains metadata only. A connected account cannot be given a stored value: the request answers 409 `SECRET_KIND_MISMATCH`; delete the secret first.\nEnterprise: send `external` instead of `value` to create or repoint a secret whose value is read from one of the environment's secret stores at dispatch. The value is read once and dropped, to record whether the store can produce it. If it cannot, the secret is still saved, with `health.status: unreachable` and the reason, and the response carries a `warning` (`EXTERNAL_SECRET_UNREADABLE`); calls that use it fail before anything is sent until the store can produce it. A reference that is wrong in itself (no such store, a path outside the store's `allowedPaths`, a malformed Vault path) answers 400. An edition without secret stores answers 501 `SECRET_STORES_UNAVAILABLE`. A reference chooses which of the store's secrets Anlyon reads with the store's credential and where its value may be sent, so `external` also needs `secret-stores:write` on a key, and the workspace admin role for a person; without it the request answers 403.",
        "operationId": "putSecret",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutSecretRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/PutSecret"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "The secret exists with another kind (SECRET_KIND_MISMATCH).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "501": {
            "description": "This edition does not include secret stores (SECRET_STORES_UNAVAILABLE).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Secrets"
        ],
        "summary": "Delete a secret",
        "description": "Delete a secret. For a connected account the access is revoked first; if revoking fails the secret is kept and the request answers 502 `CONNECTION_REVOKE_FAILED`, so access is never reported gone while it is still live.",
        "operationId": "deleteSecret",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/secrets/{name}/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The external secret's name.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Z0-9_]+$"
          }
        }
      ],
      "post": {
        "tags": [
          "Secret stores"
        ],
        "summary": "Check an external secret",
        "description": "Enterprise. Read an external secret once from its store, drop the value, and record whether it could be read on the secret's `health`. The value is never returned. A store that refuses or has nothing there is an answer, not an error: `200` with `health.status: unreachable` and a `reason`. Anlyon also runs this check on its own, once a day per external secret, and records the answer whenever a dispatch reads one. A secret that is not external answers 400.",
        "operationId": "checkExternalSecret",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Secret"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "501": {
            "description": "This edition does not include secret stores (SECRET_STORES_UNAVAILABLE).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/secret-stores": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Secret stores"
        ],
        "summary": "List secret stores",
        "description": "Enterprise. The environment's secret stores, with their settings and health. A store's credential is never returned. An edition without secret stores has no such endpoint (404).",
        "operationId": "listSecretStores",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secret-stores:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SecretStoreList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Secret stores"
        ],
        "summary": "Add a secret store",
        "description": "Enterprise. Add an AWS Secrets Manager or HashiCorp Vault (KV version 2) store to the environment. Anlyon authenticates to it first, without reading any secret (STS GetCallerIdentity, or Vault `auth/token/lookup-self`); if that fails nothing is saved and the request answers `SECRET_STORE_CHECK_FAILED`. The credential is encrypted and never returned. Requests to the store go through the same address checks as action dispatch, so a store on a private address is refused, unless a workspace admin allowed it in the secret store settings on a self-hosted edition.",
        "operationId": "createSecretStore",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secret-stores:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSecretStoreRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/SecretStore"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "The store refused the credential (SECRET_STORE_CHECK_FAILED). Nothing was saved.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "502": {
            "description": "The store did not answer (SECRET_STORE_CHECK_FAILED). Nothing was saved.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/secret-stores/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The store's name, unique in its environment.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        }
      ],
      "get": {
        "tags": [
          "Secret stores"
        ],
        "summary": "Get a secret store",
        "description": "Enterprise. One store's settings and health. The credential is never returned.",
        "operationId": "getSecretStore",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secret-stores:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SecretStore"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Secret stores"
        ],
        "summary": "Change a secret store",
        "description": "Enterprise. Change a store's settings, credential, allowed paths, cache TTL or description. A store's name and type do not change. `config` fields replace the ones they name. New settings or a new credential are checked against the store before they apply, and values cached under the old ones are dropped. Changing where the credential is sent (a Vault store's `address`, `namespace`, `mount`, `auth` or `authMount`; an AWS store's `region`, `auth`, `roleArn` or `externalId`) needs `credential` in the same request, or answers 400: a stored credential is never sent anywhere it was not given for. In a protected environment, changing settings, the credential or the allowed paths needs `confirmProtected=true`.",
        "operationId": "updateSecretStore",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secret-stores:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "name": "confirmProtected",
            "in": "query",
            "required": false,
            "description": "Required to change a store in a protected environment.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSecretStoreRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/SecretStore"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "The store refused the new settings or credential (SECRET_STORE_CHECK_FAILED). Nothing was changed.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "502": {
            "description": "The store did not answer (SECRET_STORE_CHECK_FAILED). Nothing was changed.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Secret stores"
        ],
        "summary": "Delete a secret store",
        "description": "Enterprise. Delete a store. Refused with 409 `SECRET_STORE_IN_USE`, naming the secrets, while any secret points at it. In a protected environment it needs `confirmProtected=true`.",
        "operationId": "deleteSecretStore",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secret-stores:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "name": "confirmProtected",
            "in": "query",
            "required": false,
            "description": "Required to delete a store in a protected environment.",
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "Secrets still point at the store (SECRET_STORE_IN_USE).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/secret-stores/{name}/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The store's name, unique in its environment.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 63,
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
          }
        }
      ],
      "post": {
        "tags": [
          "Secret stores"
        ],
        "summary": "Check a secret store",
        "description": "Enterprise. Authenticate to the store without reading any secret, and record the answer on the store's `health`. A store that refuses or does not answer is an answer, not an error: `200` with `health.status: unreachable` and a `reason`.",
        "operationId": "checkSecretStore",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secret-stores:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/SecretStore"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/connections": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Connected accounts"
        ],
        "summary": "List connected accounts",
        "description": "The connected accounts in the calling environment: every secret connected for an integration, whether by signing in at the provider (`kind: connection`) or with an API key (`kind: static` with `integrationId` set). Metadata only. Answers 404 while connected accounts are not available on this deployment.",
        "operationId": "listConnections",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SecretList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/connections/integrations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Connected accounts"
        ],
        "summary": "List connectable integrations",
        "description": "The integrations an account can be connected for, with how each is connected (`auth`), the API hosts its credential may be sent to, and for a sign-in integration the scopes Anlyon requests at the provider's consent page.",
        "operationId": "listConnectionIntegrations",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:read"
        ],
        "responses": {
          "200": {
            "description": "Integrations returned.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionIntegrationListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        }
      ],
      "delete": {
        "tags": [
          "End users"
        ],
        "summary": "Erase an end user",
        "description": "Forget the end user: every connected account is revoked at the provider where it supports that and deleted, their per-end-user limit counters are cleared, and their pending approvals are cancelled (the parked calls are never sent). Invocations, receipts, approvals and audit records are kept for the audit trail with the id replaced by a keyed one-way hash, returned as `erasedAs`. Recorded as `end_user.erased`.",
        "operationId": "eraseEndUser",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The end user was erased.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndUserErasureResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}/connections": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        }
      ],
      "get": {
        "tags": [
          "End users"
        ],
        "summary": "List an end user's connections",
        "description": "The end user's connected accounts: integration, how it was connected, status, granted scopes and timestamps. Never a token. A grant still waiting for confirmation is not listed.",
        "operationId": "listEndUserConnections",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The end user's connections.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndUserConnectionListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}/connect-links": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        }
      ],
      "post": {
        "tags": [
          "End users"
        ],
        "summary": "Create a connect link",
        "description": "A hosted link that connects one integration for the end user. Send them to `url`: a page that names your workspace, then the provider's consent for an OAuth integration, or a form where they paste their own key for an API-key integration (checked with the provider and stored encrypted; you never see it). Afterwards the browser goes to `redirectUrl` with `anlyon_status` (`pending_confirmation`, `connected`, `declined` or `error`), `integration`, and, while the grant waits for confirmation, `anlyon_flow`. The end-user id is never in that URL. Confirm the flow from your server with `POST /api/v2/end-users/{endUserId}/connections/confirm`.\n\nA redirect is required: `redirectUrl` must fall under one of the environment's allowed redirect URLs (exact origin and path prefix), or the environment's default redirect URL is used; with neither, the answer is `400 REDIRECT_URL_REQUIRED`. Only an environment with confirmation off may leave it out: the end user then sees Anlyon's own page, and the account is theirs at once. The link works once, for 10 minutes; a key link takes up to 5 refused keys before it is used up. At most 10 links per minute per end user, and 300 per environment.\n\nAn OAuth integration Anlyon does not offer through its own app, or whose app this deployment does not have, is connected through the environment's own app: add it with `PUT /api/v2/environments/{environmentId}/oauth-apps/{integration}`. Until then the answer is `400 OWN_OAUTH_APP_REQUIRED`.",
        "operationId": "createEndUserConnectLink",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEndUserConnectLinkRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The link.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndUserConnectLinkResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "501": {
            "description": "Connected accounts are not set up on this deployment (CONNECTIONS_UNAVAILABLE). A missing OAuth app is a 400 OWN_OAUTH_APP_REQUIRED instead.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}/connections/confirm": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        }
      ],
      "post": {
        "tags": [
          "End users"
        ],
        "summary": "Confirm a connection",
        "description": "Your server confirms that the consent which came back to your redirect with `anlyon_flow` belongs to the end user signed in to your app. This is the defence against cross-app account takeover: anyone holding a link can finish its consent, so the grant stays unusable until you confirm it for the end user the link was created for. Confirmed for anyone else, it is refused with `403 END_USER_MISMATCH`, revoked at the provider and deleted. Single use; a flow nobody confirms is deleted after 10 minutes. A replayed, expired or unknown flow answers `404 CONNECT_FLOW_NOT_FOUND`. The confirmed account replaces the end user's previous one for the integration.",
        "operationId": "confirmEndUserConnection",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmEndUserConnectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The account is active.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConfirmEndUserConnectionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Missing scope, or the flow was created for another end user (END_USER_MISMATCH). Nothing was stored.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}/connections/{integration}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        },
        {
          "$ref": "#/components/parameters/IntegrationPath"
        }
      ],
      "put": {
        "tags": [
          "End users"
        ],
        "summary": "Store an end user's API key",
        "description": "For an integration whose `auth.kind` is `api_key`: store the end user's own key. It is checked first with the provider's own read-only check when the catalogue has one; a key the provider refuses is not stored (`CONNECTION_KEY_REJECTED`). It is encrypted like a connected account's token, replaces the end user's previous key for the integration, and is never returned. No confirmation step: your server supplies the key. At most 10 keys per minute per end user.",
        "operationId": "setEndUserConnection",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetEndUserConnectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored connection",
            "without the key.": null,
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndUserConnectionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "The provider did not accept the key (CONNECTION_KEY_REJECTED). Nothing was stored.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "502": {
            "description": "The key could not be checked with the provider (CONNECTION_KEY_CHECK_FAILED). Nothing was stored.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "End users"
        ],
        "summary": "Disconnect an end user's account",
        "description": "Revokes the account at the provider when the provider supports it, then deletes it. 404 when the end user has no account for the integration.",
        "operationId": "deleteEndUserConnection",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}/approvals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        }
      ],
      "get": {
        "tags": [
          "End users"
        ],
        "summary": "List an end user's approvals",
        "description": "The approvals this end user decides: those of calls made for them under a policy with `decidedBy: end_user`. Never another end user's, and never the team's. Newest first.",
        "operationId": "listEndUserApprovals",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:approvals"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "denied",
                "expired"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApprovalList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}/approvals/{approvalId}/decide": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        },
        {
          "name": "approvalId",
          "in": "path",
          "required": true,
          "description": "Public approval id (apr_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "End users"
        ],
        "summary": "Decide an end user's approval",
        "description": "The end user's answer, relayed by your app. Approving runs the parked call; the request-bound preview, expiry and receipts work as for any approval. An approval of another end user, or one the team decides, answers 404.",
        "operationId": "decideEndUserApproval",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:approvals"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecideEndUserApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The decision",
            "and the executed invocation when approving ran one.": null,
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndUserApprovalDecisionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/end-users/{endUserId}/sessions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/EndUserIdPath"
        }
      ],
      "post": {
        "tags": [
          "End users"
        ],
        "summary": "Create an end-user session",
        "description": "A short-lived token your server hands to your own front end, so prebuilt components (`@anlyonhq/react`) can act for this one end user in the browser. The token lists, connects and disconnects the end user's accounts and, when this key also has `end-users:approvals`, lists and decides their own approvals, through `/api/v2/end-user-session`. Nothing else: no action call, secret or other end user, and it cannot confirm a connection. Lasts 15 minutes by default, 60 seconds to 1 hour on request, and never past this key's own expiry. Revoking this key ends its sessions. API keys only: a console session or an OAuth token answers `403 END_USER_SESSION_API_KEY_REQUIRED`. Recorded as `end_user.session_created`.",
        "operationId": "createEndUserSession",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "end-users:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEndUserSessionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The session token. Hand it to the signed-in end user's browser only.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndUserSessionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/functions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Functions"
        ],
        "summary": "Create a function",
        "description": "A named function in the key's environment. It runs nothing until a version is published.",
        "operationId": "createFunction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFunctionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The function.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Functions"
        ],
        "summary": "List functions",
        "description": "Every function in the key's environment, with its current version. Never the source.",
        "operationId": "listFunctions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:read"
        ],
        "responses": {
          "200": {
            "description": "The functions.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/functions/{name}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The function's name or id (fn_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "delete": {
        "tags": [
          "Functions"
        ],
        "summary": "Delete a function",
        "description": "Archive a function. It leaves the list and refuses new runs, and its name is free to use again. Its versions and runs are retained as the record of what it did.",
        "operationId": "deleteFunction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/functions/{name}/versions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The function's name or id (fn_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Functions"
        ],
        "summary": "List a function's versions",
        "description": "Every published version, newest first (at most 100), without sources. `current` marks the version runs use. Read one with its source with `GET /functions/{name}/versions/{version}`.",
        "operationId": "listFunctionVersions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:read"
        ],
        "responses": {
          "200": {
            "description": "The versions.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionVersionListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Functions"
        ],
        "summary": "Publish a function version",
        "description": "Publish source code as the function's new current version. A version never changes: publishing again appends one. `allowedActions` lists the actions the function may call, by name; each must exist in this environment and be enabled (`400 ALLOWED_ACTION_UNAVAILABLE`). A call to any other action is refused in the runner and again by the API. Budgets default to 50 action calls, 1,000 ms of CPU, 100 binding calls and 30,000 ms per run. `straightThrough` lets a run skip the plan for writes to some of those actions, up to a number of writes per run; without it a straight-through run reads and does not write.\n\nJavaScript: an ES module whose default export is `async function run(input, anlyon)`. Python: a module that defines `run(input, anlyon)`. `anlyon.invoke(action, input)` and `anlyon.read(action, input)` call actions; `anlyon.log(message)` adds a line to the run. The function has no network, no environment variables and no secrets. A call answers `{ ok: true, result }` or `{ ok: false, error }`. `result` is the action invocation: the provider's reply as text in `result.body`, and parsed in `result.json` (null when it is not JSON).",
        "operationId": "publishFunctionVersion",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishFunctionVersionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The function and its new current version.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionVersionPublishedResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/functions/{name}/versions/{version}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The function's name or id (fn_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "description": "The version number, or `current`.",
          "schema": {
            "type": "string",
            "pattern": "^(current|[1-9][0-9]{0,8})$",
            "example": "current"
          }
        }
      ],
      "get": {
        "tags": [
          "Functions"
        ],
        "summary": "Get a function version",
        "description": "One version with the source it runs. `current` is the version runs use. `404 FUNCTION_VERSION_NOT_FOUND` when there is no such version, or nothing is published yet.",
        "operationId": "getFunctionVersion",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:read"
        ],
        "responses": {
          "200": {
            "description": "The version and its source.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionVersionDetailResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/functions/{name}/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "name",
          "in": "path",
          "required": true,
          "description": "The function's name or id (fn_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Functions"
        ],
        "summary": "List a function's runs",
        "description": "The function's runs, newest first, without their calls (read one with `GET /function-runs/{id}`). `endUserId` narrows to one end user's runs; a key created with `endUserRequired` sees only its own end user's.",
        "operationId": "listFunctionRuns",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "endUserId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The runs.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionRunListResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Functions"
        ],
        "summary": "Run a function",
        "description": "Run the function once and answer when it ends. Every call it makes acts for the end user in `Anlyon-End-User`: impact limits, approvals, the end user's connections, the halt switch and receipts apply as for any action call. Needs `actions:invoke` as well as `functions:run`.\n\n`mode` says what happens to writes (a call to an action that is not a GET):\n\n- `plan` (the default): reads run for real; each write is recorded and answered with `{ planned: true }`, and nothing is sent. The run ends `planned` when it made no writes. With writes it ends `awaiting_approval`, and `plan` lists them with one approval of kind `function_plan` bound to the plan's digest. The team decides it, or the end user when every write's approval policy says `decidedBy: end_user`.\n- `apply`, with `planRunId`: carries out an approved plan, once, with the plan's version, input and end user. Each write must equal the plan's next write: same action, same input, same order. A matching write is sent as its own action invocation with its own receipt. A write that does not match ends the run `diverged` before it is sent, and nothing further is sent; plan again for a new approval. Reads may differ.\n- `straight_through`: every call is sent as it is made. A write must be to an action in the version's `straightThrough` policy, within its `maxWrites`; any other write is refused with `PLAN_REQUIRED` and nothing is sent.\n\nA run can also end `failed`, or `budget_exceeded` with `budget` naming the budget that ran out. `409` when an apply's plan is not approved (`PLAN_NOT_APPROVED`), has no writes (`PLAN_HAS_NO_WRITES`), was already applied (`PLAN_ALREADY_APPLIED`), was made with other input (`PLAN_INPUT_MISMATCH`) or was approved more than 24 hours ago (`PLAN_EXPIRED`).\n\n`503 FUNCTION_RUNNER_UNAVAILABLE` when the function runner is not configured or cannot be reached. Nothing ran, and the run is not counted.\n\nRuns are held to the workspace's plan (`GET /api/v2/billing/plans`, `planCatalogue[].functionRuns`). `402 PAYMENT_REQUIRED` when the workspace has no plan. `429 FUNCTION_RUN_CONCURRENCY_LIMIT` when the plan's runs at once are all going (retry when one ends), `429 FUNCTION_RUN_RATE_LIMITED` past the plan's run starts a minute, and `429 QUOTA_EXCEEDED` past the plan's runs a month (they come back on the 1st, UTC). In each case nothing ran and nothing was counted. A run's own action calls count as governed actions, as any action call does.",
        "operationId": "runFunction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:run",
          "actions:invoke"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunFunctionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The finished run.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionRunResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitOrQuotaExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/function-runs/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "The run's id (frn_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Functions"
        ],
        "summary": "Get a function run",
        "description": "A run with its input and output, every call it made in order (refused ones included) and its receipt. A plan run carries its plan and the plan's approval; an apply run names the plan run it carried out. A key created with `endUserRequired` reads its own end user's runs and no others.",
        "operationId": "getFunctionRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "functions:read"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "responses": {
          "200": {
            "description": "The run.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FunctionRunResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/connections/keys": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Connected accounts"
        ],
        "summary": "Connect an integration with an API key",
        "description": "Connect an integration whose `auth.kind` is `api_key`. Anlyon first checks the key with the provider, with one read-only request to the integration's own host. A key the provider accepts is stored as a secret of kind `static` with `integrationId` set, bound to the integration's hosts and to request headers; those come from the integration and cannot be set here. A key the provider refuses is not stored (`CONNECTION_KEY_REJECTED`), and neither is one that could not be checked (`CONNECTION_KEY_CHECK_FAILED`). The key is never returned by any endpoint. The secret name must not exist yet in this environment. Counts toward the same limit of 10 per minute per workspace as connect sessions.",
        "operationId": "connectWithApiKey",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectWithApiKeyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/Secret"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "description": "The provider did not accept the key (CONNECTION_KEY_REJECTED). Nothing was stored.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "502": {
            "description": "The key could not be checked with the provider (CONNECTION_KEY_CHECK_FAILED). Nothing was stored.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/connections/sessions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Connected accounts"
        ],
        "summary": "Start a connect session",
        "description": "Start the consent flow for one integration whose `auth.kind` is `oauth`. An `api_key` integration is refused here; send its key to `POST /api/v2/connections/keys`. Open `connectUrl` in a browser, or hand the `consent` values to the console's consent window. The session expires after 15 minutes. At most 10 sessions may be started per minute per workspace. The secret name must not exist yet in this environment. Where neither the environment's own OAuth app nor Anlyon's app on this deployment can sign in to the integration (the list marks it `ownOAuthAppRequired`), the answer is `400 OWN_OAUTH_APP_REQUIRED`: add the environment's own app with `PUT /api/v2/environments/{environmentId}/oauth-apps/{integration}`.",
        "operationId": "createConnectSession",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConnectSessionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Session started.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectSessionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "501": {
            "description": "Connected accounts are not configured on this deployment (CONNECTIONS_UNAVAILABLE).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The connected-account service did not answer (CONNECTION_PROVIDER_ERROR). Nothing was created.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/connections/sessions/{sessionId}/complete": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "sessionId",
          "in": "path",
          "required": true,
          "description": "The session id returned when the session was started.",
          "schema": {
            "type": "string",
            "pattern": "^csn_[A-Za-z0-9]{8,64}$"
          }
        }
      ],
      "post": {
        "tags": [
          "Connected accounts"
        ],
        "summary": "Complete a connect session",
        "description": "The connected account once consent has finished, as a secret of kind `connection` bound to the integration's hosts. Open `connectUrl` in a browser, then poll this with an empty body: it answers `status: pending` until the provider has redirected the person back to Anlyon, then `completed`. A consent the person declined, or one that could not be recorded, answers 400 with the reason. Idempotent: completing twice returns the same secret.",
        "operationId": "completeConnectSession",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteConnectSessionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The session's state",
            "and the secret once completed.": null,
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectSessionCompletionResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "410": {
            "description": "The session expired, or belongs to another workspace or environment (CONNECTION_SESSION_EXPIRED). Start a new one.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "501": {
            "description": "Connected accounts are not configured on this deployment (CONNECTIONS_UNAVAILABLE).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The connected-account service did not answer (CONNECTION_PROVIDER_ERROR).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/connections/{secretName}/check": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "secretName",
          "in": "path",
          "required": true,
          "description": "The connected account, by its secret name.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Z0-9_]+$"
          }
        }
      ],
      "post": {
        "tags": [
          "Connected accounts"
        ],
        "summary": "Check a connected account",
        "description": "Ask the provider whether a connected account still works, and record the answer on the secret's `health`. The same call for both kinds: an API key is sent once, in the integration's own header, to its one read-only check URL; a signed-in account is asked for from the connector service with a forced refresh, so the provider itself says whether the grant is still honoured. The credential is never returned. An account that does not work is an answer, not an error: the call answers `200` with `health.status: needs_reauth` and a `reason`, and the next dispatch that uses it fails before anything is sent. Only a check that could not be made is an error (`CONNECTION_KEY_CHECK_FAILED` or `CONNECTION_PROVIDER_ERROR`), and it leaves `health` unchanged. A secret you stored directly cannot be checked (`400`). Counts toward the same limit of 10 per minute per workspace as connect sessions. Anlyon also runs this check on its own, once a day per account and after a dispatch the provider answers 401.",
        "operationId": "checkConnection",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Secret"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "501": {
            "description": "The account is signed in and connected accounts are not configured on this deployment (CONNECTIONS_UNAVAILABLE).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The check could not be made (CONNECTION_KEY_CHECK_FAILED for a key, CONNECTION_PROVIDER_ERROR for a signed-in account). The status is unchanged.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/connections/{secretName}/reconnect": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "secretName",
          "in": "path",
          "required": true,
          "description": "The connected account, by its secret name.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Z0-9_]+$"
          }
        }
      ],
      "post": {
        "tags": [
          "Connected accounts"
        ],
        "summary": "Reconnect a connected account",
        "description": "Make a connected account work again, the way it was connected. The secret keeps its name, its hosts and its placement, so nothing that references `{{secret:NAME}}` changes. For an API-key integration, send the new key as `apiKey`: Anlyon checks it with the provider the way it checked the first one, replaces the stored value, and answers `status: completed` with the secret. A key the provider refuses changes nothing (`CONNECTION_KEY_REJECTED`). For a sign-in integration, send an empty body: Anlyon starts a consent session for the account's existing connection and answers `status: pending` with the `session`. Open its `connectUrl` or hand its `consent` values to the console's window, then call `POST /api/v2/connections/sessions/{sessionId}/complete` as for a first connect; completing marks the account working again. Sending a key for a sign-in account, or none for a key account, is `400`. Counts toward the same limit of 10 per minute per workspace as connect sessions. A sign-in account that neither the environment's own OAuth app nor Anlyon's app on this deployment can sign in to answers `400 OWN_OAUTH_APP_REQUIRED`.",
        "operationId": "reconnectConnection",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "secrets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconnectConnectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new key was accepted and stored (`completed`)",
            "or a consent session was started (`pending`).": null,
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionReconnectResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "The provider did not accept the new key (CONNECTION_KEY_REJECTED). Nothing changed.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "501": {
            "description": "The account is signed in and connected accounts are not configured on this deployment (CONNECTIONS_UNAVAILABLE).",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The new key could not be checked (CONNECTION_KEY_CHECK_FAILED), or the connected-account service did not answer (CONNECTION_PROVIDER_ERROR). Nothing changed.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/files": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Upload a file directly",
        "description": "Upload a plan-limited file through the API using multipart form data.",
        "operationId": "uploadFileDirect",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "files:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "metadata": {
                    "type": "string",
                    "description": "JSON object encoded as a form field."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/FileCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "List files",
        "operationId": "listFiles",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "files:read"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          },
          {
            "name": "includePending",
            "in": "query",
            "description": "Include unconfirmed presigned uploads.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/FileList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/files/presign": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Create a presigned file upload",
        "operationId": "presignFileUpload",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "files:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PresignFileUploadRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/FileUploadPresigned"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/files/{fileId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "fileId",
          "in": "path",
          "required": true,
          "description": "Public file identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Get file metadata",
        "operationId": "getFile",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "files:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/File"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "Files"
        ],
        "summary": "Delete a file",
        "operationId": "deleteFile",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "files:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/files/{fileId}/confirm": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "fileId",
          "in": "path",
          "required": true,
          "description": "Public file identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Files"
        ],
        "summary": "Confirm a presigned upload",
        "description": "Verify the uploaded object and enforce the authoritative stored size. Repeated confirmation of a ready file is safe.",
        "operationId": "confirmFileUpload",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "files:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/File"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "413": {
            "$ref": "#/components/responses/PayloadTooLarge"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/files/{fileId}/download": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "fileId",
          "in": "path",
          "required": true,
          "description": "Public file identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Files"
        ],
        "summary": "Download a file",
        "description": "Redirect to a short-lived signed URL, or return the URL as JSON when redirect=false.",
        "operationId": "downloadFile",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "files:read"
        ],
        "parameters": [
          {
            "name": "redirect",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/FileDownloadUrl"
          },
          "302": {
            "description": "Redirect to a temporary signed download URL.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Location": {
                "description": "Temporary signed download URL.",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/cache": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Cache"
        ],
        "summary": "Store a semantic cache entry",
        "description": "Embed and upsert an entry by workspace, namespace, and normalized key.",
        "operationId": "storeCacheEntry",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "cache:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreCacheEntryRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/CacheEntryCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "Cache"
        ],
        "summary": "List semantic cache entries",
        "operationId": "listCacheEntries",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "cache:read"
        ],
        "parameters": [
          {
            "name": "namespace",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/CacheNamespace"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/CacheEntryList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/cache/lookup": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Cache"
        ],
        "summary": "Look up a semantic cache entry",
        "description": "Try an exact key match first, then a top-1 semantic match within the requested threshold.",
        "operationId": "lookupCache",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "cache:read"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LookupCacheRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/CacheLookup"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/cache/flush": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Cache"
        ],
        "summary": "Flush semantic cache entries",
        "operationId": "flushCache",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "cache:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlushCacheRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/CacheFlushed"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/cache/stats": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Cache"
        ],
        "summary": "Get semantic cache statistics",
        "operationId": "getCacheStats",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "cache:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/CacheStats"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/cache/{entryId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "entryId",
          "in": "path",
          "required": true,
          "description": "Public cache-entry identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Cache"
        ],
        "summary": "Get a semantic cache entry",
        "operationId": "getCacheEntry",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "cache:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/CacheEntry"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "Cache"
        ],
        "summary": "Delete a semantic cache entry",
        "operationId": "deleteCacheEntry",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "cache:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/actions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "List actions",
        "description": "List every hosted tool available in the workspace.",
        "operationId": "listActions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ActionList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Create an action",
        "description": "Define a secret-backed, SSRF-protected hosted HTTP tool.",
        "operationId": "createAction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateActionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/ActionCreated"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/import": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Import actions from OpenAPI",
        "description": "Translate supported OpenAPI 3.x operations into hosted actions, reporting every skipped operation and translation warning. A dry run creates nothing. Every operation that is not a `GET` is imported governed, declaring one exact resource mutation, so its invocations are previewed, counted against impact limits and given a receipt. Money is never inferred from the spec. Where the spec has a `GET` that reads back what a write changes, the result carries a `proposedVerify` rule for that action; it is not applied, and you add it with `PATCH /api/v2/actions/{ref}` once you have checked it. Pass `governed: false` to import plain template actions instead. Every imported operation also carries a `suggestion`: a risk class (`read`, `write`, `irreversible` or `destructive`), whether to require approval, and an impact declaration, read deterministically from the method, the path, the operation's words, the request fields and vendor extensions. A suggestion is never applied by itself: name the operation in `operations` to set its approval or impact, for example with the suggestion a dry run returned. `suggestedAllowedHosts` lists the hosts the credential could be limited to, from the spec's servers; set them on the secret to apply them.",
        "operationId": "importActions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportActionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/ActionImport"
          },
          "201": {
            "$ref": "#/components/responses/ActionImport"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/invocations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "List action invocations",
        "operationId": "listActionInvocations",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "description": "Action name or public action ID.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter by status. `unknown` lists calls waiting for an operator to confirm their outcome.",
            "schema": {
              "type": "string",
              "enum": [
                "pending_approval",
                "running",
                "succeeded",
                "failed",
                "unknown",
                "denied",
                "expired"
              ]
            }
          },
          {
            "name": "endUserId",
            "in": "query",
            "description": "Only calls made for this end user. A key created with endUserRequired always sees only its own end user's.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:@-]{1,128}$"
            }
          },
          {
            "name": "actingFor",
            "in": "query",
            "description": "`workspace`: only calls with your workspace's own accounts (no end user). `end_users`: only calls made for an end user. Absent: both. It only narrows: a key created with endUserRequired still sees only its own end user's.",
            "schema": {
              "type": "string",
              "enum": [
                "workspace",
                "end_users"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/InvocationList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/invocations/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public invocation identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "Get an action invocation",
        "operationId": "getActionInvocation",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Invocation"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/{ref}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "ref",
          "in": "path",
          "required": true,
          "description": "Action name or public action identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "Get an action",
        "operationId": "getAction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Action"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Actions"
        ],
        "summary": "Update an action",
        "operationId": "updateAction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Action"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Actions"
        ],
        "summary": "Delete an action",
        "description": "Archive an action. It stops resolving and its name becomes free to reuse, while its immutable versions and its invocation history are retained -- an agent version may pin one of those versions, and destroying them would dismantle rollback and erase the audit trail in the same call. Archiving an action that currently requires approval additionally needs `actions:govern`, because removing a gate is removing a gate whichever verb gets you there.",
        "operationId": "deleteAction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/{ref}/invoke": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "ref",
          "in": "path",
          "required": true,
          "description": "Action name or public action identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Invoke an action",
        "description": "Execute an enabled action inline, or park it behind a human approval when the action is gated.\nWhich definition runs depends on how the call is attributed. Passing a `runId` whose run names an agent runs the action version that agent's published version pins, if it pins one -- this is the path a rollback restores. Without a `runId`, or when the agent pins nothing for this action, the action's current definition runs. The response reports the version that actually executed as `actionVersionId`.\nWith an `Idempotency-Key`, the key is also recorded on the invocation and kept for its whole life, including after it fails. A retry with the same key after the 24-hour replay window (or after the replay store loses the key) is answered from the invocation's current state with `X-Idempotent-Replay: current-state` and `200`, or `202` while it still waits for approval. It is never executed, admitted or charged again. The same key from a different credential or with a different body returns `409 idempotency_key_reuse`. A request refused before the invocation is recorded (for example invalid input) leaves the key unused. To run the action again deliberately, use a new key.\nA workspace with no plan answers 402 `PAYMENT_REQUIRED` here, before anything is recorded, as does an approval that would resume a parked call. Past the plan's monthly action allowance plus a 10% buffer (and any action packs) the answer is 429 `QUOTA_EXCEEDED`.",
        "operationId": "invokeAction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:invoke"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvokeActionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/ActionInvocation"
          },
          "202": {
            "$ref": "#/components/responses/ActionInvocation"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/EndUserConflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/actions/{ref}/versions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "ref",
          "in": "path",
          "required": true,
          "description": "Action name or public action identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "List one action's immutable versions",
        "description": "Every definition this action has had, oldest first. Editing an action appends a version; nothing updates one. An agent version pins a version id in its `config.actions`, which is what makes rolling an agent back restore the tool definitions it was published with rather than whatever those tools have since been edited to.",
        "operationId": "listActionVersions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ActionVersionList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v2/actions/effects": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "List governed effects",
        "description": "Effects are the business operations governed actions perform: one per operation, however many attempts it took. A governed action is one with an adapter or one that carries a declaration. Each effect carries its execution `stage`, its business `outcome` (`pending`, `succeeded`, `failed`, `unknown`), whether a failure may have had partial impact, who established the outcome (`verification`: the provider's evidence, an operator's manual resolution, or nobody yet), and its receipt `grade`. Filter by `unresolved=true` for everything still holding impact-limit capacity, or by `grade`.",
        "operationId": "listActionEffects",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "parameters": [
          {
            "name": "action",
            "in": "query",
            "description": "Filter by action name.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "not_dispatched",
                "pending",
                "succeeded",
                "failed",
                "unknown"
              ]
            }
          },
          {
            "name": "stage",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "awaiting_approval",
                "ready",
                "dispatching",
                "reconciling",
                "settled",
                "rejected"
              ]
            }
          },
          {
            "name": "grade",
            "in": "query",
            "description": "Filter by receipt grade.",
            "schema": {
              "type": "string",
              "enum": [
                "confirmed",
                "acknowledged",
                "unknown",
                "failed",
                "refused",
                "denied",
                "pending"
              ]
            }
          },
          {
            "name": "unresolved",
            "in": "query",
            "description": "Only effects that are pending, unknown, or possibly partial.",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "endUserId",
            "in": "query",
            "description": "Only effects of calls made for this end user. A key created with endUserRequired always sees only its own end user's.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:@-]{1,128}$"
            }
          },
          {
            "name": "actingFor",
            "in": "query",
            "description": "`workspace`: only effects sent with your workspace's own accounts. `end_users`: only effects sent with an end user's account. Absent: both. It only narrows: a key created with endUserRequired still sees only its own end user's.",
            "schema": {
              "type": "string",
              "enum": [
                "workspace",
                "end_users"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EffectList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/effects/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public effect identifier (eff_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "Get an effect with its evidence",
        "description": "The effect with every attempt, the append-only evidence history (source, observation time, provider identifiers, redacted details, actor), its impact reservations, and the preview its approval was bound to. Scoped to the caller's environment: another environment's effect id is not found.",
        "operationId": "getActionEffect",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EffectDetail"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/effects/{id}/reconcile": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public effect identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Reconcile an effect now",
        "description": "Ask the provider, read-only, what happened to a `pending` or `unknown` effect, and record the answer as evidence. Never writes to the provider. For a declared action this repeats the declared read-back. A read-back that finds nothing leaves the effect `unknown`. Available while the environment is halted. `409` when the effect is already final or another worker is reconciling or writing it.",
        "operationId": "reconcileActionEffect",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:invoke"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/EffectDetail"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/effects/{id}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public effect identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Add an investigation note",
        "description": "Append an operator's note to the effect's evidence history. Changes no outcome. Needs `actions:resolve` or a workspace admin.",
        "operationId": "addActionEffectNote",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:resolve"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "note"
                ],
                "properties": {
                  "note": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 2000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/EffectDetail"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/effects/{id}/resolve": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public effect identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Record a manual resolution",
        "description": "Record an operator's reasoned conclusion for a `pending` or `unknown` effect, or settle a failed effect's possible partial impact. The result is labelled `verification: manual` and is never presented as provider verification. Settles impact limits: `succeeded` consumes the declared (or `actualImpact`) quantity; `failed` with no partial impact releases it. A confirmed partial must state `actualImpact`. A confirmed outcome is never rewritten (`409`). The key that requested the effect cannot resolve it.",
        "operationId": "resolveActionEffect",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:resolve"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveEffectRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/EffectDetail"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/effects/{id}/replay": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public effect identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Replay a lost write under the same identity",
        "description": "Repeat the write of an `unknown` effect under the same provider identity, for adapters that declare `sameKeyReplay` backed by a provider idempotency key (`stripe.refund` and `resend.email_send`, each within its 24-hour window). `github.file_update` does not offer replay: GitHub has no idempotency key, and the blob-SHA precondition cannot tell a restored file from an unwritten one. A declared action never offers replay either, because it sends no provider idempotency key. A replay is a write and passes every control a first dispatch passes: the reviewed binding and preview expiry, the approval, the action version that would run now, the halt switch, the requesting credential's authority, current policy and dependencies. Every refusal has one shape: `409` with code `REPLAY_REFUSED` and a message that starts `Replay refused (<reason>):`, where the reason is `replay_unsupported`, `not_unknown`, `replay_window_passed`, `credential_unavailable`, `allowance_released`, `write_in_flight`, or the dispatch control that failed, such as `policy_denies` or `preview_expired`. The production API does not return `error.details`, so read the reason from the message, or from the refusal's evidence entry (`details.reason`) on `GET /api/v2/actions/effects/{id}`, which also gives the effect's current outcome. A refusal is recorded in the effect's evidence, sends nothing and changes nothing else. An admitted replay that fails (never sent, or refused by the provider) describes that attempt, not the original write: the effect stays `unknown` with its allowance held. Only the provider's own record of the operation in a failed state settles it `failed`. It never creates a second effect.",
        "operationId": "replayActionEffect",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:resolve"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/EffectDetail"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/previews/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public preview identifier (prv_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "Get a preview",
        "operationId": "getActionPreview",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Preview"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/previews/{id}/refresh": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public preview identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Refresh a preview's evidence",
        "description": "Re-read the provider for the same input and the same action version this preview reviewed, and return a NEW preview that `supersedes` this one. Its binding differs, so an approval of the old preview never carries over; an effect already bound to the old one still executes only as reviewed. A refresh never moves the review to a newer action version: if the action changed since, invoking with the refreshed preview is refused with PREVIEW_MISMATCH and a new preview is needed.",
        "operationId": "refreshActionPreview",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:invoke"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "ttlSeconds": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 604800
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/Preview"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/{ref}/previews": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "ref",
          "in": "path",
          "required": true,
          "description": "Action name or public action identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Preview a governed invocation",
        "description": "Normalize the input, resolve the exact target, read the provider (never write), and return a typed, execution-bound preview: environment and target, the exact change (field summaries and text diffs), expected impact against current impact limits, material preconditions with the time they were observed, expiry, and the adapter's guarantees and limitations. Pass its id as `previewId` when invoking; any material difference is refused. For a declared action the preview is the normalized request itself, with every secret still a `{{secret:NAME}}` reference. Anlyon does not read an API it has no adapter for before the write, and the preview lists what a declared action does not guarantee.",
        "operationId": "createActionPreview",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:invoke"
        ],
        "x-anlyon-idempotency": "unsupported",
        "parameters": [
          {
            "$ref": "#/components/parameters/EndUserHeader"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePreviewRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/Preview"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/EndUserConflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/impact-limits": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Impact Limits"
        ],
        "summary": "List impact limits",
        "description": "Business-impact limits in the caller's environment, each with its limit, `consumed` in the current period, `reserved` (everything held and unresolved, across periods), `unknownExposure` (the part of `reserved` whose outcome is unknown or possibly partial, never an additional amount), and `available`.",
        "operationId": "listImpactLimits",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "impact-limits:read"
        ],
        "parameters": [
          {
            "name": "includeArchived",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "endUserId",
            "in": "query",
            "description": "For an end-user limit",
            "show this end user's figures.": null,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:@-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ImpactLimitList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Impact Limits"
        ],
        "summary": "Create an impact limit",
        "description": "Cap `money` (one currency, integer minor units), `resource_mutations`, or a workspace-declared unit such as `emails` for the whole environment, optionally narrowed to one action and/or a resource prefix, per `day`, `month` or `total`. Shared by every agent, session and key: none of them is part of a limit's identity. A limit in a declared unit applies to actions that declare an `impact` in that unit. A declared action's resource key is `http:<host><path>`, so `resourcePrefix` can scope a limit to a path prefix. Needs `impact-limits:write`, which no key receives by default. A console session or an OAuth connection also needs the admin role in the limit's environment, where a per-environment grant applies.",
        "operationId": "createImpactLimit",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "impact-limits:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateImpactLimitRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/ImpactLimit"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/impact-limits/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public limit identifier (lim_...).",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Impact Limits"
        ],
        "summary": "Get an impact limit",
        "operationId": "getImpactLimit",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "impact-limits:read"
        ],
        "parameters": [
          {
            "name": "endUserId",
            "in": "query",
            "description": "For an end-user limit",
            "show this end user's figures.": null,
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:@-]{1,128}$"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ImpactLimit"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Impact Limits"
        ],
        "summary": "Update an impact limit",
        "description": "Rename a limit or change its amount. Scope, dimension and period are fixed. Lowering the amount never releases existing exposure; it blocks new reservations until availability recovers. Needs `impact-limits:write`, which no key receives by default. A console session or an OAuth connection also needs the admin role in the limit's environment, where a per-environment grant applies.",
        "operationId": "updateImpactLimit",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "impact-limits:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateImpactLimitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/ImpactLimit"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Impact Limits"
        ],
        "summary": "Archive an impact limit",
        "description": "The limit stops applying to new effects. Its existing reservations still settle and release. Needs `impact-limits:write`, which no key receives by default. A console session or an OAuth connection also needs the admin role in the limit's environment, where a per-environment grant applies.",
        "operationId": "archiveImpactLimit",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "impact-limits:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/ImpactLimit"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/invocations/{id}/resolve": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public invocation identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Actions"
        ],
        "summary": "Resolve an unknown invocation",
        "description": "Record what the destination confirms happened to an invocation whose status is `unknown`. Nothing is sent to the destination. Resolved `succeeded` is billed; resolved `failed` releases the reserved usage and refunds the key's budget reservation. The resolution, with its evidence, operator and time, is kept permanently and returned as `resolution`. Only one resolution can win: an invocation that is no longer `unknown` returns `409`. Needs `actions:resolve` (never granted by default) or a workspace admin in the console. The key that requested the invocation can never resolve it. The Idempotency-Key of the original stays taken; to run the action again, invoke with a new key and `retryOf`. An invocation governed by an effect (`effectId` set) is refused with `409` `EFFECT_RESOLUTION_REQUIRED` and the effect in `details.effectId`: resolve the effect at `POST /api/v2/actions/effects/{id}/resolve`, which settles its business allowance too.",
        "operationId": "resolveActionInvocation",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:resolve"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "outcome",
                  "evidence"
                ],
                "properties": {
                  "outcome": {
                    "type": "string",
                    "enum": [
                      "succeeded",
                      "failed"
                    ]
                  },
                  "evidence": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 2000,
                    "description": "What you checked at the destination."
                  },
                  "externalReference": {
                    "type": "string",
                    "nullable": true,
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "The destination's own reference, such as a charge or ticket id."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Invocation"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/actions/{ref}/invocations": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "ref",
          "in": "path",
          "required": true,
          "description": "Action name or public action identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Actions"
        ],
        "summary": "List one action's invocations",
        "operationId": "listInvocationsForAction",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "actions:read"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Filter by status. `unknown` lists calls waiting for an operator to confirm their outcome.",
            "schema": {
              "type": "string",
              "enum": [
                "pending_approval",
                "running",
                "succeeded",
                "failed",
                "unknown",
                "denied",
                "expired"
              ]
            }
          },
          {
            "name": "actingFor",
            "in": "query",
            "description": "`workspace`: only calls with your workspace's own accounts (no end user). `end_users`: only calls made for an end user. Absent: both. It only narrows: a key created with endUserRequired still sees only its own end user's.",
            "schema": {
              "type": "string",
              "enum": [
                "workspace",
                "end_users"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/InvocationList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approvals": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Approvals"
        ],
        "summary": "Request an approval",
        "operationId": "createApproval",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "approvals:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/ApprovalCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Approvals"
        ],
        "summary": "List approvals",
        "operationId": "listApprovals",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "approvals:read"
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "approved",
                "denied",
                "expired"
              ]
            }
          },
          {
            "name": "decisionOrigin",
            "in": "query",
            "description": "Filter by who decided. `automated` is policy, system or assistant, so an inbox can show people the decisions that need them and keep machine-made ones as an audit trail.",
            "schema": {
              "type": "string",
              "enum": [
                "human",
                "policy",
                "system",
                "unknown",
                "assistant",
                "automated"
              ]
            }
          },
          {
            "name": "endUserId",
            "in": "query",
            "description": "Only approvals of calls made for this end user. A key created with endUserRequired always sees only its own end user's.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:@-]{1,128}$"
            }
          },
          {
            "name": "actingFor",
            "in": "query",
            "description": "`workspace`: only approvals of calls with your workspace's own accounts. `end_users`: only approvals of calls made for an end user. Absent: both.",
            "schema": {
              "type": "string",
              "enum": [
                "workspace",
                "end_users"
              ]
            }
          },
          {
            "name": "decider",
            "in": "query",
            "description": "`team` (the default): the team's inbox, decided with /api/v2/approvals/{id}/approve and /deny. `end_user`: the approvals end users decide in your app, listed read-only here; they are decided through /api/v2/end-users/{endUserId}/approvals/{approvalId}/decide. An API key needs the `end-users:approvals` scope as well for `end_user`, the same scope /api/v2/end-users/{endUserId}/approvals takes; without it the request answers 403.",
            "schema": {
              "type": "string",
              "enum": [
                "team",
                "end_user"
              ],
              "default": "team"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApprovalList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies/evaluate": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Evaluate current policies without executing",
        "description": "Read-only evaluation against the credential's environment. Uses production matcher ordering and fail-closed behavior. Attribution is hypothetical. The result is policy-only, not an authorization or a final invocation decision; action version pins, approval floor, schema validation, budgets, halt state and runtime authority are not evaluated. Amount is derived from payload.amount, custom tags from payload.tags. Action contexts require an existing action name.",
        "operationId": "evaluateApprovalPolicies",
        "security": [
          {
            "BearerAuth": []
          },
          {
            "SessionAuth": []
          }
        ],
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:read"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvaluateApprovalPoliciesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Policy-only evaluation; no dispatch or policy mutation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/PolicyEvaluation"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "List approval policies",
        "description": "Policies in the credential's own environment, in evaluation order. Needs `policies:read`, or a console session. With `?actionName=` only the policies that could govern that action are returned: the ones naming it plus the broad ones that also catch it. A credential is bound to one environment; an `environmentId` query that disagrees with it is refused.",
        "operationId": "listEnvironmentApprovalPolicies",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:read"
        ],
        "parameters": [
          {
            "name": "actionName",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApprovalPolicyList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "post": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Create an approval policy",
        "description": "Needs `policies:write`. Targeting is required: send `matchKind`, and `matchActionName` to target one action. The environment is the credential's, never the request's. This scope is privileged and never in the default set: the agent a policy governs must not be able to rewrite it.",
        "operationId": "createEnvironmentApprovalPolicy",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEnvironmentApprovalPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/ApprovalPolicyCreated"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitOrQuotaExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies/files/plan": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Plan a policy file",
        "description": "Read-only. Parses a policy file (YAML or JSON, at most 256 KiB, no duplicate keys or aliases), checks every policy (targets, CEL conditions against the action's input schema, name clashes, broad denies, the plan's policy allowance) and returns what applying it would create, update and delete. Only policies owned by this file are ever changed; console-made and other files' policies are never taken over. `errors` lists everything that prevents applying. `digest` identifies the reviewed state: pass it to apply, which refuses if anything changed since. The file must declare the credential's environment.",
        "operationId": "planApprovalPolicyFile",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:read"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyFilePlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The plan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/PolicyFilePlan"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies/files/apply": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Apply a policy file",
        "description": "Applies exactly the reviewed plan in one transaction: every change and its history entry commit together or not at all. Refuses with `409 STALE_PLAN` when the file, the environment's policies or the referenced actions changed since the plan, and with `400 POLICY_FILE_INVALID` when the plan has errors. The digest is a staleness check, not an authorization. The credential is recorded as the actor on each version.",
        "operationId": "applyApprovalPolicyFile",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyFileApplyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The applied plan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/PolicyFilePlan"
                        },
                        {
                          "type": "object",
                          "required": [
                            "applied"
                          ],
                          "properties": {
                            "applied": {
                              "type": "boolean",
                              "enum": [
                                true
                              ]
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies/files/test": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Test a policy file against fixture requests",
        "description": "Decides each fixture request against the environment as it would be after applying the file (every enabled policy the file does not own, plus the file's policies), using the production decision function. Writes nothing and dispatches nothing. Policy decision only: an action's own approval floor is not applied.",
        "operationId": "testApprovalPolicyFile",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:read"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PolicyFileTestRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Per-case results.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/PolicyFileTestResult"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies/{policyId}/versions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/PolicyId"
        }
      ],
      "get": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Read immutable policy history",
        "description": "Returns retained snapshots newest first, a page at a time, including the deletion tombstone after a policy is removed. Page with `before` set to `pagination.nextBefore`; the cursor is stable while new versions are added. `pagination.earliestVersion` is the oldest retained version, so a decision citing an older one predates retained history. Older overwritten versions are not reconstructed; baseline entries mark migration-time evidence. Scoped to the credential environment. Tenant or environment erasure removes its retained history.",
        "operationId": "listApprovalPolicyVersions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:read"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Versions per page, newest first. Default 50.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Version cursor: return versions older than this. Use `pagination.nextBefore` from the previous page.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of retained versions, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalPolicyVersionPage"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies/{policyId}/versions/{version}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/PolicyId"
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "schema": {
            "type": "integer",
            "minimum": 1
          }
        }
      ],
      "get": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Read one policy version",
        "description": "One retained version, for example the exact version an approval or invocation decision recorded. Readable after the policy is deleted. Scoped to the credential environment.",
        "operationId": "getApprovalPolicyVersion",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:read"
        ],
        "responses": {
          "200": {
            "description": "The retained version.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "data"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [
                        true
                      ]
                    },
                    "data": {
                      "$ref": "#/components/schemas/ApprovalPolicyVersion"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approval-policies/{policyId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/PolicyId"
        }
      ],
      "get": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Get an approval policy",
        "description": "Needs `policies:read`. A policy in another environment is reported as not found.",
        "operationId": "getEnvironmentApprovalPolicy",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApprovalPolicyResult"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Update an approval policy",
        "description": "Needs `policies:write`. Omitted fields are unchanged; an explicit `null` clears a nullable matcher. Enabling or disabling a policy is a patch of `enabled`. Bumps the version. Decisions already recorded on invocations keep the explanation they were made with.",
        "operationId": "updateEnvironmentApprovalPolicy",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEnvironmentApprovalPolicyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApprovalPolicyResult"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Approval Policies"
        ],
        "summary": "Delete an approval policy",
        "description": "Needs `policies:write`. Recorded invocation decisions keep their explanation.",
        "operationId": "deleteEnvironmentApprovalPolicy",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "policies:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/auth/identity": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Inspect the current credential",
        "description": "Returns only the caller's own credential: its type, API key id (API keys only), workspace and environment, effective scopes and expiry. Needs no scope beyond being authenticated. Use it at startup to check the application holds the scopes it needs and none it should not. Holding a scope is not proof a call will run: policies, budgets, environment halt and quotas still apply at request time. Never cached.",
        "operationId": "getCredentialIdentity",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [],
        "responses": {
          "200": {
            "$ref": "#/components/responses/CredentialIdentity"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approvals/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public approval identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "get": {
        "tags": [
          "Approvals"
        ],
        "summary": "Get or wait for an approval",
        "description": "Return immediately, or wait up to 55 seconds for the approval to leave pending state.",
        "operationId": "getApproval",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "approvals:read"
        ],
        "parameters": [
          {
            "name": "waitSeconds",
            "in": "query",
            "description": "Values are clamped to 0–55 seconds.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 55
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Approval"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approvals/{id}/approve": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public approval identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Approvals"
        ],
        "summary": "Approve a request",
        "description": "Decide a pending request. For an action approval, this executes and returns the parked invocation. A credential cannot decide an approval it requested, whether it is the requesting API key or the requesting OAuth app acting for the same user. A person cannot decide one requested by an app acting for them or by an API key they created, from any surface (403 `SELF_APPROVAL_NOT_ALLOWED`); a second approver or a separate approver key must decide. A person also needs a role that may decide in the approval's environment.",
        "operationId": "approveApproval",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "approvals:decide"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecideApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApprovalDecision"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/approvals/{id}/deny": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "id",
          "in": "path",
          "required": true,
          "description": "Public approval identifier.",
          "schema": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          }
        }
      ],
      "post": {
        "tags": [
          "Approvals"
        ],
        "summary": "Deny a request",
        "description": "Deny a pending request. A credential cannot decide an approval it requested, whether it is the requesting API key or the requesting OAuth app acting for the same user. A person cannot decide one requested by an app acting for them or by an API key they created, from any surface (403 `SELF_APPROVAL_NOT_ALLOWED`); a second approver or a separate approver key must decide. A person also needs a role that may decide in the approval's environment.",
        "operationId": "denyApproval",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "approvals:decide"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DecideApprovalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/ApprovalDecision"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/budgets": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Budgets"
        ],
        "summary": "List API-key budgets",
        "description": "List configured key budgets with current-month usage and estimated spend. An API-key or OAuth caller sees only keys in its own environment; a dashboard session sees the whole workspace.",
        "operationId": "listBudgets",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "budgets:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/BudgetList"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/budgets/{apiKeyId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "apiKeyId",
          "in": "path",
          "required": true,
          "description": "Internal API-key identifier returned by workspace key management APIs. A key outside the caller's environment is not found.",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Budgets"
        ],
        "summary": "Get an API-key budget",
        "operationId": "getBudget",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "budgets:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Budget"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "put": {
        "tags": [
          "Budgets"
        ],
        "summary": "Create or replace an API-key budget",
        "operationId": "putBudget",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "budgets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PutBudgetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Budget"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Budgets"
        ],
        "summary": "Delete an API-key budget",
        "description": "Remove the cap; the API key becomes unbudgeted.",
        "operationId": "deleteBudget",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "budgets:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/stream": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Stream"
        ],
        "summary": "Subscribe to the realtime event stream",
        "description": "An authenticated, resumable Server-Sent Events feed of workspace state changes (runs, spans, approvals, messages, workflows, budgets, notifications, deliveries), scoped to the API key's workspace and environment (only events attributed to that environment). Resume after a disconnect by sending the last id you saw as the `Last-Event-ID` header (or `?cursor=`); events after that id are replayed from a bounded window, so a reconnect has no silent gap.",
        "operationId": "streamEvents",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "events:read"
        ],
        "x-anlyon-response-envelope": "raw-export",
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Resume after this event id (alternative to the Last-Event-ID header)."
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/EventStream"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Runs"
        ],
        "summary": "Start a run",
        "description": "A run is an agent execution  a tree of spans. The environment is taken from the API key.",
        "operationId": "startRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartRunRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/RunStarted"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "List runs",
        "description": "Newest first. Search run ID, name, or application; filter by status, agent, user, and time range.",
        "operationId": "listRuns",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:read"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "description": "Case-insensitive substring search across run ID, name, and application."
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "running",
                "succeeded",
                "failed",
                "cancelled"
              ]
            }
          },
          {
            "name": "agentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Filter to one environment. API keys are already environment-scoped; this is for the session-authed dashboard viewing across environments."
          },
          {
            "name": "startedAfter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "startedBefore",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/RunList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/api/v2/runs/import": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Runs"
        ],
        "summary": "Import an OTLP/JSON trace",
        "description": "Imports one bounded OTLP/JSON trace as a new run. The destination environment is always taken from the API key; source workspace and environment attributes are ignored.",
        "operationId": "importRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImportOtlpTraceRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/RunImported"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/api/v2/runs/{runId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "Get a run with its span tree",
        "operationId": "getRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/RunWithSpansResult"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "Runs"
        ],
        "summary": "End or update a run",
        "operationId": "endRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EndRunRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/RunResult"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v2/runs/{runId}/export": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "Export a run as OTLP/JSON",
        "description": "Exports a redacted trace in OpenTelemetry Protocol JSON shape.",
        "operationId": "exportRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TraceExport"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v2/runs/{runId}/feedback": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "post": {
        "tags": [
          "Runs"
        ],
        "summary": "Attach feedback to a run",
        "description": "Explicit or implicit feedback on a run, or a specific span within it  the start of the learning loop from production behaviour.",
        "operationId": "addRunFeedback",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddFeedbackRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/RunFeedbackCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "get": {
        "tags": [
          "Runs"
        ],
        "summary": "List feedback for a run",
        "operationId": "listRunFeedback",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/RunFeedbackList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v2/runs/{runId}/spans": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/RunId"
        }
      ],
      "post": {
        "tags": [
          "Runs"
        ],
        "summary": "Ingest spans",
        "description": "Batch-ingest spans for a run. Idempotent: a span carrying an `id` is upserted, so a retried batch never duplicates.",
        "operationId": "ingestSpans",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "runs:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IngestSpansRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/SpansIngested"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v2/sessions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Sessions"
        ],
        "summary": "Create a session",
        "description": "Create a persistent agent conversation thread, optionally seeded with messages.",
        "operationId": "createSession",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSessionRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/SessionCreated"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Sessions"
        ],
        "summary": "List sessions",
        "description": "List sessions ordered by most recent activity, optionally filtered by title.",
        "operationId": "listSessions",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:read"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SessionList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/sessions/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/SessionId"
        }
      ],
      "get": {
        "tags": [
          "Sessions"
        ],
        "summary": "Get a session",
        "operationId": "getSession",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Session"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Sessions"
        ],
        "summary": "Update a session",
        "description": "Replace the title and/or metadata of a session.",
        "operationId": "updateSession",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSessionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Session"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Sessions"
        ],
        "summary": "Delete a session",
        "description": "Permanently delete a session and all of its messages.",
        "operationId": "deleteSession",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Deleted"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/sessions/{id}/messages": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/SessionId"
        }
      ],
      "post": {
        "tags": [
          "Sessions"
        ],
        "summary": "Append session messages",
        "description": "Append one message or an ordered batch of up to 100 messages atomically.",
        "operationId": "appendSessionMessages",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AppendSessionMessagesRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/SessionMessagesAppended"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Sessions"
        ],
        "summary": "List session messages",
        "description": "List messages oldest first.",
        "operationId": "listSessionMessages",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:read"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SessionMessageList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Sessions"
        ],
        "summary": "Clear session messages",
        "description": "Delete every message and reset the rolling summary while retaining the session.",
        "operationId": "clearSessionMessages",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SessionMessagesCleared"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/sessions/{id}/messages/last": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/SessionId"
        }
      ],
      "delete": {
        "tags": [
          "Sessions"
        ],
        "summary": "Pop the newest session message",
        "description": "Remove and return the newest message so a failed agent turn can be retried.",
        "operationId": "popSessionMessage",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:write"
        ],
        "x-anlyon-idempotency": "supported",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SessionMessage"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/sessions/{id}/context": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/SessionId"
        }
      ],
      "get": {
        "tags": [
          "Sessions"
        ],
        "summary": "Get prompt-ready session context",
        "description": "Return the rolling summary and newest message tail that fits the token budget.",
        "operationId": "getSessionContext",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "sessions:read"
        ],
        "parameters": [
          {
            "name": "maxTokens",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 100,
              "maximum": 128000,
              "default": 2000
            }
          },
          {
            "name": "runId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 80
            },
            "description": "Existing run in this API key environment for the session-read span."
          },
          {
            "name": "parentSpanId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 80
            },
            "description": "Optional parent span within runId."
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SessionContext"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/context": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Context"
        ],
        "summary": "Assemble prompt-ready agent context",
        "description": "Merge relevant memories and/or a session summary and message tail into structured blocks and ready-to-paste text.",
        "operationId": "assembleContext",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "context:read"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AssembleContextRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/AssembledContext"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/workflows": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Create a workflow",
        "description": "Define the callback endpoint used to execute runs. Callback and failure URLs are validated against the platform SSRF blocklist.",
        "operationId": "createWorkflow",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWorkflowRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/Workflow"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/QuotaExceeded"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "List workflows",
        "operationId": "listWorkflows",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:read"
        ],
        "parameters": [
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "isActive",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/WorkflowList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/workflows/runs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "List workflow runs",
        "description": "An unknown but well-formed workflow ID returns an empty page and never falls through to unfiltered results.",
        "operationId": "listWorkflowRuns",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:read"
        ],
        "parameters": [
          {
            "name": "workflowId",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^wfl_[A-Za-z0-9_-]{21}$"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "running",
                "waiting",
                "completed",
                "failed",
                "cancelled"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/StartDate"
          },
          {
            "$ref": "#/components/parameters/EndDate"
          },
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/WorkflowRunList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/workflows/runs/{runId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/WorkflowRunId"
        }
      ],
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "Get a workflow run",
        "operationId": "getWorkflowRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/WorkflowRun"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/workflows/runs/{runId}/steps": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/WorkflowRunId"
        }
      ],
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "List steps for a workflow run",
        "operationId": "listWorkflowRunSteps",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/WorkflowStepList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/workflows/runs/{runId}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/WorkflowRunId"
        }
      ],
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Cancel a workflow run",
        "description": "Only pending, running, or waiting runs can be cancelled.",
        "operationId": "cancelWorkflowRun",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/workflows/events/notify": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Notify workflows waiting for an event",
        "description": "Stores an event for seven days and resumes one matching waiting run when present. Limited to 100 events/hour/workspace and 20 events/minute/event ID.",
        "operationId": "notifyWorkflowEvent",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotifyWorkflowEventRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/WorkflowEventNotification"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/workflows/{workflowId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/WorkflowId"
        }
      ],
      "get": {
        "tags": [
          "Workflows"
        ],
        "summary": "Get a workflow",
        "operationId": "getWorkflow",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Workflow"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "patch": {
        "tags": [
          "Workflows"
        ],
        "summary": "Update a workflow",
        "operationId": "updateWorkflow",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWorkflowRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Workflow"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      },
      "delete": {
        "tags": [
          "Workflows"
        ],
        "summary": "Delete a workflow and its runs",
        "operationId": "deleteWorkflow",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/MessageResult"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/workflows/{workflowId}/trigger": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "$ref": "#/components/parameters/WorkflowId"
        }
      ],
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Trigger a workflow run",
        "description": "Accepts an optional JSON payload up to 1 MB. Inactive workflows return `WORKFLOW_INACTIVE`.",
        "operationId": "triggerWorkflow",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "workflows:write"
        ],
        "x-anlyon-idempotency": "unsupported",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerWorkflowRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/WorkflowTriggered"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/environment": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Environments"
        ],
        "summary": "Get this key's environment",
        "description": "The environment this API key is bound to, including whether it is currently halted.",
        "operationId": "getOwnEnvironment",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Environment"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v2/environment/halt": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Environments"
        ],
        "summary": "Halt this key's environment",
        "description": "The kill switch. The agent stops acting and nothing leaves the environment: action invocations are blocked, deliveries defer, workflow steps park, and writes to memory, files, sessions, cache and Connect are refused. Publishes still queue and approvals can still be decided, so nothing in flight is lost. Applies to the environment this key is bound to -- a staging key cannot halt production. A key needs the `environments:halt` scope. A console session or OAuth token may call it too, for the session's environment, with the admin or member role there (approver and viewer cannot halt).",
        "operationId": "haltOwnEnvironment",
        "x-anlyon-audience": "public",
        "x-anlyon-idempotency": "unsupported",
        "x-anlyon-scopes": [
          "environments:halt"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HaltEnvironmentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Environment"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/api/v2/environment/resume": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "post": {
        "tags": [
          "Environments"
        ],
        "summary": "Resume this key's environment",
        "description": "Release the deferred work and let the agent act again. A key needs `environments:halt`; a console session needs the admin role or higher.",
        "operationId": "resumeOwnEnvironment",
        "x-anlyon-audience": "public",
        "x-anlyon-idempotency": "unsupported",
        "x-anlyon-scopes": [
          "environments:halt"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Environment"
          },
          "202": {
            "$ref": "#/components/responses/SignOffRequired"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/api/v2/audit/events": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Audit"
        ],
        "summary": "List audit records",
        "description": "Stored audit records for the key's own environment, newest first, in the v1 export shape (`anlyon.audit.v1`). Enterprise edition and Team plan; answers 404 where audit streaming is not included. Needs `audit:read`, which no key receives by default. Deduplicate on `id`.",
        "operationId": "listAuditEvents",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "audit:read"
        ],
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "description": "Ignored for an environment-scoped key",
            "which only ever sees its own environment.": null,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "Comma-separated event types or prefixes, for example `approval.*,policy.updated`.",
            "schema": {
              "type": "string",
              "maxLength": 1000
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/AuditCategory"
            }
          },
          {
            "name": "action",
            "in": "query",
            "description": "A governed action's name or id. Matches records that name it.",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "endUserId",
            "in": "query",
            "description": "Records of acts for this end user (or its erased~ hash).",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "The `sequence` of the last record on the previous page.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AuditEventList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/audit/export": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Audit"
        ],
        "summary": "Export audit records as evidence",
        "description": "Every stored audit record in a range of at most 366 days, oldest first, as one JSON document (`anlyon.audit.export.v1`) or CSV, streamed as an attachment. Filter by environment, event type, category or governed action. Taking an export is itself recorded (`audit.export.created`) before any record is sent. Records older than the hot window are read back from the audit archive, checked against their checksums, and included in the same order; 503 `AUDIT_ARCHIVE_UNAVAILABLE` when the range holds archived records this server cannot reach, and the stream stops with `AUDIT_ARCHIVE_INTEGRITY` rather than leave out a record whose archived copy fails its check. Enterprise edition and Team plan. Needs `audit:read`.",
        "operationId": "exportAuditEvents",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "audit:read"
        ],
        "x-anlyon-response-envelope": "raw-export",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ],
              "default": "json"
            }
          },
          {
            "name": "environmentId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 1000
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/AuditCategory"
            }
          },
          {
            "name": "action",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            }
          },
          {
            "name": "endUserId",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 160
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AuditExport"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v2/audit/schema": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Audit"
        ],
        "summary": "Get the audit event JSON Schema",
        "description": "The JSON Schema of one v1 audit event and the event types by category, for validating a SIEM parser. Enterprise edition and Team plan. Needs `audit:read`.",
        "operationId": "getAuditSchema",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [
          "audit:read"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AuditSchema"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/sign-offs": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        }
      ],
      "get": {
        "tags": [
          "Sign-offs"
        ],
        "summary": "List sign-off requests",
        "description": "The sign-off requests this credential made, newest first. A change an agent asks for that loosens a guardrail (raising a limit, removing a budget, adding an action, a looser approval policy) is not applied: it waits here until a workspace admin approves or rejects it in the console or from the link emailed to them. A console session lists the workspace's requests. Nothing on this route decides a request.",
        "operationId": "listSignOffs",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "applied",
                "rejected",
                "expired",
                "cancelled",
                "failed"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SignOffRequestList"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/sign-offs/{signOffId}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "signOffId",
          "in": "path",
          "required": true,
          "description": "Sign-off request id (sor_...).",
          "schema": {
            "type": "string",
            "pattern": "^sor_[A-Za-z0-9_-]{1,64}$"
          }
        }
      ],
      "get": {
        "tags": [
          "Sign-offs"
        ],
        "summary": "Get a sign-off request",
        "description": "Poll a request the credential made until its `status` is no longer `pending`, waiting `pollAfterSeconds` between reads. `applied` means a workspace admin approved it and the change took effect, with the result in `result`. `rejected`, `expired`, `cancelled` and `failed` mean nothing changed. A request expires 24 hours after it was made.",
        "operationId": "getSignOff",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [],
        "responses": {
          "200": {
            "$ref": "#/components/responses/SignOffRequest"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v2/sign-offs/{signOffId}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/RequestId"
        },
        {
          "name": "signOffId",
          "in": "path",
          "required": true,
          "description": "Sign-off request id (sor_...).",
          "schema": {
            "type": "string",
            "pattern": "^sor_[A-Za-z0-9_-]{1,64}$"
          }
        }
      ],
      "post": {
        "tags": [
          "Sign-offs"
        ],
        "summary": "Cancel a sign-off request",
        "description": "Withdraw a pending request. The credential that made it cancels it; a console session rejects it instead. Nothing changes.",
        "operationId": "cancelSignOff",
        "x-anlyon-audience": "public",
        "x-anlyon-scopes": [],
        "x-anlyon-idempotency": "unsupported",
        "responses": {
          "200": {
            "$ref": "#/components/responses/SignOffRequest"
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Anlyon API key",
        "description": "Workspace API key sent as `Authorization: Bearer <key>`."
      },
      "SessionAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "better-auth.session_token",
        "description": "Browser session used by dashboard-only operations."
      },
      "ScimBearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Anlyon SCIM token",
        "description": "The workspace SCIM token (`anlyon_scim_...`) sent as `Authorization: Bearer <token>`. Used only by /api/v2/scim."
      },
      "EndUserSessionAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Anlyon end-user session token",
        "description": "A short-lived end-user session token (`eus_...`) from POST /api/v2/end-users/{endUserId}/sessions, sent as `Authorization: Bearer <token>`. Used only by /api/v2/end-user-session."
      }
    },
    "headers": {
      "RequestId": {
        "description": "Correlation identifier for support and distributed tracing.",
        "schema": {
          "type": "string",
          "example": "req_0123456789abcdef0123456789abcdef"
        }
      }
    },
    "parameters": {
      "EndUserHeader": {
        "name": "Anlyon-End-User",
        "in": "header",
        "required": false,
        "description": "The end user this call acts for: your own id for them, 1 to 128 characters of letters, digits and `. _ : @ -`. Accepted only with an API key, which stays on your server; a session or an OAuth token that sends it is refused. A key created with `endUserRequired` must send it on every action call (`400 END_USER_REQUIRED`). On an /end-users/{endUserId} route it must name the same end user as the path.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9._:@-]{1,128}$"
        }
      },
      "EndUserIdPath": {
        "name": "endUserId",
        "in": "path",
        "required": true,
        "description": "Your own id for the end user. 1 to 128 characters of letters, digits and `. _ : @ -`. URL-encode it.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128,
          "pattern": "^[A-Za-z0-9._:@-]{1,128}$"
        }
      },
      "IntegrationPath": {
        "name": "integration",
        "in": "path",
        "required": true,
        "description": "A catalogue integration id, for example `gmail` or `github`.",
        "schema": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]{0,63}$"
        }
      },
      "RequestId": {
        "name": "X-Request-Id",
        "in": "header",
        "required": false,
        "description": "Optional caller correlation ID. Unsafe or oversized values are replaced.",
        "schema": {
          "type": "string",
          "maxLength": 128
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Stable retry key for a mutation. The key is claimed atomically before the handler runs, so concurrent retries execute the side effect at most once. Replaying the key for the same request (same method, path, workspace and JSON body) returns the original response with an `X-Idempotent-Replay: true` header. Reusing the key for a different request returns `409` with error code `idempotency_key_reuse`. A duplicate arriving while the first is still in flight waits and then replays; if the first does not finish in time the duplicate gets `409 idempotency_request_in_progress`. Keys are retained for 24 hours. Only successful (2xx) responses are stored; a failed request frees the key so it can be retried.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        }
      },
      "SessionId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Public session identifier.",
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100
        }
      },
      "FlowControlKeyId": {
        "name": "flowControlKeyId",
        "in": "path",
        "required": true,
        "description": "Public flow-control key identifier.",
        "schema": {
          "type": "string",
          "pattern": "^fck_"
        }
      },
      "IntegrationId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "Integration connection UUID.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "QueueId": {
        "name": "queueId",
        "in": "path",
        "required": true,
        "description": "Public queue identifier.",
        "schema": {
          "type": "string",
          "pattern": "^que_"
        }
      },
      "WorkflowId": {
        "name": "workflowId",
        "in": "path",
        "required": true,
        "description": "Public workflow identifier.",
        "schema": {
          "type": "string",
          "pattern": "^wfl_[A-Za-z0-9_-]{21}$"
        }
      },
      "WorkflowRunId": {
        "name": "runId",
        "in": "path",
        "required": true,
        "description": "Public workflow-run identifier.",
        "schema": {
          "type": "string",
          "pattern": "^wfr_[A-Za-z0-9_-]{21}$"
        }
      },
      "RunId": {
        "name": "runId",
        "in": "path",
        "required": true,
        "description": "Public run id (run_xxx).",
        "schema": {
          "type": "string"
        }
      },
      "PolicyId": {
        "name": "policyId",
        "in": "path",
        "required": true,
        "description": "Public approval-policy id (apol_xxx).",
        "schema": {
          "type": "string"
        }
      },
      "Page": {
        "name": "page",
        "in": "query",
        "description": "Page number for pagination",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Number of items per page",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        }
      },
      "StartDate": {
        "name": "startDate",
        "in": "query",
        "description": "Start date for filtering (ISO 8601 format)",
        "schema": {
          "type": "string",
          "format": "date-time",
          "example": "2024-01-01T00:00:00Z"
        }
      },
      "EndDate": {
        "name": "endDate",
        "in": "query",
        "description": "End date for filtering (ISO 8601 format)",
        "schema": {
          "type": "string",
          "format": "date-time",
          "example": "2024-12-31T23:59:59Z"
        }
      }
    },
    "schemas": {
      "SignOffChange": {
        "type": "object",
        "description": "One field of a governance change, which way it goes, and why.",
        "required": [
          "field",
          "from",
          "to",
          "direction",
          "reason"
        ],
        "properties": {
          "field": {
            "type": "string",
            "example": "amount"
          },
          "from": {
            "description": "The value before. Never a secret value.",
            "nullable": true,
            "example": 500
          },
          "to": {
            "description": "The value after. Never a secret value.",
            "nullable": true,
            "example": 5000
          },
          "direction": {
            "type": "string",
            "enum": [
              "tightening",
              "loosening",
              "neutral"
            ],
            "example": "loosening"
          },
          "reason": {
            "type": "string",
            "example": "Raises the limit."
          }
        }
      },
      "SignOffRequest": {
        "type": "object",
        "description": "A governance change that loosens a guardrail, asked for by an API key, a CLI login or an MCP session, waiting for a workspace admin. Give `signOffUrl` to a person; poll `pollUrl`.",
        "required": [
          "object",
          "id",
          "status",
          "operation",
          "environmentId",
          "resource",
          "summary",
          "changes",
          "diff",
          "signOffUrl",
          "pollUrl",
          "pollAfterSeconds",
          "requestedBy",
          "createdAt",
          "expiresAt",
          "decidedAt",
          "decidedBy",
          "decisionNote",
          "result",
          "error"
        ],
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "sign_off_request"
            ]
          },
          "id": {
            "type": "string",
            "example": "sor_V1StGXR8Z5jdHi6BmyT9q"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "applied",
              "rejected",
              "expired",
              "cancelled",
              "failed"
            ],
            "description": "`pending` until a workspace admin decides. `applied`: approved and in effect. `rejected`, `expired` (after 24 hours), `cancelled` (withdrawn by the credential) and `failed` (approved but could not be applied, see `error`): nothing changed.",
            "example": "pending"
          },
          "operation": {
            "type": "string",
            "enum": [
              "policy.create",
              "policy.update",
              "policy.delete",
              "policy_file.apply",
              "impact_limit.update",
              "impact_limit.archive",
              "budget.put",
              "budget.delete",
              "environment.resume",
              "action.create",
              "action.update",
              "action.import",
              "secret.put",
              "secret_store.create",
              "secret_store.update",
              "secret_store_settings.update",
              "oauth_app.put"
            ],
            "example": "impact_limit.update"
          },
          "environmentId": {
            "type": "string",
            "format": "uuid"
          },
          "resource": {
            "type": "object",
            "nullable": true,
            "required": [
              "type",
              "id"
            ],
            "properties": {
              "type": {
                "type": "string",
                "example": "impact_limit"
              },
              "id": {
                "type": "string",
                "example": "lim_01JABCDEF"
              },
              "name": {
                "type": "string",
                "example": "Daily refunds"
              }
            }
          },
          "summary": {
            "type": "string",
            "example": "Raise impact limit \"Daily refunds\" from 500 to 5000 usd"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignOffChange"
            }
          },
          "diff": {
            "type": "string",
            "description": "The changes as plain text",
            "for a terminal or a chat.": null,
            "example": "amount (loosens): Raises the limit.\n- 500\n+ 5000"
          },
          "signOffUrl": {
            "type": "string",
            "format": "uri",
            "description": "The console page where a workspace admin approves or rejects it. Give this to a person.",
            "example": "https://console.anlyon.com/sign-offs/sor_V1StGXR8Z5jdHi6BmyT9q"
          },
          "pollUrl": {
            "type": "string",
            "example": "/api/v2/sign-offs/sor_V1StGXR8Z5jdHi6BmyT9q"
          },
          "pollAfterSeconds": {
            "type": "integer",
            "example": 5
          },
          "requestedBy": {
            "type": "object",
            "required": [
              "type",
              "id"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "api_key",
                  "oauth_client",
                  "system"
                ]
              },
              "id": {
                "type": "string",
                "nullable": true
              },
              "onBehalfOf": {
                "type": "string",
                "nullable": true,
                "description": "For a CLI login or an MCP session",
                "the person who signed in.": null
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "decidedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "decidedBy": {
            "type": "object",
            "nullable": true,
            "required": [
              "type",
              "id",
              "via"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "user"
                ]
              },
              "id": {
                "type": "string"
              },
              "via": {
                "type": "string",
                "enum": [
                  "console",
                  "email_link"
                ]
              }
            }
          },
          "decisionNote": {
            "type": "string",
            "nullable": true
          },
          "result": {
            "nullable": true,
            "description": "When `applied`, what the original request would have returned: the limit, budget, policy or action as it now is."
          },
          "error": {
            "type": "object",
            "nullable": true,
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "example": "SIGN_OFF_STALE"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "SignOffRequestResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/SignOffRequest"
          }
        }
      },
      "SignOffRequestListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignOffRequest"
            }
          }
        }
      },
      "SignOffRequiredResponse": {
        "type": "object",
        "description": "The change was not applied. It loosens a guardrail and the caller is not a person in the console, so it waits for a workspace admin. Give `data.signOffUrl` to a person, then poll `data.pollUrl`. An identical request from the same credential returns the same pending request.",
        "required": [
          "success",
          "signOffRequired",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "signOffRequired": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/SignOffRequest"
          }
        }
      },
      "MemoryResource": {
        "type": "object",
        "required": [
          "id",
          "content",
          "metadata",
          "collectionId",
          "documentId",
          "chunkIndex",
          "source",
          "expiresAt",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^mem_"
          },
          "content": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "collectionId": {
            "type": "string",
            "pattern": "^col_"
          },
          "documentId": {
            "type": "string",
            "pattern": "^doc_",
            "nullable": true
          },
          "chunkIndex": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "source": {
            "type": "string",
            "enum": [
              "api",
              "ingest",
              "summary"
            ]
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "example": {
          "id": "mem_01JABC",
          "content": "Alice prefers concise answers.",
          "metadata": {
            "subject": "Alice"
          },
          "collectionId": "col_01JABC",
          "documentId": null,
          "chunkIndex": null,
          "source": "api",
          "expiresAt": null,
          "createdAt": "2026-07-13T12:00:00Z"
        }
      },
      "MemoryResourceResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/MemoryResource"
          }
        }
      },
      "MemoryListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemoryResource"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "MemoryRecallResult": {
        "allOf": [
          {
            "$ref": "#/components/schemas/MemoryResource"
          },
          {
            "type": "object",
            "required": [
              "score"
            ],
            "properties": {
              "score": {
                "type": "number",
                "minimum": 0
              }
            }
          }
        ]
      },
      "MemoryRecallResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "query",
              "mode",
              "results",
              "reranked"
            ],
            "properties": {
              "query": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "hybrid",
                  "semantic",
                  "keyword"
                ]
              },
              "results": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MemoryRecallResult"
                }
              },
              "reranked": {
                "type": "boolean"
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "query": "answer style",
            "mode": "hybrid",
            "reranked": false,
            "results": []
          }
        }
      },
      "MemoryBatchResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "total",
              "successful",
              "failed",
              "results"
            ],
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "successful": {
                "type": "integer",
                "minimum": 0
              },
              "failed": {
                "type": "integer",
                "minimum": 0
              },
              "results": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "memoryId": {
                      "type": "string",
                      "pattern": "^mem_"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "success",
                        "error"
                      ]
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "total": 2,
            "successful": 2,
            "failed": 0,
            "results": [
              {
                "memoryId": "mem_01JABC",
                "status": "success"
              },
              {
                "memoryId": "mem_01JDEF",
                "status": "success"
              }
            ]
          }
        }
      },
      "MemoryDeletedCountResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "deletedCount"
            ],
            "properties": {
              "deletedCount": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "deletedCount": 3
          }
        }
      },
      "MemoryDeletedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "deleted"
            ],
            "properties": {
              "deleted": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "deleted": true
          }
        }
      },
      "MemoryIngestResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "jobId",
              "documentId",
              "status"
            ],
            "properties": {
              "jobId": {
                "type": "string",
                "pattern": "^mjob_"
              },
              "documentId": {
                "type": "string",
                "pattern": "^doc_"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "completed"
                ]
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "jobId": "mjob_01JABC",
            "documentId": "doc_01JABC",
            "status": "pending"
          }
        }
      },
      "MemoryFileUploadResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "fileKey",
              "fileName",
              "size",
              "mimeType"
            ],
            "properties": {
              "fileKey": {
                "type": "string",
                "pattern": "^memory/"
              },
              "fileName": {
                "type": "string"
              },
              "size": {
                "type": "integer",
                "minimum": 0,
                "maximum": 10485760
              },
              "mimeType": {
                "type": "string"
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "fileKey": "memory/workspace/file-id",
            "fileName": "notes.txt",
            "size": 1024,
            "mimeType": "text/plain"
          }
        }
      },
      "MemorySummaryResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "memoryId",
              "content",
              "summaryOf",
              "tokenCount",
              "llmTokensUsed"
            ],
            "properties": {
              "memoryId": {
                "type": "string",
                "pattern": "^mem_"
              },
              "content": {
                "type": "string"
              },
              "summaryOf": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^mem_"
                }
              },
              "tokenCount": {
                "type": "integer",
                "minimum": 0
              },
              "llmTokensUsed": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "memoryId": "mem_summary",
            "content": "Alice prefers concise technical answers.",
            "summaryOf": [
              "mem_01JABC"
            ],
            "tokenCount": 12,
            "llmTokensUsed": 120
          }
        }
      },
      "MemoryJobQueuedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "jobId",
              "status"
            ],
            "properties": {
              "jobId": {
                "type": "string",
                "pattern": "^mjob_"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending"
                ]
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "jobId": "mjob_01JABC",
            "status": "pending"
          }
        }
      },
      "MemoryJobStatusResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "jobId",
              "documentId",
              "status",
              "totalChunks",
              "processedChunks",
              "failedChunks",
              "embeddingTokensUsed",
              "lastError",
              "createdAt",
              "startedAt",
              "completedAt"
            ],
            "properties": {
              "jobId": {
                "type": "string",
                "pattern": "^mjob_"
              },
              "documentId": {
                "type": "string",
                "pattern": "^doc_",
                "nullable": true
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "processing",
                  "completed",
                  "failed",
                  "partially_failed"
                ]
              },
              "totalChunks": {
                "type": "integer",
                "minimum": 0
              },
              "processedChunks": {
                "type": "integer",
                "minimum": 0
              },
              "failedChunks": {
                "type": "integer",
                "minimum": 0
              },
              "embeddingTokensUsed": {
                "type": "integer",
                "minimum": 0
              },
              "lastError": {
                "type": "string",
                "nullable": true
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "completedAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ingest",
                  "consolidate",
                  "reembed",
                  "session_summarize"
                ]
              },
              "llmTokensUsed": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "jobId": "mjob_01JABC",
            "documentId": "doc_01JABC",
            "kind": "ingest",
            "status": "processing",
            "totalChunks": 10,
            "processedChunks": 6,
            "failedChunks": 0,
            "embeddingTokensUsed": 800,
            "lastError": null,
            "createdAt": "2026-07-13T12:00:00Z",
            "startedAt": "2026-07-13T12:00:01Z",
            "completedAt": null
          }
        }
      },
      "MemoryCollectionResource": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "embeddingModel",
          "embeddingDimensions",
          "memoryCount",
          "metadata",
          "status",
          "defaultTtlSeconds",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^col_"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "embeddingModel": {
            "type": "string"
          },
          "embeddingDimensions": {
            "type": "integer",
            "minimum": 1
          },
          "memoryCount": {
            "type": "integer",
            "minimum": 0
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "readonly",
              "migrating"
            ]
          },
          "defaultTtlSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 31536000,
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "example": {
          "id": "col_01JABC",
          "name": "default",
          "description": "General agent memory",
          "embeddingModel": "text-embedding-3-small",
          "embeddingDimensions": 1536,
          "memoryCount": 42,
          "metadata": {},
          "status": "active",
          "defaultTtlSeconds": null,
          "createdAt": "2026-07-13T12:00:00Z",
          "updatedAt": "2026-07-13T12:00:00Z"
        }
      },
      "MemoryCollectionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/MemoryCollectionResource"
          }
        }
      },
      "MemoryCollectionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MemoryCollectionResource"
            }
          }
        }
      },
      "MemoryMigrationResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "jobId",
              "targetCollectionId",
              "status"
            ],
            "properties": {
              "jobId": {
                "type": "string",
                "pattern": "^mjob_"
              },
              "targetCollectionId": {
                "type": "string",
                "pattern": "^col_"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending"
                ]
              }
            }
          }
        },
        "example": {
          "success": true,
          "data": {
            "jobId": "mjob_01JABC",
            "targetCollectionId": "col_01JNEW",
            "status": "pending"
          }
        }
      },
      "Environment": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "isDefault",
          "isProtected",
          "halted",
          "haltedAt",
          "haltedReason",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "development",
              "staging",
              "production"
            ]
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "isDefault": {
            "type": "boolean",
            "description": "The environment new keys and resources default to."
          },
          "isProtected": {
            "type": "boolean",
            "description": "Production protection for destructive and promotion actions."
          },
          "halted": {
            "type": "boolean",
            "description": "Kill switch: while true the agent cannot act and nothing leaves the environment -- action invocations are blocked, deliveries defer, workflow steps pause, and writes to memory, files, sessions, cache and Connect are refused. Publishes still queue, approvals can still be decided, and reads still answer."
          },
          "haltedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "haltedReason": {
            "type": "string",
            "nullable": true
          },
          "allowedRedirectUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Where an end user's connect link may send them back to: each an origin plus a path prefix, matched exactly."
          },
          "defaultRedirectUrl": {
            "type": "string",
            "nullable": true,
            "description": "The redirect a connect link uses when none is given, including the links in a 409. One of allowedRedirectUrls."
          },
          "connectConfirmation": {
            "type": "string",
            "enum": [
              "required",
              "off"
            ],
            "description": "`required`: an end user's finished OAuth consent waits for your server to confirm it (the account-takeover defence). `off` only on an unprotected development environment."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "HaltEnvironmentRequest": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string",
            "maxLength": 500,
            "description": "Why the environment is being halted  recorded for the audit trail."
          }
        }
      },
      "EnvironmentResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Environment"
          }
        }
      },
      "ApprovalPolicyMatch": {
        "type": "object",
        "required": [
          "kind",
          "actionName",
          "agentId",
          "userId",
          "tags",
          "minAmount",
          "conditions",
          "condition"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "any",
              "action",
              "custom"
            ]
          },
          "actionName": {
            "type": "string",
            "nullable": true
          },
          "agentId": {
            "type": "string",
            "nullable": true
          },
          "userId": {
            "type": "string",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "minAmount": {
            "type": "number",
            "nullable": true
          },
          "conditions": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "condition": {
            "type": "string",
            "nullable": true,
            "description": "A CEL expression (https://cel.dev) that must also hold, over input, agent.id, user.id, tags, action.name and kind. Checked against the target action's input schema when saved. An evaluation error (for example a missing field) requires approval rather than skipping the policy; guard optional fields with has()."
          }
        }
      },
      "ApprovalPolicy": {
        "type": "object",
        "required": [
          "id",
          "environmentId",
          "name",
          "priority",
          "enabled",
          "scope",
          "needsScopeReview",
          "match",
          "effect",
          "requiredApprovals",
          "decidedBy",
          "version",
          "scopeReviewedAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Public policy id (apol_xxx)."
          },
          "environmentId": {
            "type": "string",
            "format": "uuid",
            "description": "The environment the policy governs. Policies never span environments."
          },
          "name": {
            "type": "string"
          },
          "priority": {
            "type": "integer",
            "description": "Lower runs first. Ties are broken by creation time, then by id, so the order is always deterministic."
          },
          "enabled": {
            "type": "boolean"
          },
          "scope": {
            "type": "string",
            "enum": [
              "specific_action",
              "all_actions",
              "custom_requests",
              "all_requests"
            ],
            "description": "What the policy applies to, derived from `match`. Never inferred from the name."
          },
          "needsScopeReview": {
            "type": "boolean",
            "description": "True on a broad policy nobody has confirmed the scope of. Every policy created before explicit targeting is in this state, because the old form sent no action selector. Preserved as it was, and flagged."
          },
          "match": {
            "$ref": "#/components/schemas/ApprovalPolicyMatch"
          },
          "effect": {
            "type": "string",
            "enum": [
              "require_approval",
              "auto_approve",
              "auto_deny"
            ]
          },
          "requiredApprovals": {
            "type": "integer",
            "description": "Distinct approvers needed (N-of-M)."
          },
          "decidedBy": {
            "type": "string",
            "enum": [
              "team",
              "end_user"
            ],
            "description": "Who decides an approval this policy requires. `team`: the console, Slack or a key with approvals:decide. `end_user`: the end user a call was made for, in your app (one decision, whatever requiredApprovals says). A call with no end user is always decided by the team."
          },
          "version": {
            "type": "integer",
            "description": "Bumps on each edit; recorded on approvals this policy governs."
          },
          "scopeReviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "managedBy": {
            "type": "object",
            "nullable": true,
            "description": "Set when a policy file owns this policy. Console and API edits of it are refused; change the file.",
            "required": [
              "file",
              "key"
            ],
            "properties": {
              "file": {
                "type": "string"
              },
              "key": {
                "type": "string"
              }
            }
          }
        }
      },
      "CreateEnvironmentApprovalPolicyRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "Same as the console request, without `environmentId`. The environment is the credential's; a body that names one is rejected.",
        "required": [
          "name",
          "matchKind"
        ],
        "properties": {
          "changeNote": {
            "type": "string",
            "maxLength": 1000
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "enabled": {
            "type": "boolean"
          },
          "matchKind": {
            "type": "string",
            "enum": [
              "any",
              "action",
              "custom"
            ]
          },
          "matchActionName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "matchAgentId": {
            "type": "string",
            "maxLength": 60
          },
          "matchUserId": {
            "type": "string",
            "maxLength": 200
          },
          "matchTags": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "minAmount": {
            "type": "number",
            "minimum": 0
          },
          "conditions": {
            "type": "object",
            "additionalProperties": true
          },
          "condition": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "description": "A CEL expression (https://cel.dev) that must also hold, over input, agent.id, user.id, tags, action.name and kind. Checked against the target action's input schema when saved. An evaluation error (for example a missing field) requires approval rather than skipping the policy; guard optional fields with has()."
          },
          "effect": {
            "type": "string",
            "enum": [
              "require_approval",
              "auto_approve",
              "auto_deny"
            ]
          },
          "requiredApprovals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "decidedBy": {
            "type": "string",
            "enum": [
              "team",
              "end_user"
            ],
            "description": "Who decides: the team, or the end user a call was made for."
          },
          "acknowledgeBroadScope": {
            "type": "boolean"
          }
        }
      },
      "UpdateEnvironmentApprovalPolicyRequest": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "description": "Same semantics as the console update. `environmentId` is not accepted.",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "priority": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000
          },
          "enabled": {
            "type": "boolean"
          },
          "matchKind": {
            "type": "string",
            "enum": [
              "any",
              "action",
              "custom"
            ]
          },
          "matchActionName": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 200
          },
          "matchAgentId": {
            "type": "string",
            "nullable": true,
            "maxLength": 60
          },
          "matchUserId": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "matchTags": {
            "type": "array",
            "nullable": true,
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "minAmount": {
            "type": "number",
            "nullable": true,
            "minimum": 0
          },
          "conditions": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "condition": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2000,
            "nullable": true,
            "description": "A CEL expression (https://cel.dev) that must also hold, over input, agent.id, user.id, tags, action.name and kind. Checked against the target action's input schema when saved. An evaluation error (for example a missing field) requires approval rather than skipping the policy; guard optional fields with has()."
          },
          "effect": {
            "type": "string",
            "enum": [
              "require_approval",
              "auto_approve",
              "auto_deny"
            ]
          },
          "requiredApprovals": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "decidedBy": {
            "type": "string",
            "enum": [
              "team",
              "end_user"
            ],
            "description": "Who decides: the team, or the end user a call was made for."
          },
          "acknowledgeBroadScope": {
            "type": "boolean"
          }
        }
      },
      "CredentialIdentity": {
        "type": "object",
        "description": "The caller's own credential. Never contains a secret, a hash, another key or an account detail.",
        "required": [
          "credentialType",
          "apiKeyId",
          "workspaceId",
          "environmentId",
          "scopes",
          "expiresAt",
          "role"
        ],
        "properties": {
          "credentialType": {
            "type": "string",
            "enum": [
              "api_key",
              "oauth",
              "session"
            ]
          },
          "apiKeyId": {
            "type": "string",
            "nullable": true,
            "description": "Only an API key has one. Null for OAuth and sessions; none is invented."
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "environmentId": {
            "type": "string",
            "format": "uuid"
          },
          "scopes": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            },
            "description": "Effective granted scopes, sorted. Null for a session, whose authority comes from the user's workspace role. Holding a scope does not prove a call will succeed; policies, budgets, environment state and quotas still apply."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "role": {
            "type": "string",
            "nullable": true,
            "enum": [
              "owner",
              "admin",
              "member",
              "approver",
              "viewer",
              null
            ],
            "description": "For a session or OAuth token, the person's role in this environment (a per-environment grant can set it); the credential can do no more than the role allows. Null for an API key, whose scopes are its authority."
          }
        }
      },
      "CredentialIdentityResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/CredentialIdentity"
          }
        }
      },
      "ApprovalPolicyListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalPolicy"
            }
          }
        }
      },
      "ApprovalPolicyResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ApprovalPolicy"
          }
        }
      },
      "SpanType": {
        "type": "string",
        "enum": [
          "model_call",
          "context_assembly",
          "session_read",
          "session_write",
          "memory_recall",
          "memory_write",
          "tool_call",
          "action_call",
          "approval_wait",
          "approval_decision",
          "workflow_step",
          "queue_delivery",
          "event_delivery",
          "custom"
        ]
      },
      "Span": {
        "type": "object",
        "required": [
          "id",
          "parentId",
          "name",
          "type",
          "status",
          "startedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Public span id (span_xxx)."
          },
          "parentId": {
            "type": "string",
            "nullable": true,
            "description": "Parent span id, or null for a root span."
          },
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/SpanType"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed"
            ]
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "durationMs": {
            "type": "integer",
            "nullable": true
          },
          "model": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          },
          "tokens": {
            "type": "object",
            "additionalProperties": {
              "type": "number"
            },
            "nullable": true
          },
          "cost": {
            "type": "number",
            "nullable": true
          },
          "input": {
            "nullable": true
          },
          "output": {
            "nullable": true
          },
          "error": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "attributes": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "OTel-style attributes, including correlation refs (e.g. messageId)."
          }
        }
      },
      "SpanNode": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Span"
          },
          {
            "type": "object",
            "required": [
              "children"
            ],
            "properties": {
              "children": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SpanNode"
                }
              }
            }
          }
        ]
      },
      "TraceExport": {
        "type": "object",
        "required": [
          "resourceSpans"
        ],
        "properties": {
          "resourceSpans": {
            "type": "array",
            "description": "OpenTelemetry Protocol JSON resource spans for one Anlyon run.",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          }
        }
      },
      "TraceExportResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/TraceExport"
          }
        }
      },
      "ImportOtlpTraceRequest": {
        "type": "object",
        "required": [
          "resourceSpans"
        ],
        "properties": {
          "resourceSpans": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "description": "One OTLP resource trace; at most 500 spans total are accepted.",
            "items": {
              "$ref": "#/components/schemas/OtlpResourceSpans"
            }
          }
        }
      },
      "OtlpResourceSpans": {
        "type": "object",
        "required": [
          "scopeSpans"
        ],
        "properties": {
          "resource": {
            "type": "object",
            "properties": {
              "attributes": {
                "type": "array",
                "maxItems": 100,
                "items": {
                  "$ref": "#/components/schemas/OtlpAttribute"
                }
              }
            }
          },
          "scopeSpans": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "object",
              "required": [
                "spans"
              ],
              "properties": {
                "spans": {
                  "type": "array",
                  "maxItems": 500,
                  "items": {
                    "$ref": "#/components/schemas/OtlpSpan"
                  }
                }
              }
            }
          }
        }
      },
      "OtlpSpan": {
        "type": "object",
        "required": [
          "spanId",
          "name",
          "startTimeUnixNano"
        ],
        "properties": {
          "traceId": {
            "type": "string",
            "maxLength": 128
          },
          "spanId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "parentSpanId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "startTimeUnixNano": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "maxLength": 30,
            "example": "1760000000000000000"
          },
          "endTimeUnixNano": {
            "type": "string",
            "pattern": "^[0-9]+$",
            "maxLength": 30,
            "example": "1760000001000000000"
          },
          "status": {
            "type": "object",
            "properties": {
              "code": {
                "type": "integer",
                "minimum": 0,
                "maximum": 2
              }
            }
          },
          "attributes": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/OtlpAttribute"
            }
          }
        }
      },
      "OtlpAttribute": {
        "type": "object",
        "required": [
          "key"
        ],
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "value": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "Run": {
        "type": "object",
        "required": [
          "id",
          "environmentId",
          "name",
          "status",
          "startedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Public run id (run_xxx)."
          },
          "agentId": {
            "type": "string",
            "nullable": true
          },
          "agentVersion": {
            "type": "string",
            "nullable": true
          },
          "environmentId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "userId": {
            "type": "string",
            "nullable": true
          },
          "application": {
            "type": "string",
            "nullable": true
          },
          "input": {
            "nullable": true
          },
          "output": {
            "nullable": true
          },
          "error": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "tokens": {
            "type": "integer",
            "nullable": true
          },
          "cost": {
            "type": "number",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "durationMs": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "RunWithSpans": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Run"
          },
          {
            "type": "object",
            "required": [
              "spans"
            ],
            "properties": {
              "spans": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SpanNode"
                }
              }
            }
          }
        ]
      },
      "StartRunRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 200
          },
          "agentId": {
            "type": "string",
            "maxLength": 60
          },
          "agentVersion": {
            "type": "string",
            "maxLength": 60
          },
          "userId": {
            "type": "string",
            "maxLength": 200
          },
          "application": {
            "type": "string",
            "maxLength": 200
          },
          "input": {},
          "tags": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string",
              "maxLength": 60
            }
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "EndRunRequest": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ]
          },
          "output": {},
          "error": {
            "type": "object",
            "additionalProperties": true
          },
          "tokens": {
            "type": "integer",
            "minimum": 0
          },
          "cost": {
            "type": "number",
            "minimum": 0
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "IngestSpansRequest": {
        "type": "object",
        "required": [
          "spans"
        ],
        "properties": {
          "spans": {
            "type": "array",
            "minItems": 1,
            "maxItems": 500,
            "items": {
              "type": "object",
              "required": [
                "name",
                "startedAt"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "maxLength": 80,
                  "description": "Provide to make ingestion idempotent  resending the same id updates the span in place."
                },
                "parentId": {
                  "type": "string",
                  "maxLength": 80
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "type": {
                  "$ref": "#/components/schemas/SpanType"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "running",
                    "succeeded",
                    "failed"
                  ]
                },
                "startedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "endedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "model": {
                  "type": "string",
                  "maxLength": 120
                },
                "provider": {
                  "type": "string",
                  "maxLength": 120
                },
                "tokens": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "number"
                  },
                  "description": "Token counts, e.g. {input, output, total}. Rolled up to the run automatically: `total` wins when present, otherwise the values sum. Explicit run totals set at end-of-run override the rollup."
                },
                "cost": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Cost in USD as reported by the provider or gateway. Summed to the run total automatically."
                },
                "input": {},
                "output": {},
                "error": {
                  "type": "object",
                  "additionalProperties": true
                },
                "attributes": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      },
      "RunResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Run"
          }
        }
      },
      "RunWithSpansResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/RunWithSpans"
          }
        }
      },
      "RunListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Run"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "IngestSpansResultResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "ingested"
            ],
            "properties": {
              "ingested": {
                "type": "integer"
              }
            }
          }
        }
      },
      "RunFeedback": {
        "type": "object",
        "required": [
          "id",
          "runId",
          "spanId",
          "source",
          "label",
          "rating",
          "comment",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Public feedback id (fbk_xxx)."
          },
          "runId": {
            "type": "string"
          },
          "spanId": {
            "type": "string",
            "nullable": true,
            "description": "The span this targets, or null for the whole run."
          },
          "source": {
            "type": "string",
            "enum": [
              "user",
              "model",
              "code"
            ],
            "description": "Explicit human feedback vs an implicit signal."
          },
          "label": {
            "type": "string",
            "nullable": true
          },
          "rating": {
            "type": "number",
            "nullable": true
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AddFeedbackRequest": {
        "type": "object",
        "properties": {
          "spanId": {
            "type": "string",
            "maxLength": 80
          },
          "source": {
            "type": "string",
            "enum": [
              "user",
              "model",
              "code"
            ]
          },
          "label": {
            "type": "string",
            "maxLength": 80
          },
          "rating": {
            "type": "number"
          },
          "comment": {
            "type": "string",
            "maxLength": 4000
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "RunFeedbackResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/RunFeedback"
          }
        }
      },
      "RunFeedbackListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RunFeedback"
            }
          }
        }
      },
      "CreateWorkflowRequest": {
        "type": "object",
        "required": [
          "name",
          "url"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "default": "POST"
          },
          "retries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "default": 3
          },
          "failureUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "UpdateWorkflowRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "retries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10
          },
          "failureUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "TriggerWorkflowRequest": {
        "type": "object",
        "properties": {
          "payload": {
            "description": "Any JSON value whose serialized form is at most 1 MB."
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Existing run in this API key environment for workflow spans."
          },
          "parentSpanId": {
            "type": "string",
            "maxLength": 80
          }
        }
      },
      "NotifyWorkflowEventRequest": {
        "type": "object",
        "required": [
          "eventId"
        ],
        "properties": {
          "eventId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "data": {
            "description": "Optional event payload."
          }
        }
      },
      "Workflow": {
        "type": "object",
        "required": [
          "workflowId",
          "name",
          "url",
          "method",
          "retries",
          "failureUrl",
          "isActive",
          "createdAt"
        ],
        "properties": {
          "workflowId": {
            "type": "string",
            "pattern": "^wfl_[A-Za-z0-9_-]{21}$"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "retries": {
            "type": "integer",
            "minimum": 0
          },
          "failureUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Workflow"
          }
        }
      },
      "WorkflowListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Workflow"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "WorkflowRunSummary": {
        "type": "object",
        "required": [
          "runId",
          "workflowId",
          "workflowName",
          "status",
          "currentStepIndex",
          "errorMessage",
          "startedAt",
          "completedAt",
          "createdAt"
        ],
        "properties": {
          "runId": {
            "type": "string",
            "pattern": "^wfr_[A-Za-z0-9_-]{21}$"
          },
          "workflowId": {
            "type": "string",
            "pattern": "^wfl_[A-Za-z0-9_-]{21}$"
          },
          "workflowName": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "waiting",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "currentStepIndex": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowRun": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WorkflowRunSummary"
          },
          {
            "type": "object",
            "required": [
              "initialPayload",
              "result",
              "nextStepAt",
              "waitingForEvent",
              "updatedAt"
            ],
            "properties": {
              "initialPayload": {
                "nullable": true
              },
              "result": {
                "nullable": true
              },
              "nextStepAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "waitingForEvent": {
                "type": "string",
                "nullable": true
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        ]
      },
      "WorkflowRunResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/WorkflowRun"
          }
        }
      },
      "WorkflowRunListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowRunSummary"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "WorkflowStep": {
        "type": "object",
        "required": [
          "stepId",
          "stepName",
          "stepIndex",
          "stepType",
          "status",
          "output",
          "errorMessage",
          "attemptCount",
          "durationMs",
          "startedAt",
          "completedAt",
          "createdAt"
        ],
        "properties": {
          "stepId": {
            "type": "string",
            "pattern": "^wfs_[A-Za-z0-9_-]{21}$"
          },
          "stepName": {
            "type": "string"
          },
          "stepIndex": {
            "type": "integer",
            "minimum": 0
          },
          "stepType": {
            "type": "string",
            "enum": [
              "run",
              "sleep",
              "call",
              "invoke",
              "wait_event",
              "notify"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "completed",
              "failed"
            ]
          },
          "output": {
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "attemptCount": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "durationMs": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WorkflowStepListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowStep"
            }
          }
        }
      },
      "WorkflowTriggeredResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "runId",
              "workflowId",
              "status",
              "createdAt"
            ],
            "properties": {
              "runId": {
                "type": "string",
                "pattern": "^wfr_[A-Za-z0-9_-]{21}$"
              },
              "workflowId": {
                "type": "string",
                "pattern": "^wfl_[A-Za-z0-9_-]{21}$"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending"
                ]
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "WorkflowEventNotificationResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message",
              "notifiedRunId"
            ],
            "properties": {
              "message": {
                "type": "string",
                "enum": [
                  "Event delivered",
                  "Event stored"
                ]
              },
              "notifiedRunId": {
                "type": "string",
                "pattern": "^wfr_[A-Za-z0-9_-]{21}$",
                "nullable": true
              }
            }
          }
        }
      },
      "CreateQueueRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$",
            "description": "Names beginning with `__` are reserved."
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "parallelism": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "default": 1
          }
        }
      },
      "UpdateQueueRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$",
            "description": "Names beginning with `__` are reserved."
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "parallelism": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          }
        }
      },
      "Queue": {
        "type": "object",
        "required": [
          "queueId",
          "name",
          "description",
          "parallelism",
          "status",
          "isPaused",
          "messageCount",
          "pendingCount",
          "lag",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "queueId": {
            "type": "string",
            "pattern": "^que_"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "parallelism": {
            "type": "integer",
            "minimum": 1
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused",
              "deleted"
            ]
          },
          "isPaused": {
            "type": "boolean",
            "description": "Authoritative operational pause flag."
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Persisted aggregate count."
          },
          "pendingCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Persisted aggregate count."
          },
          "lag": {
            "type": "integer",
            "minimum": 0,
            "description": "Live sum of pending-stream and scheduled-set entries."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "QueueResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Queue"
          }
        }
      },
      "QueueListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Queue"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "TestNotificationWebhookRequest": {
        "type": "object",
        "required": [
          "webhookUrl"
        ],
        "properties": {
          "webhookUrl": {
            "type": "string",
            "format": "uri"
          },
          "webhookSecret": {
            "type": "string",
            "writeOnly": true
          }
        }
      },
      "NotificationTypeName": {
        "type": "string",
        "enum": [
          "quota_warning",
          "quota_exceeded",
          "payment_failed",
          "plan_upgraded",
          "plan_downgraded",
          "feature_enabled",
          "system_alert",
          "security_alert",
          "delivery_failure_spike",
          "api_key_expiring",
          "approval_requested",
          "budget_alert",
          "approval_expired",
          "outcome_unknown",
          "connection_broken"
        ]
      },
      "UpdateMyNotificationPreferencesRequest": {
        "type": "object",
        "required": [
          "mutedTypes"
        ],
        "properties": {
          "mutedTypes": {
            "type": "array",
            "maxItems": 15,
            "description": "Notification types to leave out of your own list and unread count. Send an empty array to mute nothing.",
            "items": {
              "$ref": "#/components/schemas/NotificationTypeName"
            }
          }
        }
      },
      "MyNotificationPreferences": {
        "type": "object",
        "required": [
          "mutedTypes",
          "updatedAt"
        ],
        "properties": {
          "mutedTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NotificationTypeName"
            }
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Null until you save your preferences for the first time."
          }
        }
      },
      "UnreadNotificationCountResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "count"
            ],
            "properties": {
              "count": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      },
      "RedactedHeaders": {
        "type": "object",
        "nullable": true,
        "description": "Header map. Authorization, cookie, proxy-authorization, set-cookie, x-api-key, api-key, x-auth-token, and x-access-token values are replaced with `[REDACTED]`.",
        "additionalProperties": true
      },
      "MessageExecutionLog": {
        "type": "object",
        "required": [
          "id",
          "messageId",
          "attemptNumber",
          "status",
          "requestUrl",
          "requestMethod",
          "requestHeaders",
          "requestBody",
          "responseStatus",
          "responseHeaders",
          "responseBody",
          "errorMessage",
          "errorCode",
          "duration",
          "timestamp",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "messageId": {
            "type": "string",
            "pattern": "^msg_"
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "enum": [
              "CREATED",
              "ACTIVE",
              "PROCESSING",
              "SUCCESS",
              "ERROR",
              "RETRY"
            ]
          },
          "requestUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "requestMethod": {
            "type": "string",
            "nullable": true
          },
          "requestHeaders": {
            "$ref": "#/components/schemas/RedactedHeaders"
          },
          "requestBody": {
            "nullable": true
          },
          "responseStatus": {
            "type": "integer",
            "nullable": true
          },
          "responseHeaders": {
            "$ref": "#/components/schemas/RedactedHeaders"
          },
          "responseBody": {
            "type": "string",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "errorCode": {
            "type": "string",
            "nullable": true
          },
          "duration": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ScheduleExecutionLog": {
        "type": "object",
        "required": [
          "id",
          "scheduleId",
          "status",
          "messageId",
          "executedAt",
          "duration",
          "nextScheduledAt",
          "errorMessage",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "scheduleId": {
            "type": "string",
            "pattern": "^sch_"
          },
          "status": {
            "type": "string",
            "enum": [
              "STARTED",
              "SUCCESS",
              "FAILED"
            ]
          },
          "messageId": {
            "type": "string",
            "nullable": true
          },
          "executedAt": {
            "type": "string",
            "format": "date-time"
          },
          "duration": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "nextScheduledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "UnifiedExecutionLog": {
        "type": "object",
        "required": [
          "id",
          "type",
          "entityId",
          "status",
          "timestamp"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "message",
              "schedule"
            ]
          },
          "entityId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "duration": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "attemptNumber": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "requestUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "requestMethod": {
            "type": "string",
            "nullable": true
          },
          "requestHeaders": {
            "$ref": "#/components/schemas/RedactedHeaders"
          },
          "requestBody": {
            "nullable": true
          },
          "responseStatus": {
            "type": "integer",
            "nullable": true
          },
          "responseHeaders": {
            "$ref": "#/components/schemas/RedactedHeaders"
          },
          "responseBody": {
            "type": "string",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "errorCode": {
            "type": "string",
            "nullable": true
          },
          "createdMessageId": {
            "type": "string",
            "nullable": true
          },
          "nextScheduledAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "executedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "BasicExecutionLogStats": {
        "type": "object",
        "required": [
          "totalSuccess",
          "totalError",
          "totalRetry",
          "avgDuration",
          "errorRate"
        ],
        "properties": {
          "totalSuccess": {
            "type": "integer",
            "minimum": 0
          },
          "totalError": {
            "type": "integer",
            "minimum": 0
          },
          "totalRetry": {
            "type": "integer",
            "minimum": 0
          },
          "avgDuration": {
            "type": "integer",
            "minimum": 0
          },
          "errorRate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "UnifiedExecutionLogListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination",
          "stats"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnifiedExecutionLog"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          },
          "stats": {
            "$ref": "#/components/schemas/BasicExecutionLogStats"
          }
        }
      },
      "ExecutionLogStatsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "byStatus",
              "byHttpStatus",
              "byErrorCode",
              "byHour",
              "avgDuration",
              "p50Duration",
              "p95Duration",
              "p99Duration"
            ],
            "properties": {
              "byStatus": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "byHttpStatus": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "byErrorCode": {
                "type": "object",
                "additionalProperties": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "byHour": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "hour",
                    "count",
                    "errors"
                  ],
                  "properties": {
                    "hour": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "errors": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              },
              "avgDuration": {
                "type": "integer",
                "minimum": 0
              },
              "p50Duration": {
                "type": "integer",
                "minimum": 0
              },
              "p95Duration": {
                "type": "integer",
                "minimum": 0
              },
              "p99Duration": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      },
      "MessageExecutionLogListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageExecutionLog"
            }
          }
        }
      },
      "ScheduleExecutionLogListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScheduleExecutionLog"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "ExecutionLogExportResponse": {
        "type": "object",
        "required": [
          "logs"
        ],
        "properties": {
          "logs": {
            "type": "array",
            "maxItems": 10000,
            "items": {
              "$ref": "#/components/schemas/UnifiedExecutionLog"
            }
          }
        }
      },
      "IntegrationEventType": {
        "type": "string",
        "enum": [
          "quota_warning",
          "quota_exceeded",
          "payment_failed",
          "plan_upgraded",
          "plan_downgraded",
          "feature_enabled",
          "system_alert",
          "security_alert",
          "delivery_failure_spike",
          "api_key_expiring"
        ]
      },
      "Integration": {
        "type": "object",
        "required": [
          "id",
          "type",
          "name",
          "isActive",
          "enabledEventTypes",
          "lastUsedAt",
          "lastError",
          "errorCount",
          "createdAt",
          "slackTeamId",
          "slackTeamName",
          "slackChannelId",
          "slackChannelName",
          "discordServerId",
          "discordChannelName"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "slack",
              "discord"
            ]
          },
          "name": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "enabledEventTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationEventType"
            }
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastError": {
            "type": "string",
            "nullable": true
          },
          "errorCount": {
            "type": "integer",
            "minimum": 0
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "slackTeamId": {
            "type": "string",
            "nullable": true
          },
          "slackTeamName": {
            "type": "string",
            "nullable": true
          },
          "slackChannelId": {
            "type": "string",
            "nullable": true
          },
          "slackChannelName": {
            "type": "string",
            "nullable": true
          },
          "discordServerId": {
            "type": "string",
            "nullable": true
          },
          "discordChannelName": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "IntegrationListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Integration"
            }
          }
        }
      },
      "CreateDiscordIntegrationRequest": {
        "type": "object",
        "required": [
          "name",
          "webhookUrl"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "webhookUrl": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://discord\\.com/api/webhooks/",
            "writeOnly": true
          },
          "enabledEventTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationEventType"
            }
          }
        }
      },
      "DiscordIntegrationCreatedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "id",
              "type",
              "name",
              "isActive",
              "enabledEventTypes",
              "discordChannelName",
              "createdAt"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "type": {
                "type": "string",
                "enum": [
                  "discord"
                ]
              },
              "name": {
                "type": "string"
              },
              "isActive": {
                "type": "boolean"
              },
              "enabledEventTypes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/IntegrationEventType"
                }
              },
              "discordChannelName": {
                "type": "string",
                "nullable": true
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "SlackChannel": {
        "type": "object",
        "required": [
          "id",
          "name",
          "isPrivate",
          "isMember"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "isPrivate": {
            "type": "boolean",
            "nullable": true
          },
          "isMember": {
            "type": "boolean",
            "nullable": true
          }
        }
      },
      "SlackChannelListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SlackChannel"
            }
          }
        }
      },
      "UpdateSlackChannelRequest": {
        "type": "object",
        "required": [
          "channelId",
          "channelName"
        ],
        "properties": {
          "channelId": {
            "type": "string",
            "minLength": 1
          },
          "channelName": {
            "type": "string",
            "minLength": 1
          }
        }
      },
      "SlackChannelUpdatedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message",
              "channelId",
              "channelName",
              "autoJoined",
              "isPrivate",
              "joinError"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "channelId": {
                "type": "string"
              },
              "channelName": {
                "type": "string"
              },
              "autoJoined": {
                "type": "boolean"
              },
              "isPrivate": {
                "type": "boolean",
                "nullable": true
              },
              "joinError": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      },
      "ToggleIntegrationRequest": {
        "type": "object",
        "required": [
          "isActive"
        ],
        "properties": {
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "IntegrationToggledResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message",
              "isActive"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "isActive": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "UpdateIntegrationEventTypesRequest": {
        "type": "object",
        "required": [
          "enabledEventTypes"
        ],
        "properties": {
          "enabledEventTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/IntegrationEventType"
            }
          }
        }
      },
      "IntegrationEventTypesUpdatedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message",
              "enabledEventTypes"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "enabledEventTypes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/IntegrationEventType"
                }
              }
            }
          }
        }
      },
      "CreateFlowControlKeyRequest": {
        "type": "object",
        "required": [
          "key"
        ],
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_:-]+$"
          },
          "rateLimit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "rateLimitWindow": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "description": "Required with `rateLimit`; seconds per rate window."
          },
          "parallelism": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000
          }
        }
      },
      "UpdateFlowControlKeyRequest": {
        "type": "object",
        "properties": {
          "rateLimit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000,
            "nullable": true
          },
          "rateLimitWindow": {
            "type": "integer",
            "minimum": 1,
            "maximum": 3600,
            "nullable": true
          },
          "parallelism": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "nullable": true
          }
        }
      },
      "FlowControlKey": {
        "type": "object",
        "required": [
          "flowControlKeyId",
          "key",
          "rateLimit",
          "rateLimitWindow",
          "parallelism",
          "isPaused",
          "isPinned",
          "activeCount",
          "waitlistCount",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "flowControlKeyId": {
            "type": "string",
            "pattern": "^fck_"
          },
          "key": {
            "type": "string"
          },
          "rateLimit": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          },
          "rateLimitWindow": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          },
          "parallelism": {
            "type": "integer",
            "minimum": 1,
            "nullable": true
          },
          "isPaused": {
            "type": "boolean"
          },
          "isPinned": {
            "type": "boolean"
          },
          "activeCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Live Redis count."
          },
          "waitlistCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Live Redis count."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FlowControlKeyResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/FlowControlKey"
          }
        }
      },
      "FlowControlKeyListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FlowControlKey"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "FlowControlStatusResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "activeCount",
              "waitlistCount",
              "currentRateCount",
              "isPaused",
              "isPinned"
            ],
            "properties": {
              "activeCount": {
                "type": "integer",
                "minimum": 0
              },
              "waitlistCount": {
                "type": "integer",
                "minimum": 0
              },
              "currentRateCount": {
                "type": "integer",
                "minimum": 0
              },
              "isPaused": {
                "type": "boolean"
              },
              "isPinned": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "DLQMessage": {
        "type": "object",
        "description": "Public failed-delivery diagnostics. Tenant-internal database and event-join identifiers are excluded.",
        "required": [
          "messageId",
          "url",
          "method",
          "headers",
          "body",
          "status",
          "scheduledFor",
          "attempts",
          "maxRetries",
          "responseStatus",
          "responseBody",
          "errorMessage",
          "deliveredAt",
          "failedAt",
          "callbackUrl",
          "failureCallbackUrl",
          "flowControlKey",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "messageId": {
            "type": "string",
            "pattern": "^msg_"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "headers": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "body": {
            "nullable": true,
            "description": "Original JSON delivery body."
          },
          "status": {
            "type": "string",
            "enum": [
              "failed"
            ]
          },
          "scheduledFor": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "maxRetries": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "responseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "nullable": true
          },
          "responseBody": {
            "type": "string",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "failedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "failureCallbackUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "flowControlKey": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DLQMessageResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/DLQMessage"
          }
        }
      },
      "DLQMessageListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DLQMessage"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "DLQStatsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "totalFailed",
              "oldestFailure",
              "newestFailure"
            ],
            "properties": {
              "totalFailed": {
                "type": "integer",
                "minimum": 0
              },
              "oldestFailure": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "newestFailure": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              }
            }
          }
        }
      },
      "DLQRetryResultResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message",
              "messageId"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "messageId": {
                "type": "string",
                "pattern": "^msg_"
              }
            }
          }
        }
      },
      "DLQRetryAllResultResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message",
              "retriedCount",
              "remaining"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "retriedCount": {
                "type": "integer",
                "minimum": 0
              },
              "remaining": {
                "type": "integer",
                "minimum": 0,
                "description": "Failed messages still in this environment's DLQ after the call. Call again to continue."
              }
            }
          }
        }
      },
      "DLQClearResultResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message",
              "deletedCount",
              "remaining"
            ],
            "properties": {
              "message": {
                "type": "string"
              },
              "deletedCount": {
                "type": "integer",
                "minimum": 0
              },
              "remaining": {
                "type": "integer",
                "minimum": 0,
                "description": "Failed messages still in this environment's DLQ after the call. Call again to continue."
              }
            }
          }
        }
      },
      "MessageResultResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "message"
            ],
            "properties": {
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "QuotaLimit": {
        "oneOf": [
          {
            "type": "integer",
            "minimum": 0
          },
          {
            "type": "string",
            "enum": [
              "unlimited"
            ]
          }
        ]
      },
      "BillingPublicFeatures": {
        "type": "object",
        "required": [
          "customHeaders",
          "urlGroups",
          "schedules",
          "webhooks",
          "workflows",
          "memory",
          "events",
          "files",
          "semanticCache",
          "sessions",
          "actions",
          "approvals",
          "budgets",
          "analytics",
          "prioritySupport",
          "sla",
          "dedicatedSupport"
        ],
        "properties": {
          "protectedProduction": {
            "type": "boolean"
          },
          "controlledPromotion": {
            "type": "boolean"
          },
          "customHeaders": {
            "type": "boolean"
          },
          "urlGroups": {
            "type": "boolean"
          },
          "schedules": {
            "type": "boolean"
          },
          "webhooks": {
            "type": "boolean"
          },
          "workflows": {
            "type": "boolean"
          },
          "memory": {
            "type": "boolean"
          },
          "events": {
            "type": "boolean"
          },
          "files": {
            "type": "boolean"
          },
          "semanticCache": {
            "type": "boolean"
          },
          "sessions": {
            "type": "boolean"
          },
          "actions": {
            "type": "boolean"
          },
          "approvals": {
            "type": "boolean"
          },
          "budgets": {
            "type": "boolean"
          },
          "analytics": {
            "type": "boolean"
          },
          "prioritySupport": {
            "type": "boolean"
          },
          "sla": {
            "type": "boolean"
          },
          "dedicatedSupport": {
            "type": "boolean"
          },
          "teamFeatures": {
            "type": "boolean",
            "description": "SSO, SCIM directory sync, audit streaming, secret stores and roles per environment: Team and Enterprise."
          }
        }
      },
      "BillingRawPricing": {
        "type": "object",
        "description": "Machine-readable pricing values in cents unless the field says otherwise.",
        "required": [
          "monthlyFee",
          "perMessageCost",
          "includedMessages",
          "bandwidthOverageCost",
          "perMemoryOperationCost",
          "perEmbeddingTokenCost",
          "perLlmTokenCost",
          "perRerankOpCost",
          "perMemoryStorageMbCost",
          "perEventPublishCost",
          "perFileStorageMbCost",
          "perCacheLookupCost",
          "perActionInvokeCost"
        ],
        "properties": {
          "monthlyFee": {
            "type": "number",
            "minimum": 0
          },
          "yearlyFee": {
            "type": "number",
            "minimum": 0,
            "description": "A year paid up front",
            "in cents. 0 where the plan has no yearly price.": null
          },
          "perMessageCost": {
            "type": "number",
            "minimum": 0
          },
          "includedMessages": {
            "type": "integer",
            "minimum": 0
          },
          "bandwidthOverageCost": {
            "type": "number",
            "minimum": 0
          },
          "perMemoryOperationCost": {
            "type": "number",
            "minimum": 0
          },
          "perEmbeddingTokenCost": {
            "type": "number",
            "minimum": 0
          },
          "perLlmTokenCost": {
            "type": "number",
            "minimum": 0
          },
          "perRerankOpCost": {
            "type": "number",
            "minimum": 0
          },
          "perMemoryStorageMbCost": {
            "type": "number",
            "minimum": 0
          },
          "perEventPublishCost": {
            "type": "number",
            "minimum": 0
          },
          "perFileStorageMbCost": {
            "type": "number",
            "minimum": 0
          },
          "perCacheLookupCost": {
            "type": "number",
            "minimum": 0
          },
          "perActionInvokeCost": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "WorkspaceBillingBudget": {
        "type": "object",
        "required": [
          "maxOverageCents",
          "enabled"
        ],
        "properties": {
          "maxOverageCents": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100000000
          },
          "alertThresholds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "default": [
              50,
              75,
              90,
              100
            ]
          },
          "behaviourAtMax": {
            "type": "string",
            "enum": [
              "alert_only"
            ],
            "default": "alert_only"
          },
          "enabled": {
            "type": "boolean"
          }
        }
      },
      "WorkspaceBillingBudgetResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/WorkspaceBillingBudget"
          }
        }
      },
      "BillingUsagePolicy": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "kind",
              "capUnits"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "hard-cap"
                ]
              },
              "capUnits": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "Governed actions on a paid plan. Refused at graceCapUnits, the allowance plus 10%; action packs add to it. Never billed per unit.",
            "required": [
              "kind",
              "includedUnits",
              "graceCapUnits"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "included-with-grace"
                ]
              },
              "includedUnits": {
                "type": "integer",
                "minimum": 0
              },
              "graceCapUnits": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          {
            "type": "object",
            "description": "No plan. Actions answer 402 PAYMENT_REQUIRED.",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "payment-required"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "unlimited"
                ]
              }
            }
          }
        ]
      },
      "BillingUsagePolicies": {
        "type": "object",
        "properties": {
          "actionInvokes": {
            "$ref": "#/components/schemas/BillingUsagePolicy"
          },
          "messages": {
            "$ref": "#/components/schemas/BillingUsagePolicy"
          },
          "storage": {
            "$ref": "#/components/schemas/BillingUsagePolicy"
          },
          "bandwidth": {
            "$ref": "#/components/schemas/BillingUsagePolicy"
          }
        }
      },
      "BillingUsageAllowance": {
        "type": "object",
        "properties": {
          "includedUnits": {
            "type": "integer",
            "nullable": true,
            "minimum": 0
          },
          "graceCapUnits": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Where usage is refused. The allowance plus 10% for governed actions on a paid plan."
          },
          "usedUnits": {
            "type": "integer",
            "minimum": 0
          },
          "overageUnits": {
            "type": "integer",
            "minimum": 0
          },
          "reservedUnits": {
            "type": "integer",
            "minimum": 0
          },
          "projectedOverageCents": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "BillingAllowances": {
        "type": "object",
        "properties": {
          "actionInvokes": {
            "$ref": "#/components/schemas/BillingUsageAllowance"
          },
          "messages": {
            "$ref": "#/components/schemas/BillingUsageAllowance"
          },
          "storage": {
            "$ref": "#/components/schemas/BillingUsageAllowance"
          },
          "bandwidth": {
            "$ref": "#/components/schemas/BillingUsageAllowance"
          },
          "monthlyFeeCents": {
            "type": "number",
            "minimum": 0
          },
          "projectedOverageCents": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "BillingPlanLimits": {
        "type": "object",
        "required": [
          "maxMessagesPerDay",
          "maxMonthlyMessages",
          "maxMonthlyBandwidth",
          "maxRetries",
          "maxMessageSize",
          "maxHttpTimeout",
          "rateLimit",
          "maxBatchSize",
          "maxConcurrentDeliveries",
          "maxActiveSchedules",
          "maxActiveWorkflows",
          "maxActiveUrlGroups",
          "analyticsRetentionDays",
          "logRetentionDays",
          "features",
          "pricing"
        ],
        "properties": {
          "maxSeats": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxActions": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxMonthlyActionInvokes": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Governed actions per UTC month the plan includes. The enforced allowance, with `usagePolicy.actionInvokes`."
          },
          "auditRetentionMonths": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Months the plan keeps audit records before they are deleted. `unlimited` where the deployment sets no plan retention."
          },
          "maxEnvironments": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "traceRetentionDays": {
            "type": "integer"
          },
          "traceArchival": {
            "type": "boolean"
          },
          "usagePolicy": {
            "$ref": "#/components/schemas/BillingUsagePolicies"
          },
          "maxMessagesPerDay": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxMonthlyMessages": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxMonthlyBandwidth": {
            "type": "integer",
            "minimum": 0,
            "description": "Bytes."
          },
          "maxRetries": {
            "type": "integer",
            "minimum": 0
          },
          "maxMessageSize": {
            "type": "integer",
            "minimum": 0,
            "description": "Bytes."
          },
          "maxHttpTimeout": {
            "type": "integer",
            "minimum": 0,
            "description": "Milliseconds."
          },
          "rateLimit": {
            "type": "object",
            "required": [
              "requestsPerMinute",
              "requestsPerHour"
            ],
            "properties": {
              "requestsPerMinute": {
                "$ref": "#/components/schemas/QuotaLimit"
              },
              "requestsPerHour": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/QuotaLimit"
                  }
                ],
                "description": "API requests per UTC clock hour for the workspace, enforced with the minute limit."
              }
            }
          },
          "maxBatchSize": {
            "type": "integer",
            "minimum": 1
          },
          "maxConcurrentDeliveries": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxActiveSchedules": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxActiveWorkflows": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxActiveUrlGroups": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "analyticsRetentionDays": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "logRetentionDays": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "maxMonthlyAssistantReviews": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Anlyon Vigil (Beta) reviews per UTC month. A hard cap; at the cap approvals are reviewed without a suggestion."
          },
          "maxDailyAssistantAutoApprovals": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Approvals Anlyon Vigil may make per UTC day. A hard cap; at the cap requests go to a person."
          },
          "maxApprovalPoliciesPerEnvironment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Approval policies one environment may hold."
          },
          "maxMonthlyConditionDrafts": {
            "type": "integer",
            "minimum": 0,
            "description": "Plain-English policy condition drafts per workspace per UTC month. Complimentary during the beta."
          },
          "functionRuns": {
            "$ref": "#/components/schemas/FunctionRunLimits"
          },
          "features": {
            "$ref": "#/components/schemas/BillingPublicFeatures"
          },
          "pricing": {
            "$ref": "#/components/schemas/BillingRawPricing"
          }
        }
      },
      "BillingDisplayPricing": {
        "type": "object",
        "required": [
          "monthlyFee",
          "perMessageCost",
          "includedMessages",
          "bandwidthOverageCost",
          "includedBandwidth"
        ],
        "properties": {
          "monthlyFee": {
            "type": "number",
            "minimum": 0,
            "description": "Major currency units."
          },
          "perMessageCost": {
            "type": "number",
            "minimum": 0,
            "description": "Cents per message, retained for backward compatibility."
          },
          "includedMessages": {
            "type": "integer",
            "minimum": 0
          },
          "bandwidthOverageCost": {
            "type": "number",
            "minimum": 0,
            "description": "Major currency units per GB."
          },
          "includedBandwidth": {
            "type": "string",
            "description": "Human-readable byte count., example: 50 GB"
          }
        }
      },
      "BillingSubscriptionSummary": {
        "type": "object",
        "description": "Provider-safe subscription state; the billing provider's identifiers are never returned.",
        "required": [
          "status",
          "isCustomerConfigured",
          "hasSubscription",
          "trialEndsAt"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/BillingStatus"
          },
          "isCustomerConfigured": {
            "type": "boolean"
          },
          "hasSubscription": {
            "type": "boolean"
          },
          "trialEndsAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "BillingStatus": {
        "type": "string",
        "description": "none when the workspace has never subscribed.",
        "enum": [
          "none",
          "trialing",
          "active",
          "past_due",
          "canceled",
          "paused"
        ]
      },
      "BillingActionAllowance": {
        "type": "object",
        "description": "This usage month's governed actions. Actions run to graceCap (the allowance plus 10%, plus action packs) and are then refused with QUOTA_EXCEEDED; nothing past the allowance is charged.",
        "required": [
          "included",
          "credits",
          "graceCap",
          "used",
          "paymentRequired"
        ],
        "properties": {
          "included": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "The plan's allowance. Null when nothing caps actions (Enterprise)."
          },
          "credits": {
            "type": "integer",
            "minimum": 0,
            "description": "Action-pack actions this month can use, those already drawn for it plus what is left unexpired. Packs are valid for 12 months and used after the plan allowance."
          },
          "graceCap": {
            "type": "integer",
            "nullable": true,
            "minimum": 0,
            "description": "Where actions are refused. Null when uncapped."
          },
          "used": {
            "type": "integer",
            "minimum": 0,
            "description": "Actions run or reserved this month."
          },
          "paymentRequired": {
            "type": "boolean",
            "description": "True when the workspace has no plan and actions answer 402."
          }
        }
      },
      "BillingCatalogueEntry": {
        "type": "object",
        "required": [
          "id",
          "name",
          "monthlyPriceCents",
          "yearlyPriceCents",
          "currency",
          "trialDays",
          "purchasable",
          "teamFeatures",
          "allowances"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "starter",
              "production",
              "growth"
            ]
          },
          "name": {
            "type": "string",
            "example": "Pro"
          },
          "monthlyPriceCents": {
            "type": "integer",
            "example": 4900
          },
          "yearlyPriceCents": {
            "type": "integer",
            "example": 49000
          },
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ]
          },
          "trialDays": {
            "type": "integer",
            "example": 14
          },
          "purchasable": {
            "type": "boolean"
          },
          "teamFeatures": {
            "type": "boolean"
          },
          "allowances": {
            "type": "object",
            "required": [
              "actionsPerMonth",
              "actionGraceCap",
              "seats",
              "environments",
              "messagesPerMonth",
              "storageBytes",
              "egressBytesPerMonth"
            ],
            "properties": {
              "actionsPerMonth": {
                "type": "integer",
                "nullable": true,
                "example": 500000
              },
              "actionGraceCap": {
                "type": "integer",
                "nullable": true,
                "example": 550000
              },
              "seats": {
                "$ref": "#/components/schemas/QuotaLimit"
              },
              "environments": {
                "$ref": "#/components/schemas/QuotaLimit"
              },
              "messagesPerMonth": {
                "type": "integer",
                "nullable": true
              },
              "storageBytes": {
                "type": "integer",
                "nullable": true
              },
              "egressBytesPerMonth": {
                "type": "integer",
                "nullable": true
              }
            }
          }
        }
      },
      "BetaAllowances": {
        "type": "object",
        "description": "The Early Beta Access allowances, derived from the limits the API enforces. Null means the dimension has no fixed cap.",
        "required": [
          "actionExecutionsPerMonth",
          "durableMessagesPerMonth",
          "actionDefinitions",
          "seatsIncludingPendingInvitations",
          "environments",
          "combinedStorageBytes",
          "memoryStorageMb",
          "storedMemories",
          "egressBytesPerMonth",
          "traceRetentionDays",
          "memoryProcessingAllowanceCents"
        ],
        "properties": {
          "actionExecutionsPerMonth": {
            "type": "integer",
            "nullable": true,
            "example": 10000
          },
          "durableMessagesPerMonth": {
            "type": "integer",
            "nullable": true,
            "example": 25000
          },
          "actionDefinitions": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string",
                "enum": [
                  "unlimited"
                ]
              }
            ],
            "example": 10
          },
          "seatsIncludingPendingInvitations": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string",
                "enum": [
                  "unlimited"
                ]
              }
            ],
            "example": 3
          },
          "environments": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string",
                "enum": [
                  "unlimited"
                ]
              }
            ],
            "description": "Total environments a workspace may hold, of any kind.",
            "example": 3
          },
          "combinedStorageBytes": {
            "type": "integer",
            "nullable": true,
            "description": "Capacity in bytes. Does not reset monthly., example: 1073741824"
          },
          "memoryStorageMb": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string",
                "enum": [
                  "unlimited"
                ]
              }
            ],
            "description": "Counted within combined storage.",
            "example": 50
          },
          "storedMemories": {
            "oneOf": [
              {
                "type": "integer"
              },
              {
                "type": "string",
                "enum": [
                  "unlimited"
                ]
              }
            ],
            "example": 2000
          },
          "egressBytesPerMonth": {
            "type": "integer",
            "nullable": true,
            "example": 53687091200
          },
          "traceRetentionDays": {
            "type": "integer",
            "example": 14
          },
          "memoryProcessingAllowanceCents": {
            "type": "integer",
            "description": "Internal monthly processing allowance in cents. Not a token price., example: 25"
          }
        }
      },
      "BillingAccess": {
        "type": "object",
        "description": "How this workspace is served right now. Server-controlled and shared by enforcement, the console, and public pricing.",
        "required": [
          "mode",
          "betaAllowancesApply",
          "paidPlansAvailable",
          "betaAllowancesEndAt",
          "usageResetsAt",
          "overageBilling",
          "automaticCharges"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "early_beta",
              "standard"
            ],
            "example": "early_beta"
          },
          "betaAllowancesApply": {
            "type": "boolean",
            "example": true
          },
          "paidPlansAvailable": {
            "type": "boolean",
            "description": "Whether a paid plan can be bought right now. Purchase endpoints return PAID_PLANS_UNAVAILABLE when false., example: false"
          },
          "betaAllowancesEndAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Only set once normal pricing is open, and only while this workspace still has beta allowances. The end date is fixed once set."
          },
          "usageResetsAt": {
            "type": "string",
            "format": "date-time",
            "description": "The next UTC month boundary, when monthly allowances reset."
          },
          "overageBilling": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Early Beta Access never bills overage."
          },
          "automaticCharges": {
            "type": "boolean",
            "enum": [
              false
            ],
            "description": "Nothing is charged or upgraded automatically."
          }
        }
      },
      "BillingPlanDetailsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "plan",
              "displayName",
              "status",
              "interval",
              "trialEndsAt",
              "currentPeriodEnd",
              "cancelAtPeriodEnd",
              "pendingPlan",
              "trialAvailable",
              "provider",
              "limits",
              "features",
              "pricing",
              "subscription"
            ],
            "properties": {
              "access": {
                "$ref": "#/components/schemas/BillingAccess"
              },
              "betaAllowances": {
                "$ref": "#/components/schemas/BetaAllowances"
              },
              "plan": {
                "type": "string",
                "enum": [
                  "free",
                  "starter",
                  "paygo",
                  "enterprise",
                  "production",
                  "growth"
                ],
                "description": "The plan id. Display names: starter Starter, production Pro, growth Team, enterprise Enterprise, free no plan.",
                "example": "production"
              },
              "displayName": {
                "type": "string",
                "example": "Pro"
              },
              "status": {
                "$ref": "#/components/schemas/BillingStatus"
              },
              "interval": {
                "type": "string",
                "enum": [
                  "month",
                  "year"
                ],
                "nullable": true
              },
              "trialEndsAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "currentPeriodEnd": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "description": "When the paid period (or the trial) ends."
              },
              "cancelAtPeriodEnd": {
                "type": "boolean"
              },
              "graceEndsAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "description": "After a failed renewal, when the plan lapses unless the payment is fixed in the billing portal. Null otherwise."
              },
              "trialAvailable": {
                "type": "boolean",
                "description": "Whether a checkout now would start the 14-day trial. One trial per workspace and per person."
              },
              "provider": {
                "type": "string",
                "enum": [
                  "polar"
                ],
                "nullable": true,
                "description": "The billing provider. Null on a self-hosted edition."
              },
              "pendingPlan": {
                "type": "string",
                "nullable": true,
                "description": "Requested period-end target. Resource creation is restricted to this plan while the change is pending., example: free"
              },
              "limits": {
                "$ref": "#/components/schemas/BillingPlanLimits"
              },
              "features": {
                "$ref": "#/components/schemas/BillingPublicFeatures"
              },
              "pricing": {
                "$ref": "#/components/schemas/BillingDisplayPricing"
              },
              "subscription": {
                "$ref": "#/components/schemas/BillingSubscriptionSummary"
              }
            }
          }
        }
      },
      "BillingCurrentUsageResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "currentMonthMessages",
              "currentMonthBandwidth",
              "dailyMessages",
              "estimatedCost",
              "billingPeriodStart",
              "billingPeriodEnd",
              "usageResetDate",
              "actionAllowance"
            ],
            "properties": {
              "currentMonthMessages": {
                "type": "integer",
                "minimum": 0,
                "example": 5000
              },
              "currentMonthBandwidth": {
                "type": "integer",
                "minimum": 0,
                "description": "Bytes., example: 52428800"
              },
              "dailyMessages": {
                "type": "integer",
                "minimum": 0,
                "example": 120
              },
              "estimatedCost": {
                "type": "number",
                "minimum": 0,
                "description": "Estimated cost in major currency units., example: 0.05"
              },
              "billingPeriodStart": {
                "type": "string",
                "format": "date-time"
              },
              "billingPeriodEnd": {
                "type": "string",
                "format": "date-time"
              },
              "usageResetDate": {
                "type": "string",
                "format": "date-time"
              },
              "actionAllowance": {
                "$ref": "#/components/schemas/BillingActionAllowance"
              },
              "functionRuns": {
                "$ref": "#/components/schemas/FunctionRunUsage"
              }
            }
          }
        }
      },
      "FunctionRunLimits": {
        "type": "object",
        "description": "Hosted function runs a plan allows. A run's own action calls count as governed actions, not here.",
        "required": [
          "runsPerMonth",
          "concurrentRuns",
          "runStartsPerMinute"
        ],
        "properties": {
          "runsPerMonth": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Runs started in a UTC month."
          },
          "concurrentRuns": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Runs going at the same time across the workspace."
          },
          "runStartsPerMinute": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "description": "Runs started in any 60 seconds."
          }
        }
      },
      "FunctionRunUsage": {
        "type": "object",
        "description": "Hosted function runs this UTC month and running now, against the plan's limits.",
        "required": [
          "used",
          "running",
          "limits",
          "available"
        ],
        "properties": {
          "used": {
            "type": "integer",
            "minimum": 0,
            "example": 140
          },
          "running": {
            "type": "integer",
            "minimum": 0,
            "example": 1
          },
          "limits": {
            "$ref": "#/components/schemas/FunctionRunLimits"
          },
          "available": {
            "type": "boolean",
            "description": "Whether this deployment serves hosted functions yet."
          }
        }
      },
      "PlanCatalogueEntry": {
        "type": "object",
        "description": "Everything one plan includes or limits, read from the server's plan table. The console's comparison and the public pricing page show this list. Enterprise is a contract (`contract` true): every number its contract sets is null here, shown as \"Custom\".",
        "required": [
          "id",
          "name",
          "contract",
          "monthlyPriceCents",
          "yearlyPriceCents",
          "trialDays",
          "governedActionsPerMonth",
          "actionGraceRatio",
          "actionPacks",
          "seats",
          "environments",
          "storageBytes",
          "egressBytesPerMonth",
          "traceRetentionDays",
          "traceArchive",
          "requestsPerMinute",
          "requestsPerHour",
          "auditRetentionMonths",
          "approvalPoliciesPerEnvironment",
          "vigilReviewsPerMonth",
          "vigilAutoApprovalsPerDay",
          "protectedProduction",
          "controlledPromotion",
          "teamFeatures",
          "support",
          "functionRuns"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "starter",
              "production",
              "growth",
              "enterprise"
            ],
            "example": "production"
          },
          "name": {
            "type": "string",
            "example": "Pro"
          },
          "contract": {
            "type": "boolean",
            "description": "An annual contract sets the price and the limits."
          },
          "monthlyPriceCents": {
            "type": "integer",
            "nullable": true,
            "example": 4900
          },
          "yearlyPriceCents": {
            "type": "integer",
            "nullable": true,
            "example": 49000
          },
          "trialDays": {
            "type": "integer",
            "nullable": true,
            "example": 14
          },
          "governedActionsPerMonth": {
            "type": "integer",
            "nullable": true,
            "description": "Null where a contract sets it.",
            "example": 500000
          },
          "actionGraceRatio": {
            "type": "number",
            "nullable": true,
            "example": 0.1
          },
          "actionPacks": {
            "type": "boolean",
            "description": "Whether prepaid action packs can be bought on this plan."
          },
          "seats": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "nullable": true,
            "description": "Null where a contract sets it."
          },
          "environments": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "nullable": true,
            "description": "Null where a contract sets it."
          },
          "storageBytes": {
            "type": "integer",
            "nullable": true,
            "example": 5368709120
          },
          "egressBytesPerMonth": {
            "type": "integer",
            "nullable": true,
            "example": 53687091200
          },
          "traceRetentionDays": {
            "type": "integer",
            "nullable": true,
            "description": "Null where a contract sets it.",
            "example": 90
          },
          "traceArchive": {
            "type": "boolean"
          },
          "requestsPerMinute": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "nullable": true,
            "description": "API requests per minute for the workspace. Null where a contract sets it."
          },
          "requestsPerHour": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "nullable": true,
            "description": "API requests per UTC clock hour for the workspace. Null where a contract sets it."
          },
          "auditRetentionMonths": {
            "type": "integer",
            "nullable": true,
            "description": "Months audit records are kept before they are deleted. Null where a contract sets it.",
            "example": 6
          },
          "approvalPoliciesPerEnvironment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "nullable": true,
            "description": "Null where a contract sets it."
          },
          "vigilReviewsPerMonth": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "nullable": true,
            "description": "Null where a contract sets it."
          },
          "vigilAutoApprovalsPerDay": {
            "allOf": [
              {
                "$ref": "#/components/schemas/QuotaLimit"
              }
            ],
            "nullable": true,
            "description": "Null where a contract sets it."
          },
          "protectedProduction": {
            "type": "boolean"
          },
          "controlledPromotion": {
            "type": "boolean"
          },
          "teamFeatures": {
            "type": "boolean",
            "description": "Single sign-on, SCIM, audit streaming, your own vault and roles per environment."
          },
          "support": {
            "type": "string",
            "enum": [
              "standard",
              "priority",
              "dedicated"
            ]
          },
          "functionRuns": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionRunLimits"
              }
            ],
            "nullable": true,
            "description": "Null where a contract sets it."
          }
        }
      },
      "ActionPackTerms": {
        "type": "object",
        "required": [
          "units",
          "priceCents",
          "validMonths"
        ],
        "properties": {
          "units": {
            "type": "integer",
            "example": 100000
          },
          "priceCents": {
            "type": "integer",
            "example": 1000
          },
          "validMonths": {
            "type": "integer",
            "example": 12
          }
        }
      },
      "BillingPlanComparison": {
        "type": "object",
        "required": [
          "name",
          "features"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "limits": {
            "$ref": "#/components/schemas/BillingPlanLimits"
          },
          "pricing": {
            "$ref": "#/components/schemas/BillingRawPricing"
          },
          "usagePolicy": {
            "$ref": "#/components/schemas/BillingUsagePolicies"
          },
          "purchasable": {
            "type": "boolean"
          },
          "features": {
            "type": "object",
            "description": "Human-readable plan comparison keyed by display label.",
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "string"
                },
                {
                  "type": "number"
                }
              ]
            }
          }
        }
      },
      "BillingPlanListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "catalogue",
              "intervals",
              "actionPack",
              "actionGraceRatio",
              "enterprise",
              "plans",
              "currentPlan"
            ],
            "properties": {
              "access": {
                "type": "object",
                "required": [
                  "mode",
                  "paidPlansAvailable"
                ],
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "early_beta",
                      "standard"
                    ]
                  },
                  "paidPlansAvailable": {
                    "type": "boolean"
                  }
                }
              },
              "betaAllowances": {
                "$ref": "#/components/schemas/BetaAllowances"
              },
              "catalogue": {
                "type": "array",
                "description": "The plans checkout sells, in order, read from the server's plan table.",
                "items": {
                  "$ref": "#/components/schemas/BillingCatalogueEntry"
                }
              },
              "intervals": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "month",
                    "year"
                  ]
                }
              },
              "actionPack": {
                "type": "object",
                "required": [
                  "units",
                  "priceCents",
                  "maxQuantity",
                  "currency"
                ],
                "properties": {
                  "units": {
                    "type": "integer",
                    "example": 100000
                  },
                  "priceCents": {
                    "type": "integer",
                    "example": 1000
                  },
                  "maxQuantity": {
                    "type": "integer",
                    "example": 10
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "USD"
                    ]
                  }
                }
              },
              "actionGraceRatio": {
                "type": "number",
                "example": 0.1,
                "description": "The buffer past a paid plan's action allowance before actions are refused."
              },
              "enterprise": {
                "type": "object",
                "required": [
                  "name",
                  "contact",
                  "teamFeatures"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Enterprise"
                  },
                  "contact": {
                    "type": "string",
                    "format": "email"
                  },
                  "teamFeatures": {
                    "type": "boolean",
                    "enum": [
                      true
                    ]
                  }
                }
              },
              "plans": {
                "type": "object",
                "required": [
                  "free",
                  "starter",
                  "production",
                  "growth",
                  "enterprise"
                ],
                "properties": {
                  "free": {
                    "$ref": "#/components/schemas/BillingPlanComparison"
                  },
                  "starter": {
                    "$ref": "#/components/schemas/BillingPlanComparison"
                  },
                  "production": {
                    "$ref": "#/components/schemas/BillingPlanComparison"
                  },
                  "growth": {
                    "$ref": "#/components/schemas/BillingPlanComparison"
                  },
                  "enterprise": {
                    "$ref": "#/components/schemas/BillingPlanComparison"
                  }
                }
              },
              "currentPlan": {
                "type": "string",
                "enum": [
                  "free",
                  "starter",
                  "paygo",
                  "enterprise",
                  "production",
                  "growth"
                ],
                "nullable": true
              },
              "planCatalogue": {
                "type": "array",
                "description": "Everything each plan includes or limits. The same list `GET /api/v2/public/pricing-policy` publishes.",
                "items": {
                  "$ref": "#/components/schemas/PlanCatalogueEntry"
                }
              },
              "actionPackTerms": {
                "$ref": "#/components/schemas/ActionPackTerms"
              },
              "hostedFunctions": {
                "type": "object",
                "required": [
                  "available"
                ],
                "properties": {
                  "available": {
                    "type": "boolean",
                    "description": "Whether this deployment serves hosted functions yet."
                  }
                }
              }
            }
          }
        }
      },
      "QuotaDimension": {
        "type": "object",
        "required": [
          "used",
          "limit",
          "percentage"
        ],
        "properties": {
          "used": {
            "type": "integer",
            "minimum": 0
          },
          "limit": {
            "$ref": "#/components/schemas/QuotaLimit"
          },
          "percentage": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "BillingQuotaResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "plan",
              "daily",
              "monthly",
              "bandwidth"
            ],
            "properties": {
              "memoryProcessing": {
                "$ref": "#/components/schemas/MemoryProcessingStatus"
              },
              "allowances": {
                "$ref": "#/components/schemas/BillingAllowances"
              },
              "actionInvokes": {
                "$ref": "#/components/schemas/BillingUsageAllowance"
              },
              "actionAllowance": {
                "$ref": "#/components/schemas/BillingActionAllowance"
              },
              "functionRuns": {
                "$ref": "#/components/schemas/FunctionRunUsage"
              },
              "projectedOverageCents": {
                "type": "number",
                "minimum": 0
              },
              "plan": {
                "type": "string",
                "enum": [
                  "free",
                  "starter",
                  "paygo",
                  "enterprise",
                  "production",
                  "growth"
                ]
              },
              "daily": {
                "$ref": "#/components/schemas/QuotaDimension"
              },
              "monthly": {
                "$ref": "#/components/schemas/QuotaDimension"
              },
              "bandwidth": {
                "$ref": "#/components/schemas/QuotaDimension"
              }
            }
          }
        }
      },
      "MemoryProcessingStatus": {
        "type": "object",
        "description": "How much of this month's memory-processing allowance is used. A state and a rounded percentage only: the provider-cost accounting behind it (per-call bounds, reservations, retries) is internal and is not exposed, and this is not a token meter or a price.",
        "required": [
          "status",
          "percentUsed",
          "resetsAt"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "available",
              "low",
              "exhausted"
            ],
            "description": "`low` from 80% used; `exhausted` at 100%, when new memory processing pauses until the reset. Stored memories stay readable."
          },
          "percentUsed": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Rounded down."
          },
          "resetsAt": {
            "type": "string",
            "format": "date-time",
            "description": "The next 00:00 UTC on the first of the month."
          }
        }
      },
      "BillingUsageDay": {
        "type": "object",
        "required": [
          "date",
          "messagesPublished",
          "messagesDelivered",
          "messagesFailed",
          "schedulesExecuted"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "messagesPublished": {
            "type": "integer",
            "minimum": 0
          },
          "messagesDelivered": {
            "type": "integer",
            "minimum": 0
          },
          "messagesFailed": {
            "type": "integer",
            "minimum": 0
          },
          "schedulesExecuted": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "BillingUsageTotals": {
        "type": "object",
        "required": [
          "messagesPublished",
          "messagesDelivered",
          "messagesFailed",
          "schedulesExecuted"
        ],
        "properties": {
          "messagesPublished": {
            "type": "integer",
            "minimum": 0
          },
          "messagesDelivered": {
            "type": "integer",
            "minimum": 0
          },
          "messagesFailed": {
            "type": "integer",
            "minimum": 0
          },
          "schedulesExecuted": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "BillingUsageHistoryResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "period",
              "history",
              "totals"
            ],
            "properties": {
              "period": {
                "type": "object",
                "required": [
                  "days",
                  "startDate",
                  "endDate"
                ],
                "properties": {
                  "days": {
                    "type": "integer"
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date"
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date"
                  }
                }
              },
              "history": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BillingUsageDay"
                }
              },
              "totals": {
                "$ref": "#/components/schemas/BillingUsageTotals"
              }
            }
          }
        }
      },
      "BillingCostEstimateResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "plan",
              "currentMonth",
              "breakdown"
            ],
            "properties": {
              "plan": {
                "type": "string",
                "enum": [
                  "free",
                  "starter",
                  "paygo",
                  "enterprise",
                  "production",
                  "growth"
                ]
              },
              "currentMonth": {
                "type": "object",
                "required": [
                  "messagesUsed",
                  "bandwidthUsed",
                  "estimatedCost",
                  "currency"
                ],
                "properties": {
                  "messagesUsed": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "bandwidthUsed": {
                    "type": "string",
                    "description": "Human-readable byte count."
                  },
                  "estimatedCost": {
                    "type": "number",
                    "minimum": 0
                  },
                  "currency": {
                    "type": "string",
                    "enum": [
                      "USD"
                    ]
                  }
                }
              },
              "breakdown": {
                "type": "object",
                "required": [
                  "baseFee",
                  "messageCost",
                  "bandwidthCost",
                  "perMessageRate",
                  "perGBRate"
                ],
                "properties": {
                  "baseFee": {
                    "type": "number",
                    "minimum": 0
                  },
                  "messageCost": {
                    "type": "number",
                    "minimum": 0
                  },
                  "bandwidthCost": {
                    "type": "number",
                    "minimum": 0
                  },
                  "perMessageRate": {
                    "type": "number",
                    "minimum": 0
                  },
                  "perGBRate": {
                    "type": "number",
                    "minimum": 0
                  }
                }
              }
            }
          }
        }
      },
      "BillingInvoice": {
        "type": "object",
        "required": [
          "id",
          "stripeInvoiceId",
          "amountDue",
          "amountPaid",
          "currency",
          "status",
          "period",
          "urls",
          "paidAt",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "stripeInvoiceId": {
            "type": "string",
            "pattern": "^in_"
          },
          "amountDue": {
            "type": "number",
            "minimum": 0,
            "description": "Major currency units."
          },
          "amountPaid": {
            "type": "number",
            "minimum": 0,
            "description": "Major currency units."
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "open",
              "paid",
              "void",
              "uncollectible"
            ]
          },
          "period": {
            "type": "object",
            "required": [
              "start",
              "end"
            ],
            "properties": {
              "start": {
                "type": "string",
                "format": "date-time"
              },
              "end": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "urls": {
            "type": "object",
            "required": [
              "invoice",
              "pdf"
            ],
            "properties": {
              "invoice": {
                "type": "string",
                "format": "uri",
                "nullable": true
              },
              "pdf": {
                "type": "string",
                "format": "uri",
                "nullable": true
              }
            }
          },
          "paidAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "BillingInvoiceListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "invoices",
              "total",
              "portalAvailable"
            ],
            "properties": {
              "invoices": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BillingInvoice"
                }
              },
              "total": {
                "type": "integer",
                "minimum": 0,
                "description": "Number returned, not a count of all stored invoices."
              },
              "portalAvailable": {
                "type": "boolean",
                "description": "Whether POST /api/v2/billing/portal has a portal for this workspace, where Polar keeps its invoices."
              }
            }
          }
        }
      },
      "AnalyticsCharts": {
        "type": "object",
        "description": "Chart-library-ready projections of the canonical data payload.",
        "additionalProperties": true
      },
      "MessageAnalyticsData": {
        "type": "object",
        "required": [
          "published",
          "delivered",
          "failed",
          "pending",
          "successRate",
          "averageDeliveryTime"
        ],
        "properties": {
          "published": {
            "type": "integer",
            "minimum": 0,
            "example": 1000
          },
          "delivered": {
            "type": "integer",
            "minimum": 0,
            "example": 950
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "example": 30
          },
          "pending": {
            "type": "integer",
            "minimum": 0,
            "example": 20
          },
          "successRate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "example": 95
          },
          "averageDeliveryTime": {
            "type": "integer",
            "minimum": 0,
            "description": "Average delivery time in milliseconds., example: 142"
          }
        }
      },
      "MessageAnalyticsResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/MessageAnalyticsData"
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "MessageTimeSeriesPoint": {
        "type": "object",
        "required": [
          "period",
          "published",
          "delivered",
          "failed"
        ],
        "properties": {
          "period": {
            "type": "string",
            "description": "Bucket label formatted for the requested granularity., example: 2026-W29"
          },
          "published": {
            "type": "integer",
            "minimum": 0,
            "example": 120
          },
          "delivered": {
            "type": "integer",
            "minimum": 0,
            "example": 116
          },
          "failed": {
            "type": "integer",
            "minimum": 0,
            "example": 4
          }
        }
      },
      "MessageTimeSeriesResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageTimeSeriesPoint"
            }
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "TopUrlAnalytics": {
        "type": "object",
        "required": [
          "url",
          "messageCount",
          "successCount",
          "failureCount",
          "successRate"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/webhook"
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0,
            "example": 500
          },
          "successCount": {
            "type": "integer",
            "minimum": 0,
            "example": 490
          },
          "failureCount": {
            "type": "integer",
            "minimum": 0,
            "example": 10
          },
          "successRate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "example": 98
          }
        }
      },
      "TopUrlsResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TopUrlAnalytics"
            }
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "AnalyticsUsage": {
        "type": "object",
        "required": [
          "date",
          "messagesPublished",
          "messagesDelivered",
          "messagesFailed",
          "schedulesExecuted",
          "bandwidthBytes",
          "memoryOperations",
          "embeddingTokens",
          "llmTokens",
          "rerankOperations",
          "memoryStorageBytes",
          "eventPublishes",
          "fileStorageBytes",
          "cacheLookups",
          "cacheHits",
          "actionInvokes"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "example": "2026-07-13"
          },
          "messagesPublished": {
            "type": "integer",
            "minimum": 0,
            "example": 500
          },
          "messagesDelivered": {
            "type": "integer",
            "minimum": 0,
            "example": 480
          },
          "messagesFailed": {
            "type": "integer",
            "minimum": 0,
            "example": 20
          },
          "schedulesExecuted": {
            "type": "integer",
            "minimum": 0,
            "example": 12
          },
          "bandwidthBytes": {
            "type": "integer",
            "minimum": 0,
            "example": 1048576
          },
          "memoryOperations": {
            "type": "integer",
            "minimum": 0,
            "example": 240
          },
          "embeddingTokens": {
            "type": "integer",
            "minimum": 0,
            "example": 12000
          },
          "llmTokens": {
            "type": "integer",
            "minimum": 0,
            "example": 8400
          },
          "rerankOperations": {
            "type": "integer",
            "minimum": 0,
            "example": 32
          },
          "memoryStorageBytes": {
            "type": "integer",
            "minimum": 0,
            "example": 2097152
          },
          "eventPublishes": {
            "type": "integer",
            "minimum": 0,
            "example": 76
          },
          "fileStorageBytes": {
            "type": "integer",
            "minimum": 0,
            "example": 4194304
          },
          "cacheLookups": {
            "type": "integer",
            "minimum": 0,
            "example": 920
          },
          "cacheHits": {
            "type": "integer",
            "minimum": 0,
            "example": 811
          },
          "actionInvokes": {
            "type": "integer",
            "minimum": 0,
            "example": 44
          }
        }
      },
      "AnalyticsRangeMetadata": {
        "type": "object",
        "required": [
          "startDate",
          "endDate",
          "granularity",
          "truncated",
          "retentionDays"
        ],
        "properties": {
          "startDate": {
            "type": "string",
            "format": "date-time"
          },
          "endDate": {
            "type": "string",
            "format": "date-time"
          },
          "granularity": {
            "type": "string",
            "enum": [
              "hour",
              "day",
              "week",
              "month"
            ]
          },
          "truncated": {
            "type": "boolean",
            "description": "True when the requested range exceeded plan retention."
          },
          "retentionDays": {
            "type": "integer",
            "minimum": 1,
            "nullable": true,
            "description": "Null means unlimited retention."
          }
        }
      },
      "AnalyticsScopeMetadata": {
        "type": "object",
        "required": [
          "workspaceId",
          "environmentId"
        ],
        "properties": {
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "environmentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        }
      },
      "ProductAnalyticsMetadata": {
        "type": "object",
        "required": [
          "range",
          "scope"
        ],
        "properties": {
          "range": {
            "$ref": "#/components/schemas/AnalyticsRangeMetadata"
          },
          "scope": {
            "$ref": "#/components/schemas/AnalyticsScopeMetadata"
          }
        }
      },
      "AnalyticsOverviewData": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProductAnalyticsMetadata"
          },
          {
            "type": "object",
            "required": [
              "summary",
              "usage",
              "series",
              "attention"
            ],
            "properties": {
              "summary": {
                "type": "object",
                "required": [
                  "agentRuns",
                  "agentRunSuccessRate",
                  "messagesDelivered",
                  "messageSuccessRate",
                  "workflowRuns",
                  "workflowSuccessRate",
                  "actionInvocations",
                  "actionSuccessRate",
                  "pendingApprovals"
                ],
                "properties": {
                  "agentRuns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "agentRunSuccessRate": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "messagesDelivered": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "messageSuccessRate": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "workflowRuns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "workflowSuccessRate": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "actionInvocations": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "actionSuccessRate": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "pendingApprovals": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              },
              "usage": {
                "type": "object",
                "additionalProperties": true
              },
              "series": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AnalyticsUsage"
                }
              },
              "attention": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "product",
                    "label",
                    "count",
                    "href"
                  ],
                  "properties": {
                    "product": {
                      "type": "string",
                      "enum": [
                        "agents",
                        "delivery",
                        "workflows",
                        "actions",
                        "approvals"
                      ]
                    },
                    "label": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "href": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "AgentAnalyticsData": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProductAnalyticsMetadata"
          },
          {
            "type": "object",
            "required": [
              "summary",
              "series",
              "topAgents",
              "topVersions"
            ],
            "properties": {
              "summary": {
                "type": "object",
                "required": [
                  "totalRuns",
                  "runningRuns",
                  "succeededRuns",
                  "failedRuns",
                  "cancelledRuns",
                  "successRate",
                  "p50DurationMs",
                  "p95DurationMs",
                  "totalTokens",
                  "totalCost"
                ],
                "properties": {
                  "totalRuns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "runningRuns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "succeededRuns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "failedRuns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "cancelledRuns": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "successRate": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "p50DurationMs": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "p95DurationMs": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "totalTokens": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "totalCost": {
                    "type": "number",
                    "minimum": 0
                  }
                }
              },
              "series": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "topAgents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "topVersions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        ]
      },
      "TrustControlAnalyticsData": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProductAnalyticsMetadata"
          },
          {
            "type": "object",
            "required": [
              "actions",
              "approvals"
            ],
            "properties": {
              "actions": {
                "type": "object",
                "additionalProperties": true
              },
              "approvals": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        ]
      },
      "DeliveryAnalyticsData": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProductAnalyticsMetadata"
          },
          {
            "type": "object",
            "required": [
              "messages",
              "messageSeries",
              "bandwidthBytes",
              "schedules",
              "workflows",
              "topUrls",
              "errors"
            ],
            "properties": {
              "messages": {
                "$ref": "#/components/schemas/MessageAnalyticsData"
              },
              "messageSeries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MessageTimeSeriesPoint"
                }
              },
              "bandwidthBytes": {
                "type": "integer",
                "minimum": 0
              },
              "schedules": {
                "type": "object",
                "additionalProperties": true
              },
              "workflows": {
                "type": "object",
                "additionalProperties": true
              },
              "topUrls": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TopUrlAnalytics"
                }
              },
              "errors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ErrorDistributionItem"
                }
              }
            }
          }
        ]
      },
      "AnalyticsOverviewResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/AnalyticsOverviewData"
          }
        }
      },
      "AgentAnalyticsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/AgentAnalyticsData"
          }
        }
      },
      "TrustControlAnalyticsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/TrustControlAnalyticsData"
          }
        }
      },
      "DeliveryAnalyticsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/DeliveryAnalyticsData"
          }
        }
      },
      "CurrentAnalyticsUsageResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/AnalyticsUsage"
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "AnalyticsUsageHistoryResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnalyticsUsage"
            }
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "ScheduleAnalytics": {
        "type": "object",
        "required": [
          "totalSchedules",
          "activeSchedules",
          "pausedSchedules"
        ],
        "properties": {
          "totalSchedules": {
            "type": "integer",
            "minimum": 0
          },
          "activeSchedules": {
            "type": "integer",
            "minimum": 0
          },
          "pausedSchedules": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ScheduleAnalyticsResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ScheduleAnalytics"
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "RecentScheduleExecution": {
        "type": "object",
        "required": [
          "scheduleId",
          "name",
          "lastRunAt",
          "lastStatus",
          "nextRunAt"
        ],
        "properties": {
          "scheduleId": {
            "type": "string",
            "pattern": "^sch_"
          },
          "name": {
            "type": "string"
          },
          "lastRunAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastStatus": {
            "type": "string",
            "nullable": true
          },
          "nextRunAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "RecentScheduleExecutionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RecentScheduleExecution"
            }
          }
        }
      },
      "ErrorDistributionItem": {
        "type": "object",
        "required": [
          "errorMessage",
          "count"
        ],
        "properties": {
          "errorMessage": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ErrorDistributionResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ErrorDistributionItem"
            }
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "OnboardingStep": {
        "type": "object",
        "required": [
          "id",
          "completed",
          "label"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "api_key",
              "first_invocation"
            ]
          },
          "completed": {
            "type": "boolean"
          },
          "label": {
            "type": "string"
          }
        }
      },
      "OnboardingStatus": {
        "type": "object",
        "required": [
          "isOnboarded",
          "hasApiKey",
          "hasInvocations",
          "totalInvocations",
          "steps",
          "completedSteps",
          "totalSteps",
          "completionPercentage"
        ],
        "properties": {
          "isOnboarded": {
            "type": "boolean",
            "description": "True after the workspace has invoked its first action, whatever the outcome."
          },
          "hasApiKey": {
            "type": "boolean"
          },
          "hasInvocations": {
            "type": "boolean"
          },
          "totalInvocations": {
            "type": "integer",
            "minimum": 0,
            "description": "Action invocations recorded for the workspace."
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OnboardingStep"
            }
          },
          "completedSteps": {
            "type": "integer",
            "minimum": 0
          },
          "totalSteps": {
            "type": "integer",
            "minimum": 0
          },
          "completionPercentage": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          }
        }
      },
      "OnboardingStatusResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "charts"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/OnboardingStatus"
          },
          "charts": {
            "$ref": "#/components/schemas/AnalyticsCharts"
          }
        }
      },
      "EventTopicName": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100,
        "pattern": "^[a-zA-Z0-9_-]+$"
      },
      "EventTypePattern": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200,
        "pattern": "^(\\*|[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)*(\\.\\*)?)$",
        "example": "memory.*"
      },
      "CreateEventTopicRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "$ref": "#/components/schemas/EventTopicName"
          },
          "description": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "UpdateEventTopicRequest": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "name": {
            "$ref": "#/components/schemas/EventTopicName"
          },
          "description": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "EventTopic": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "isReserved",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^top_"
          },
          "name": {
            "$ref": "#/components/schemas/EventTopicName"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "isReserved": {
            "type": "boolean",
            "description": "True only for the non-publishable, non-deletable `anlyon` platform topic."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventTopicResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EventTopic"
          }
        }
      },
      "EventTopicListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventTopic"
            }
          }
        }
      },
      "EventHeaders": {
        "type": "object",
        "description": "Custom headers sent with every delivery of the subscription. The same rules as a message's headers: a credential header (Authorization, Cookie, an API-key header and the like) must be a `{{secret:NAME}}` reference, which needs `secrets:read`; names reserved for delivery signing, and Host, Content-Length, Transfer-Encoding and connection headers, are refused; a name is a token and a value has no line breaks. Credential headers are redacted when a subscription is read.",
        "additionalProperties": {
          "type": "string",
          "maxLength": 8192
        }
      },
      "CreateEventSubscriptionRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "eventTypes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "default": [
              "*"
            ],
            "items": {
              "$ref": "#/components/schemas/EventTypePattern"
            }
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "generateSecret": {
            "type": "boolean",
            "default": false,
            "description": "Generate a per-subscription webhook signing secret and return it once."
          },
          "headers": {
            "$ref": "#/components/schemas/EventHeaders"
          }
        }
      },
      "UpdateEventSubscriptionRequest": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "maxLength": 2048
          },
          "eventTypes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/EventTypePattern"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "headers": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EventHeaders"
              }
            ],
            "nullable": true,
            "description": "Set to null to remove all custom delivery headers."
          }
        }
      },
      "EventSubscription": {
        "type": "object",
        "required": [
          "id",
          "url",
          "eventTypes",
          "enabled",
          "hasCustomSecret",
          "headers",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^sub_"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "eventTypes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventTypePattern"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "hasCustomSecret": {
            "type": "boolean"
          },
          "headers": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EventHeaders"
              }
            ],
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventSubscriptionCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EventSubscription"
          },
          {
            "type": "object",
            "properties": {
              "secret": {
                "type": "string",
                "x-sensitive": true,
                "description": "Plaintext signing secret, present only when `generateSecret` was true and never returned again."
              }
            }
          }
        ]
      },
      "EventSubscriptionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EventSubscription"
          }
        }
      },
      "EventSubscriptionCreatedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EventSubscriptionCreated"
          }
        }
      },
      "EventSubscriptionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventSubscription"
            }
          }
        }
      },
      "EventSubscriptionSecretResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "id",
              "secret"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^sub_"
              },
              "secret": {
                "type": "string",
                "x-sensitive": true,
                "description": "Newly rotated plaintext signing secret. This value is returned exactly once."
              }
            }
          }
        }
      },
      "PublishEventRequest": {
        "type": "object",
        "required": [
          "topic",
          "type"
        ],
        "properties": {
          "topic": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Public topic ID or name."
          },
          "type": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "^[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)*$",
            "example": "order.completed"
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "default": {}
          },
          "idempotencyKey": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "description": "Durable deduplication key scoped to the workspace and topic."
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Existing run in this API key environment for event-delivery spans."
          },
          "parentSpanId": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional parent span within runId."
          }
        }
      },
      "EventPublishResult": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^evt_"
          },
          "status": {
            "type": "string",
            "enum": [
              "received",
              "fanned_out",
              "no_subscribers"
            ]
          },
          "deduplicated": {
            "type": "boolean",
            "description": "True when a prior event with the same body idempotency key was returned."
          }
        }
      },
      "EventPublishResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EventPublishResult"
          }
        }
      },
      "Event": {
        "type": "object",
        "required": [
          "id",
          "topic",
          "type",
          "data",
          "status",
          "subscriptionCount",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^evt_"
          },
          "topic": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          },
          "status": {
            "type": "string",
            "enum": [
              "received",
              "fanned_out",
              "no_subscribers"
            ],
            "description": "`received` means the fan-out has not finished: either it has not started, or a\ndelivery could not be enqueued and the event is waiting to be retried. It becomes\n`fanned_out` once every matching subscription has a delivery — or, if some cannot\nbe enqueued after repeated attempts, once the event is finished with the count it\nactually achieved. `subscriptionCount` is therefore what was delivered, which can\nbe fewer than the subscriptions that matched.\n"
          },
          "subscriptionCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Deliveries enqueued for this event. Compare with your subscription count for that topic."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventDelivery": {
        "type": "object",
        "required": [
          "messageId",
          "url",
          "status",
          "attempts",
          "responseStatus",
          "deliveredAt",
          "failedAt"
        ],
        "properties": {
          "messageId": {
            "type": "string",
            "pattern": "^msg_"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "scheduled",
              "processing",
              "delivered",
              "failed",
              "cancelled"
            ]
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "responseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "failedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "EventWithDeliveries": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Event"
          },
          {
            "type": "object",
            "required": [
              "deliveries"
            ],
            "properties": {
              "deliveries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EventDelivery"
                }
              }
            }
          }
        ]
      },
      "EventWithDeliveriesResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EventWithDeliveries"
          }
        }
      },
      "EventListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "PutSecretRequest": {
        "type": "object",
        "description": "Give `value` (a value to store) or `external` (where to read it), not both.",
        "additionalProperties": false,
        "properties": {
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8192,
            "writeOnly": true
          },
          "external": {
            "$ref": "#/components/schemas/ExternalSecretReference"
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "allowedHosts": {
            "type": "array",
            "nullable": true,
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 253
            },
            "description": "Hosts this secret may be sent to. A leading dot matches subdomains (\".stripe.com\" admits \"api.stripe.com\"). Null or omitted means any public host for a stored value. A secret read from your own vault (`external`) must name at least one host when it is created; omitting it then answers 400. Omitting it on a rotation or a repoint leaves the existing value alone, so rotating a secret never widens where it may go."
          },
          "allowedPlacements": {
            "type": "array",
            "nullable": true,
            "maxItems": 3,
            "items": {
              "type": "string",
              "enum": [
                "url",
                "header",
                "body"
              ]
            },
            "description": "Where in the request this secret may appear. Null or omitted means anywhere for a stored value, and `[\"header\"]` for a secret read from your own vault. A credential in a header is the intended use; the same value in a URL is usually a mistake or an exfiltration."
          }
        }
      },
      "Secret": {
        "type": "object",
        "description": "Secret metadata. The encrypted value is never exposed by any API.",
        "required": [
          "id",
          "name",
          "description",
          "allowedHosts",
          "allowedPlacements",
          "kind",
          "connection",
          "integrationId",
          "health",
          "external",
          "lastUsedAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "sec_01JABCDEF"
          },
          "name": {
            "type": "string",
            "pattern": "^[A-Z0-9_]+$"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "allowedHosts": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            },
            "description": "Hosts this secret may be sent to. Null means any public host."
          },
          "allowedPlacements": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string",
              "enum": [
                "url",
                "header",
                "body"
              ]
            },
            "description": "Where in the request this secret may appear. Null means anywhere."
          },
          "kind": {
            "type": "string",
            "enum": [
              "static",
              "connection",
              "external"
            ],
            "description": "`static` holds a value you stored. `connection` is a connected account: its value is an access token fetched at dispatch, its hosts come from the integration, and it may only appear in a header. `external` (Enterprise) is read at dispatch from one of the environment's secret stores and is not stored by Anlyon. PUT cannot change a secret's kind."
          },
          "connection": {
            "type": "object",
            "nullable": true,
            "description": "For a signed-in account, which integration it is and whether it still works. `status` mirrors `health.status`, which is the one record of it for both kinds of connected account. Null for a static secret, including one connected with an API key.",
            "required": [
              "integrationId",
              "status"
            ],
            "properties": {
              "integrationId": {
                "type": "string",
                "example": "hubspot"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "needs_reauth"
                ],
                "description": "The same value as `health.status`. Reconnect the account to use it again."
              }
            }
          },
          "health": {
            "type": "object",
            "nullable": true,
            "description": "Whether the connected account still works, whichever way it was connected. `active`, or `needs_reauth` with a `reason` once the provider refused the credential or the connector service could not refresh it. A dispatch that uses a `needs_reauth` account fails before anything is sent. Reconnect it with `POST /api/v2/connections/{secretName}/reconnect`. For an external secret, whether its store could last produce it: `active`, or `unreachable` with a `reason`. Null for a secret you stored directly, which Anlyon cannot check.",
            "required": [
              "status",
              "checkedAt",
              "reason"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "needs_reauth",
                  "unreachable"
                ]
              },
              "checkedAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "description": "When Anlyon last asked the provider whether the credential works. Null when it never has."
              },
              "reason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  "key_rejected",
                  "access_revoked",
                  "refresh_failed",
                  "store_unreachable",
                  "store_denied",
                  "reference_not_found",
                  null
                ],
                "description": "Set while `status` is `needs_reauth` or `unreachable`. `key_rejected`: the provider refused the stored key. `access_revoked`: the provider no longer honours the signed-in account's grant. `refresh_failed`: the connector service could not refresh its token. `store_unreachable`: the secret store did not answer. `store_denied`: the store refused Anlyon's credential for this path. `reference_not_found`: the store has no secret at that path, version or key."
              }
            }
          },
          "integrationId": {
            "type": "string",
            "nullable": true,
            "example": "github",
            "description": "The integration this secret was connected for, by signing in or with an API key. Null for a secret you stored directly. A secret connected with an API key is `static` with this set."
          },
          "external": {
            "type": "object",
            "nullable": true,
            "description": "For an external secret, the store and where in it. Never a value. Null otherwise.",
            "required": [
              "store",
              "storeType",
              "path",
              "key",
              "version"
            ],
            "properties": {
              "store": {
                "type": "string",
                "example": "prod-vault"
              },
              "storeType": {
                "type": "string",
                "enum": [
                  "aws_secrets_manager",
                  "hashicorp_vault"
                ]
              },
              "path": {
                "type": "string",
                "example": "payments/stripe"
              },
              "key": {
                "type": "string",
                "nullable": true,
                "example": "apiKey"
              },
              "version": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ExternalSecretReference": {
        "type": "object",
        "description": "Enterprise. Where an external secret's value lives: a path in one of the environment's secret stores, optionally one key and one version.",
        "required": [
          "store",
          "path"
        ],
        "additionalProperties": false,
        "properties": {
          "store": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,62}$",
            "description": "The store's name."
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "description": "AWS: the secret's name or ARN. Vault: the secret's path under the store's KV v2 mount, such as `payments/stripe`. Must sit under one of the store's `allowedPaths` when it has any."
          },
          "key": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 256,
            "description": "A key of the secret. AWS: a key of the secret string read as JSON; omit it to use the whole string. Vault: a key of the secret's data, required."
          },
          "version": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 64,
            "pattern": "^[A-Za-z0-9_.:-]+$",
            "description": "AWS: a version id (a UUID) or a staging label such as `AWSPREVIOUS`. Vault: a version number. Omit it to read the current version at each dispatch."
          }
        }
      },
      "SecretStore": {
        "type": "object",
        "description": "A secret store's settings and health. Its credential is never exposed by any API.",
        "required": [
          "id",
          "name",
          "type",
          "description",
          "config",
          "credentialKind",
          "allowedPaths",
          "cacheTtlSeconds",
          "health",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "sst_01JABCDEF"
          },
          "name": {
            "type": "string",
            "example": "prod-vault"
          },
          "type": {
            "type": "string",
            "enum": [
              "aws_secrets_manager",
              "hashicorp_vault"
            ]
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "config": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AwsSecretStoreConfig"
              },
              {
                "$ref": "#/components/schemas/VaultSecretStoreConfig"
              }
            ]
          },
          "credentialKind": {
            "type": "string",
            "enum": [
              "access_key",
              "token",
              "approle"
            ],
            "description": "Which kind of credential is stored. The credential itself is never returned."
          },
          "allowedPaths": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            },
            "description": "Path prefixes a secret may point at. Null means any path the credential can read."
          },
          "cacheTtlSeconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300,
            "description": "How long a value read from the store is kept in the API process's memory, never on disk or in a shared cache. 0 reads the store at every dispatch."
          },
          "health": {
            "type": "object",
            "nullable": true,
            "required": [
              "status",
              "checkedAt",
              "reason"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "unreachable"
                ]
              },
              "checkedAt": {
                "type": "string",
                "format": "date-time"
              },
              "reason": {
                "type": "string",
                "nullable": true,
                "enum": [
                  "store_unreachable",
                  "store_denied",
                  "reference_not_found",
                  null
                ]
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AwsSecretStoreConfig": {
        "type": "object",
        "required": [
          "region",
          "auth"
        ],
        "additionalProperties": false,
        "properties": {
          "region": {
            "type": "string",
            "pattern": "^[a-z]{2}(-[a-z]+)+-\\d{1,2}$",
            "example": "eu-west-1"
          },
          "auth": {
            "type": "string",
            "enum": [
              "access_key",
              "assume_role"
            ],
            "description": "`access_key` signs with the stored keys. `assume_role` uses them to assume `roleArn` first."
          },
          "roleArn": {
            "type": "string",
            "nullable": true,
            "example": "arn:aws:iam::123456789012:role/anlyon-secrets-reader"
          },
          "externalId": {
            "type": "string",
            "nullable": true,
            "minLength": 2,
            "maxLength": 1224
          }
        }
      },
      "VaultSecretStoreConfig": {
        "type": "object",
        "required": [
          "address",
          "auth"
        ],
        "additionalProperties": false,
        "properties": {
          "address": {
            "type": "string",
            "format": "uri",
            "maxLength": 512,
            "example": "https://vault.example.com:8200",
            "description": "The Vault origin alone",
            "https.": null
          },
          "namespace": {
            "type": "string",
            "nullable": true,
            "description": "Vault Enterprise namespace."
          },
          "mount": {
            "type": "string",
            "default": "secret",
            "description": "The KV version 2 mount."
          },
          "auth": {
            "type": "string",
            "enum": [
              "token",
              "approle"
            ]
          },
          "authMount": {
            "type": "string",
            "nullable": true,
            "description": "The AppRole auth mount. Default `approle`."
          }
        }
      },
      "AwsSecretStoreCredential": {
        "type": "object",
        "required": [
          "accessKeyId",
          "secretAccessKey"
        ],
        "additionalProperties": false,
        "properties": {
          "accessKeyId": {
            "type": "string",
            "pattern": "^[A-Z0-9]{16,128}$",
            "writeOnly": true,
            "example": "EXAMPLEACCESSKEYID00"
          },
          "secretAccessKey": {
            "type": "string",
            "minLength": 16,
            "maxLength": 256,
            "writeOnly": true
          }
        }
      },
      "VaultSecretStoreCredential": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "token"
            ],
            "additionalProperties": false,
            "properties": {
              "token": {
                "type": "string",
                "minLength": 8,
                "maxLength": 4096,
                "writeOnly": true
              }
            }
          },
          {
            "type": "object",
            "required": [
              "roleId",
              "secretId"
            ],
            "additionalProperties": false,
            "properties": {
              "roleId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "writeOnly": true
              },
              "secretId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 4096,
                "writeOnly": true
              }
            }
          }
        ]
      },
      "CreateSecretStoreRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "name",
              "type",
              "config",
              "credential"
            ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
              },
              "type": {
                "type": "string",
                "enum": [
                  "aws_secrets_manager"
                ]
              },
              "description": {
                "type": "string",
                "maxLength": 500
              },
              "config": {
                "$ref": "#/components/schemas/AwsSecretStoreConfig"
              },
              "credential": {
                "$ref": "#/components/schemas/AwsSecretStoreCredential"
              },
              "allowedPaths": {
                "type": "array",
                "nullable": true,
                "minItems": 1,
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 512
                }
              },
              "cacheTtlSeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 300,
                "default": 30
              }
            }
          },
          {
            "type": "object",
            "required": [
              "name",
              "type",
              "config",
              "credential"
            ],
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "pattern": "^[a-z0-9][a-z0-9-]{0,62}$"
              },
              "type": {
                "type": "string",
                "enum": [
                  "hashicorp_vault"
                ]
              },
              "description": {
                "type": "string",
                "maxLength": 500
              },
              "config": {
                "$ref": "#/components/schemas/VaultSecretStoreConfig"
              },
              "credential": {
                "$ref": "#/components/schemas/VaultSecretStoreCredential"
              },
              "allowedPaths": {
                "type": "array",
                "nullable": true,
                "minItems": 1,
                "maxItems": 20,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 512
                }
              },
              "cacheTtlSeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 300,
                "default": 30
              }
            }
          }
        ],
        "discriminator": {
          "propertyName": "type"
        }
      },
      "UpdateSecretStoreRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 500
          },
          "config": {
            "type": "object",
            "additionalProperties": true,
            "description": "Fields that replace the stored settings they name."
          },
          "credential": {
            "type": "object",
            "additionalProperties": true,
            "writeOnly": true,
            "description": "A whole new credential for the store's type."
          },
          "allowedPaths": {
            "type": "array",
            "nullable": true,
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512
            }
          },
          "cacheTtlSeconds": {
            "type": "integer",
            "minimum": 0,
            "maximum": 300
          }
        }
      },
      "ExternalSecretWarning": {
        "type": "object",
        "description": "The secret was saved, and its store could not produce the value just now. Calls that use it fail before anything is sent until the store can.",
        "required": [
          "code",
          "reason",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "EXTERNAL_SECRET_UNREADABLE"
            ]
          },
          "reason": {
            "type": "string",
            "enum": [
              "store_unreachable",
              "store_denied",
              "reference_not_found"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      },
      "PutSecretResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Secret"
          },
          "warning": {
            "$ref": "#/components/schemas/ExternalSecretWarning"
          }
        }
      },
      "SecretStoreResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/SecretStore"
          }
        }
      },
      "SecretStoreListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SecretStore"
            }
          }
        }
      },
      "SecretResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Secret"
          }
        }
      },
      "SecretListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Secret"
            }
          }
        }
      },
      "ConnectionIntegration": {
        "type": "object",
        "description": "An integration an account can be connected for.",
        "required": [
          "id",
          "name",
          "auth",
          "hosts",
          "hostsFromAccount",
          "scopes",
          "operationsPack",
          "workflowPacks"
        ],
        "properties": {
          "ownOAuthAppRequired": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Present on a sign-in integration whose OAuth app this deployment does not have: it is connected through the environment's own app (`PUT /api/v2/environments/{environmentId}/oauth-apps/{integration}`), and until that is set a connect session or link answers `400 OWN_OAUTH_APP_REQUIRED`. Absent otherwise."
          },
          "id": {
            "type": "string",
            "example": "hubspot",
            "description": "Stable id used in sessions and pack manifests."
          },
          "name": {
            "type": "string",
            "example": "HubSpot"
          },
          "auth": {
            "type": "object",
            "description": "How an account is connected. `oauth`: start a connect session and sign in at the provider. `api_key`: create a key in the provider's own settings, following `instructions`, and send it to `POST /api/v2/connections/keys`. An integration that signs in and also takes a key (GitHub, Notion) is `oauth` with `apiKey` set where signing in works here, and `api_key` where it does not.",
            "required": [
              "kind"
            ],
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "oauth",
                  "api_key"
                ]
              },
              "apiKey": {
                "type": "object",
                "description": "For `oauth`: the key that may be sent to `POST /api/v2/connections/keys` instead of signing in. Absent for an integration that only signs in.",
                "required": [
                  "instructions",
                  "instructionsUrl"
                ],
                "properties": {
                  "instructions": {
                    "type": "string",
                    "description": "Where in the provider's settings the key is created, and with which permissions."
                  },
                  "instructionsUrl": {
                    "type": "string",
                    "format": "uri",
                    "description": "The provider's own page for creating the key."
                  },
                  "fields": {
                    "type": "array",
                    "description": "As `fields` below, for a key made of several values.",
                    "items": {
                      "type": "object",
                      "required": [
                        "name",
                        "label",
                        "secret",
                        "kind"
                      ],
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "secret": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "account",
                            "credential"
                          ]
                        },
                        "hint": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "instructions": {
                "type": "string",
                "description": "For `api_key`: where in the provider's settings the key is created, and with which permissions."
              },
              "instructionsUrl": {
                "type": "string",
                "format": "uri",
                "description": "For `api_key`: the provider's own page for creating the key."
              },
              "fields": {
                "type": "array",
                "description": "For `api_key`, when the key is several values (an email and an API token) or the host is the account's own (a subdomain): what to ask for, in order. Send them as `fields` instead of `apiKey`. Every value is stored encrypted and never returned.",
                "items": {
                  "type": "object",
                  "required": [
                    "name",
                    "label",
                    "secret",
                    "kind"
                  ],
                  "properties": {
                    "name": {
                      "type": "string",
                      "example": "apiToken"
                    },
                    "label": {
                      "type": "string",
                      "example": "API token"
                    },
                    "secret": {
                      "type": "boolean",
                      "description": "Mask it in a form."
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "account",
                        "credential"
                      ],
                      "description": "`account` names the account's own host (see `hostTemplate`); `credential` is part of the key."
                    },
                    "hint": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "hosts": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            },
            "description": "The API hosts the token may be sent to. Null when they come from the connected account itself (see hostsFromAccount)."
          },
          "hostsFromAccount": {
            "type": "boolean",
            "description": "True when the API host is the account's own (a Salesforce instance, a Zendesk subdomain) and is fixed at connect time."
          },
          "hostTemplate": {
            "type": "string",
            "example": "{subdomain}.zendesk.com",
            "description": "For an API-key integration whose host is the account's own: the one host shape it may be. The account field fills it; anything outside it is refused."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The scopes requested at the provider's consent page. Empty for an `api_key` integration, whose access is whatever the key was given."
          },
          "operationsPack": {
            "type": "string",
            "nullable": true,
            "example": "anlyon/hubspot",
            "description": "The pack whose actions are this integration's operations: what an agent may be allowed to do once the account is connected."
          },
          "workflowPacks": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Workflow packs that use this integration together with others."
          }
        }
      },
      "ConnectionIntegrationListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConnectionIntegration"
            }
          }
        }
      },
      "CreateConnectSessionRequest": {
        "type": "object",
        "required": [
          "integrationId",
          "secretName"
        ],
        "additionalProperties": false,
        "properties": {
          "integrationId": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9-]+$",
            "example": "hubspot"
          },
          "secretName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Z0-9_]+$",
            "example": "HUBSPOT",
            "description": "The secret the connected account becomes; actions reference it as {{secret:NAME}}."
          },
          "description": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "ConnectWithApiKeyRequest": {
        "type": "object",
        "required": [
          "integrationId",
          "secretName"
        ],
        "additionalProperties": false,
        "description": "`apiKey` for an integration connected with one key; `fields` for one whose `auth.fields` is set. One or the other.",
        "properties": {
          "integrationId": {
            "type": "string",
            "maxLength": 64,
            "pattern": "^[a-z0-9-]+$",
            "example": "github"
          },
          "secretName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[A-Z0-9_]+$",
            "example": "GITHUB",
            "description": "The secret the key is stored as; actions reference it as {{secret:NAME}}."
          },
          "apiKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 4096,
            "pattern": "^[\\x21-\\x7e]+$",
            "writeOnly": true,
            "example": "the-key-you-created-at-the-provider",
            "description": "The key alone",
            "with no spaces or line breaks. Checked with the provider": null,
            "stored encrypted": null,
            "and never returned.": null
          },
          "fields": {
            "$ref": "#/components/schemas/ConnectionFieldValues"
          },
          "description": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "ConnectionFieldValues": {
        "type": "object",
        "writeOnly": true,
        "minProperties": 1,
        "maxProperties": 8,
        "description": "For an integration whose `auth.fields` is set: each field by name, e.g. `{ \"site\": \"acme\", \"email\": \"ana@acme.com\", \"apiToken\": \"...\" }`. Each value is checked against the integration's own pattern. The account field becomes the one host the key is bound to (`acme.atlassian.net`); the rest are stored encrypted together as one credential and never returned. Sent composed in the integration's header (HTTP Basic, or the provider's own header form).",
        "additionalProperties": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096,
          "pattern": "^[\\x21-\\x7e]+$"
        }
      },
      "ConnectSession": {
        "type": "object",
        "required": [
          "sessionId",
          "sessionToken",
          "expiresAt",
          "connectUrl",
          "integration"
        ],
        "properties": {
          "sessionId": {
            "type": "string",
            "example": "csn_4f9a1c2b7d8e0f3a"
          },
          "sessionToken": {
            "type": "string",
            "description": "The consent token in `connectUrl`. Whoever holds it can sign in for this session until it expires, so treat it like the link."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "connectUrl": {
            "type": "string",
            "format": "uri",
            "example": "https://api.anlyon.com/api/v2/connection-consent/start?token=cst_9Qm2",
            "description": "Open in a browser to sign in at the provider. Then poll `complete`."
          },
          "integration": {
            "$ref": "#/components/schemas/ConnectionIntegration"
          }
        }
      },
      "ConnectSessionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ConnectSession"
          }
        }
      },
      "CompleteConnectSessionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "reference": {
            "type": "string",
            "maxLength": 200,
            "pattern": "^[A-Za-z0-9._:-]+$",
            "deprecated": true,
            "x-anlyon-replacement": "an empty request body",
            "x-anlyon-removal-date": "2027-04-18",
            "description": "Deprecated: send an empty body. Anlyon records the connection itself when the provider redirects back, and refuses a reference that differs from it."
          }
        }
      },
      "ConnectSessionCompletion": {
        "type": "object",
        "required": [
          "status",
          "secret"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "completed"
            ]
          },
          "secret": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Secret"
              }
            ],
            "description": "The connected-account secret once completed; null while pending."
          }
        }
      },
      "ConnectSessionCompletionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ConnectSessionCompletion"
          }
        }
      },
      "ReconnectConnectionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "apiKey": {
            "type": "string",
            "minLength": 8,
            "maxLength": 4096,
            "pattern": "^[\\x21-\\x7e]+$",
            "writeOnly": true,
            "example": "the-new-key-you-created-at-the-provider",
            "description": "For an API-key integration: the new key alone, with no spaces or line breaks. Checked with the provider, stored encrypted, and never returned. Omit for a sign-in integration."
          },
          "fields": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ConnectionFieldValues"
              }
            ],
            "description": "For an integration whose `auth.fields` is set: every field again. The account field must name the account already connected; another account is a new connection."
          }
        }
      },
      "ConnectionReconnect": {
        "type": "object",
        "description": "How the reconnect went. `completed`: a new key was accepted and stored; `secret` is the account as it now stands. `pending`: a consent session was started for a signed-in account; finish it with `POST /api/v2/connections/sessions/{sessionId}/complete`.",
        "required": [
          "status",
          "secret",
          "session"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "completed",
              "pending"
            ]
          },
          "secret": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Secret"
              }
            ],
            "description": "The reconnected account once completed; null while pending."
          },
          "session": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/ConnectSession"
              }
            ],
            "description": "The consent session to finish, for a signed-in account; null once completed."
          }
        }
      },
      "ConnectionReconnectResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ConnectionReconnect"
          }
        }
      },
      "PresignFileUploadRequest": {
        "type": "object",
        "required": [
          "name",
          "sizeBytes"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1
          },
          "mimeType": {
            "type": "string",
            "minLength": 1,
            "maxLength": 255,
            "default": "application/octet-stream"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "File": {
        "type": "object",
        "required": [
          "id",
          "name",
          "size",
          "mimeType",
          "status",
          "checksum",
          "metadata",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "file_01JABCDEF"
          },
          "name": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": 0
          },
          "mimeType": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ready"
            ]
          },
          "checksum": {
            "type": "string",
            "nullable": true,
            "description": "SHA-256 checksum for direct uploads."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FileResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/File"
          }
        }
      },
      "FileListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/File"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "FileUploadPresignedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "fileId",
              "uploadUrl",
              "expiresAt"
            ],
            "properties": {
              "fileId": {
                "type": "string"
              },
              "uploadUrl": {
                "type": "string",
                "format": "uri"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "FileDownloadUrlResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "url",
              "expiresAt"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "CacheNamespace": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100,
        "pattern": "^[a-zA-Z0-9_-]+$",
        "default": "default"
      },
      "StoreCacheEntryRequest": {
        "type": "object",
        "required": [
          "key",
          "value"
        ],
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32768
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1048576
          },
          "namespace": {
            "$ref": "#/components/schemas/CacheNamespace"
          },
          "ttlSeconds": {
            "type": "integer",
            "minimum": 1,
            "maximum": 31536000
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "LookupCacheRequest": {
        "type": "object",
        "required": [
          "key"
        ],
        "additionalProperties": false,
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32768
          },
          "namespace": {
            "$ref": "#/components/schemas/CacheNamespace"
          },
          "minSimilarity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "filter": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "FlushCacheRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "namespace": {
            "$ref": "#/components/schemas/CacheNamespace"
          }
        }
      },
      "CacheEntry": {
        "type": "object",
        "required": [
          "id",
          "namespace",
          "key",
          "value",
          "metadata",
          "hitCount",
          "expiresAt",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "cache_01JABCDEF"
          },
          "namespace": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "hitCount": {
            "type": "integer",
            "minimum": 0
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CacheEntryResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/CacheEntry"
          }
        }
      },
      "CacheEntryListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CacheEntry"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "CacheLookupEntry": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CacheEntry"
          },
          {
            "type": "object",
            "required": [
              "similarity"
            ],
            "properties": {
              "similarity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        ]
      },
      "CacheLookupResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "hit"
            ],
            "properties": {
              "hit": {
                "type": "boolean"
              },
              "entry": {
                "$ref": "#/components/schemas/CacheLookupEntry"
              }
            }
          }
        }
      },
      "CacheFlushedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "deleted"
            ],
            "properties": {
              "deleted": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      },
      "CacheStatsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "entries",
              "hits",
              "misses",
              "hitRate"
            ],
            "properties": {
              "entries": {
                "type": "integer",
                "minimum": 0
              },
              "hits": {
                "type": "integer",
                "minimum": 0
              },
              "misses": {
                "type": "integer",
                "minimum": 0
              },
              "hitRate": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            }
          }
        }
      },
      "ActionAdapter": {
        "type": "object",
        "description": "Makes the action a governed effect (see the Governed effects guide). The request is built by the adapter from `config`; the credential is a vault secret referenced by name. Available types: `stripe.refund` (config `account`, `mode: test`, `currency`), `github.file_update` (config `owner`, `repo`, `branch`, optional `pathPrefix`, `allowDefaultBranch`) and `resend.email_send` (config `domain`, optional `fromAddresses`).",
        "required": [
          "type",
          "config",
          "credentialSecret"
        ],
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "stripe.refund",
              "github.file_update",
              "resend.email_send"
            ]
          },
          "config": {
            "type": "object",
            "additionalProperties": true,
            "example": {
              "account": "acct_123",
              "mode": "test",
              "currency": "usd"
            }
          },
          "credentialSecret": {
            "type": "string",
            "pattern": "^[A-Z0-9_]+$",
            "example": "STRIPE_TEST_KEY"
          }
        }
      },
      "ImpactQuantity": {
        "type": "object",
        "required": [
          "dimension",
          "amount",
          "bound"
        ],
        "properties": {
          "dimension": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,31}$",
            "example": "money",
            "description": "`money`, `resource_mutations`, or a workspace-declared unit such as `emails`."
          },
          "currency": {
            "type": "string",
            "pattern": "^[a-z]{3}$",
            "example": "usd",
            "description": "Present for money."
          },
          "amount": {
            "type": "integer",
            "minimum": 0,
            "description": "Integer minor units for money. A count for every other dimension."
          },
          "bound": {
            "type": "string",
            "enum": [
              "exact",
              "upper_bound"
            ]
          }
        }
      },
      "ActionImpact": {
        "type": "object",
        "description": "How much one invocation changes, declared on a template action. Declaring it makes the action governed: the quantity is reserved against every applicable impact limit before dispatch. `amount` is an expression over the input, evaluated at admission after schema validation. It may be an integer, `input.<path>`, or `count(input.<path>)`, followed by one optional `* <integer>`, and it must produce a non-negative integer. An amount that reads an optional input the caller left out yields no quantity. The effect is then unbounded for that dimension: an applicable limit refuses it with `impact_unbounded`, and with no applicable limit it runs. Anlyon evaluates the expression as written. It does not check that the expression describes what the provider will do.",
        "required": [
          "dimension",
          "amount",
          "bound"
        ],
        "additionalProperties": false,
        "properties": {
          "dimension": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,31}$",
            "example": "emails",
            "description": "`money`, `resource_mutations`, or a workspace-declared unit such as `emails`, `messages` or `rows`."
          },
          "unit": {
            "type": "string",
            "minLength": 1,
            "maxLength": 32,
            "example": "emails",
            "description": "The currency for `money` (lowercase ISO 4217, required). For every other dimension the unit is the dimension name and may be left out."
          },
          "amount": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "example": "count(input.to)"
          },
          "bound": {
            "type": "string",
            "enum": [
              "exact",
              "upper_bound"
            ]
          }
        }
      },
      "ActionVerify": {
        "type": "object",
        "description": "A read-back that confirms a write, declared on a template action. After the provider accepts the write, Anlyon issues this `GET` through the same pinned transport with the action's own headers and compares the answer. A match grades the effect `confirmed`. Without one a 2xx grades `acknowledged`. The URL must be on the action's own host. It may reference `{{input.field}}`, `{{response.field}}` (a value from the provider's response to the write) and `{{secret:NAME}}`. A rule that needs `response` cannot run after a lost response, so that effect stays `unknown` until an operator resolves it.",
        "required": [
          "url",
          "status"
        ],
        "additionalProperties": false,
        "properties": {
          "url": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "example": "https://api.example.com/v1/messages/{{response.id}}"
          },
          "status": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "example": 200,
            "description": "The status the read-back must answer with."
          },
          "match": {
            "type": "array",
            "maxItems": 10,
            "description": "JSON path equality checks on the read-back body. Every one must hold.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "path",
                "equals"
              ],
              "properties": {
                "path": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200,
                  "example": "status",
                  "description": "A dotted path into the read-back body. A numeric segment indexes an array; a `*` segment stands for any item of one (`labels.*.name`)."
                },
                "equals": {
                  "nullable": true,
                  "example": "sent",
                  "description": "A string, number, boolean or null. A string may be exactly one `{{input.field}}` or `{{response.field}}`."
                },
                "absent": {
                  "type": "boolean",
                  "description": "True when the check holds only if no value at the path equals `equals`: how a removal is read back. Left out, the check holds when one does."
                }
              }
            }
          },
          "graphql": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "query"
            ],
            "description": "A GraphQL read-back: Anlyon POSTs `{ query, variables }` to `url` instead of a `GET`. The query is fixed text: no placeholder, and no `mutation` or `subscription` anywhere in it, so a read-back cannot write. Only the variables come from the call.",
            "properties": {
              "query": {
                "type": "string",
                "minLength": 1,
                "maxLength": 10000,
                "example": "query($id: String!) { issue(id: $id) { title } }"
              },
              "variables": {
                "type": "object",
                "maxProperties": 20,
                "additionalProperties": {
                  "nullable": true
                },
                "description": "Each a string, number, boolean or null; a string may be exactly one `{{input.field}}` or `{{response.field}}`."
              }
            }
          }
        }
      },
      "PreviewBlock": {
        "type": "object",
        "description": "One typed presentation block. `fields` holds label/value pairs, `text_diff` holds before and after text for one path, `impact` holds quantities, `limitations` holds labelled guarantees (`guarantee`, `freshness`, `unsupported`, `irreversible`). Never provider HTML.",
        "required": [
          "type",
          "title"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "fields",
              "text_diff",
              "impact",
              "limitations"
            ]
          },
          "title": {
            "type": "string"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "label",
                "value"
              ],
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          },
          "path": {
            "type": "string"
          },
          "before": {
            "type": "string"
          },
          "after": {
            "type": "string"
          },
          "truncated": {
            "type": "boolean"
          },
          "quantities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImpactQuantity"
            }
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "kind",
                "text"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "guarantee",
                    "freshness",
                    "unsupported",
                    "irreversible"
                  ]
                },
                "text": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ActionPreview": {
        "type": "object",
        "required": [
          "id",
          "action",
          "adapter",
          "environment",
          "target",
          "request",
          "impact",
          "blocks",
          "preconditions",
          "capabilities",
          "allowances",
          "evidenceObservedAt",
          "expiresAt",
          "expired",
          "requestDigest",
          "bindingDigest",
          "supersedes",
          "effectId",
          "endUserId",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "prv_01JABCDEF"
          },
          "action": {
            "type": "object",
            "required": [
              "id",
              "name",
              "versionId"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "versionId": {
                "type": "string"
              }
            }
          },
          "adapter": {
            "type": "object",
            "required": [
              "type",
              "version"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "environment": {
            "type": "object",
            "required": [
              "id",
              "name",
              "kind"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              }
            }
          },
          "target": {
            "type": "object",
            "additionalProperties": true
          },
          "request": {
            "type": "object",
            "additionalProperties": true,
            "description": "The exact normalized request that will be dispatched."
          },
          "impact": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImpactQuantity"
            }
          },
          "blocks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PreviewBlock"
            }
          },
          "preconditions": {
            "type": "object",
            "additionalProperties": true,
            "description": "Material preconditions; part of the binding."
          },
          "capabilities": {
            "type": "object",
            "additionalProperties": true,
            "description": "The adapter's declared guarantees."
          },
          "allowances": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "Applicable impact limits at preview time. Dispatch rechecks."
          },
          "evidenceObservedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "expired": {
            "type": "boolean"
          },
          "requestDigest": {
            "type": "string"
          },
          "bindingDigest": {
            "type": "string",
            "description": "SHA-256 over the canonical request, target, versions, preconditions, scope and expiry. What an approval agrees to."
          },
          "supersedes": {
            "type": "string",
            "nullable": true
          },
          "effectId": {
            "type": "string",
            "nullable": true,
            "description": "The effect executing this preview, once one is admitted."
          },
          "endUserId": {
            "type": "string",
            "nullable": true,
            "description": "The end user whose account read the provider. An invoke with this preview must name the same end user, and only a call for that end user (or one naming none) can read it."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Effect": {
        "type": "object",
        "required": [
          "id",
          "invocationId",
          "operationKey",
          "environmentId",
          "action",
          "adapter",
          "stage",
          "outcome",
          "partialEffect",
          "grade",
          "verification",
          "providerReference",
          "target",
          "impact",
          "previewId",
          "approvalId",
          "bindingDigest",
          "dependsOn",
          "compensates",
          "rejectionReason",
          "unresolvedExposure",
          "reconciliation",
          "endUserId",
          "createdAt",
          "firstDispatchedAt",
          "outcomeAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "eff_01JABCDEF"
          },
          "endUserId": {
            "type": "string",
            "nullable": true,
            "description": "The end user whose account the effect is sent with (`Anlyon-End-User`), or null for the workspace's own accounts. `erased~<hash>` once that end user is erased."
          },
          "invocationId": {
            "type": "string"
          },
          "operationKey": {
            "type": "string"
          },
          "environmentId": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "object",
            "required": [
              "name",
              "versionId"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "versionId": {
                "type": "string"
              }
            }
          },
          "adapter": {
            "type": "object",
            "required": [
              "type",
              "version"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "stage": {
            "type": "string",
            "enum": [
              "awaiting_approval",
              "ready",
              "dispatching",
              "reconciling",
              "settled",
              "rejected"
            ]
          },
          "outcome": {
            "type": "string",
            "enum": [
              "not_dispatched",
              "pending",
              "succeeded",
              "failed",
              "unknown"
            ]
          },
          "partialEffect": {
            "type": "string",
            "enum": [
              "none",
              "possible",
              "confirmed"
            ],
            "description": "A failure is not proof of zero impact."
          },
          "grade": {
            "type": "string",
            "enum": [
              "confirmed",
              "acknowledged",
              "unknown",
              "failed",
              "refused",
              "denied",
              "pending"
            ],
            "description": "The receipt grade, derived by the database from the stage, outcome, outcome source and rejection reason. `confirmed`: the outcome is `succeeded` and it was read from the provider's own record of the operation, or a declared read-back matched. `acknowledged`: the provider accepted the request with a 2xx and no read-back has matched. An operator's manual `succeeded` also grades here and keeps `verification: manual`. `unknown`: no usable response, so reconciliation owns the effect and its allowance stays held. `failed`: the provider rejected the request, or the request provably never left Anlyon. `refused`: Anlyon refused at dispatch, for example on a digest mismatch, an exhausted or unbounded limit, an expired preview or a changed action version. `denied`: the approval was denied. `pending`: no receipt yet."
          },
          "verification": {
            "type": "string",
            "enum": [
              "provider",
              "manual",
              "unverified",
              "not_dispatched"
            ]
          },
          "providerReference": {
            "type": "string",
            "nullable": true
          },
          "target": {
            "type": "object",
            "additionalProperties": true
          },
          "impact": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImpactQuantity"
            }
          },
          "previewId": {
            "type": "string",
            "nullable": true
          },
          "approvalId": {
            "type": "string",
            "nullable": true
          },
          "bindingDigest": {
            "type": "string",
            "nullable": true
          },
          "dependsOn": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "effectId",
                "outcome"
              ],
              "properties": {
                "effectId": {
                  "type": "string"
                },
                "outcome": {
                  "type": "string"
                }
              }
            }
          },
          "compensates": {
            "type": "string",
            "nullable": true
          },
          "rejectionReason": {
            "type": "string",
            "nullable": true
          },
          "unresolvedExposure": {
            "type": "boolean"
          },
          "reconciliation": {
            "type": "object",
            "required": [
              "attempts",
              "nextAt",
              "exhausted"
            ],
            "properties": {
              "attempts": {
                "type": "integer",
                "minimum": 0
              },
              "nextAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "exhausted": {
                "type": "boolean"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "firstDispatchedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "outcomeAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EffectDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Effect"
          },
          {
            "type": "object",
            "required": [
              "request",
              "capabilities",
              "attempts",
              "evidence",
              "reservations",
              "preview"
            ],
            "properties": {
              "request": {
                "type": "object",
                "additionalProperties": true
              },
              "capabilities": {
                "type": "object",
                "additionalProperties": true
              },
              "attempts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "number",
                    "kind",
                    "status",
                    "observedOutcome",
                    "error",
                    "startedAt",
                    "finishedAt"
                  ],
                  "properties": {
                    "number": {
                      "type": "integer"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "dispatch",
                        "replay",
                        "reconcile"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "started",
                        "completed",
                        "abandoned"
                      ]
                    },
                    "observedOutcome": {
                      "type": "string",
                      "nullable": true
                    },
                    "error": {
                      "type": "string",
                      "nullable": true
                    },
                    "startedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "finishedAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    }
                  }
                }
              },
              "evidence": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "source",
                    "observedAt",
                    "impliedOutcome",
                    "providerIds",
                    "summary",
                    "details",
                    "actor",
                    "recordedAt"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "preview",
                        "provider_response",
                        "provider_lookup",
                        "system",
                        "operator_note",
                        "manual_resolution"
                      ]
                    },
                    "observedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "impliedOutcome": {
                      "type": "string",
                      "nullable": true
                    },
                    "providerIds": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "summary": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "actor": {
                      "type": "object",
                      "required": [
                        "type",
                        "id"
                      ],
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    },
                    "recordedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "reservations": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "limitId",
                    "name",
                    "dimension",
                    "currency",
                    "period",
                    "amount",
                    "state",
                    "exposure",
                    "settled",
                    "released",
                    "createdAt",
                    "finishedAt"
                  ],
                  "properties": {
                    "limitId": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "dimension": {
                      "type": "string",
                      "example": "money"
                    },
                    "currency": {
                      "type": "string",
                      "nullable": true
                    },
                    "period": {
                      "type": "string",
                      "description": "The accounting period this reservation belongs to for its whole life."
                    },
                    "amount": {
                      "type": "integer"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "reserved",
                        "settled",
                        "released"
                      ]
                    },
                    "exposure": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "dispatching",
                        "pending",
                        "unknown",
                        "partial",
                        null
                      ]
                    },
                    "settled": {
                      "type": "integer"
                    },
                    "released": {
                      "type": "integer"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "finishedAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    }
                  }
                }
              },
              "preview": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ActionPreview"
                  }
                ],
                "nullable": true
              }
            }
          }
        ]
      },
      "ResolveEffectRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "outcome",
          "reason"
        ],
        "properties": {
          "outcome": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed"
            ]
          },
          "partialEffect": {
            "type": "string",
            "enum": [
              "none",
              "possible",
              "confirmed"
            ]
          },
          "actualImpact": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/ImpactQuantity"
            }
          },
          "reason": {
            "type": "string",
            "minLength": 10,
            "maxLength": 2000,
            "description": "What you checked and why."
          },
          "externalReference": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 200
          }
        }
      },
      "CreatePreviewRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "input": {
            "type": "object",
            "additionalProperties": true
          },
          "ttlSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 604800,
            "default": 3600
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Resolve the action version this run's agent pins."
          }
        }
      },
      "ImpactLimit": {
        "type": "object",
        "required": [
          "id",
          "name",
          "dimension",
          "currency",
          "unit",
          "scope",
          "period",
          "limit",
          "currentPeriod",
          "consumed",
          "reserved",
          "unknownExposure",
          "available",
          "archived",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "lim_01JABCDEF"
          },
          "name": {
            "type": "string"
          },
          "dimension": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,31}$",
            "example": "money",
            "description": "`money`, `resource_mutations`, or a workspace-declared unit such as `emails`."
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "unit": {
            "type": "string",
            "example": "usd",
            "description": "What the amounts count. The currency for money, the dimension name for every other dimension."
          },
          "scope": {
            "type": "object",
            "required": [
              "environmentId",
              "actionName",
              "resourcePrefix",
              "kind"
            ],
            "properties": {
              "environmentId": {
                "type": "string",
                "format": "uuid"
              },
              "actionName": {
                "type": "string",
                "nullable": true
              },
              "resourcePrefix": {
                "type": "string",
                "nullable": true
              },
              "kind": {
                "type": "string",
                "enum": [
                  "environment",
                  "end_user"
                ],
                "description": "`environment`: one allowance shared by every call. `end_user`: each end user has the whole amount; the figures are then those of the end user named by `?endUserId=`, or of calls with no end user."
              }
            }
          },
          "period": {
            "type": "string",
            "enum": [
              "day",
              "month",
              "total"
            ]
          },
          "limit": {
            "type": "integer",
            "minimum": 0
          },
          "currentPeriod": {
            "type": "string",
            "example": "month:2026-09"
          },
          "consumed": {
            "type": "integer",
            "minimum": 0
          },
          "reserved": {
            "type": "integer",
            "minimum": 0
          },
          "unknownExposure": {
            "type": "integer",
            "minimum": 0
          },
          "available": {
            "type": "integer",
            "minimum": 0
          },
          "archived": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateImpactLimitRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "dimension",
          "period",
          "amount"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "dimension": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,31}$",
            "example": "money",
            "description": "`money`, `resource_mutations`, or a workspace-declared unit such as `emails`. A declared unit caps the actions that declare an impact in that unit."
          },
          "currency": {
            "type": "string",
            "pattern": "^[a-z]{3}$",
            "example": "usd",
            "description": "Required for money."
          },
          "unit": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,31}$",
            "example": "usd",
            "description": "Optional. The currency for money, the dimension name for every other dimension. It is implied by `dimension` and `currency`, and refused when it disagrees with them."
          },
          "actionName": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 100
          },
          "resourcePrefix": {
            "type": "string",
            "nullable": true,
            "minLength": 1,
            "maxLength": 500,
            "example": "github:acme/fixtures@"
          },
          "scope": {
            "type": "string",
            "enum": [
              "environment",
              "end_user"
            ],
            "default": "environment",
            "description": "`end_user`: each end user has the whole amount, counted on their own periods (\"each user may send 20 emails a day\"). A call with no end user counts on the shared allowance. Fixed once created."
          },
          "period": {
            "type": "string",
            "enum": [
              "day",
              "month",
              "total"
            ]
          },
          "amount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "UpdateImpactLimitRequest": {
        "type": "object",
        "additionalProperties": false,
        "minProperties": 1,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "amount": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "EffectListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Effect"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "EffectDetailResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EffectDetail"
          }
        }
      },
      "PreviewResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ActionPreview"
          }
        }
      },
      "ImpactLimitResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ImpactLimit"
          }
        }
      },
      "ImpactLimitListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ImpactLimit"
            }
          }
        }
      },
      "CreateActionRequest": {
        "type": "object",
        "description": "A template action needs `urlTemplate`. An adapter action needs `adapter` instead, and its request, method and input schema come from the adapter. A template action that carries `impact`, `verify` or `governed: true` is a governed action: every invocation creates an effect with a bound preview, a limit reservation and a receipt grade. Its host must be fixed by `urlTemplate` and it must use https. An adapter action is already governed and accepts none of the three.",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "default": "POST"
          },
          "urlTemplate": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "example": "https://api.example.com/users/{{input.userId}}"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 4096
            },
            "example": {
              "Authorization": "Bearer {{secret:EXAMPLE_TOKEN}}"
            }
          },
          "bodyTemplate": {
            "type": "object",
            "additionalProperties": true
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "requiresApproval": {
            "type": "boolean",
            "default": false
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "adapter": {
            "$ref": "#/components/schemas/ActionAdapter"
          },
          "impact": {
            "$ref": "#/components/schemas/ActionImpact"
          },
          "verify": {
            "$ref": "#/components/schemas/ActionVerify"
          },
          "governed": {
            "type": "boolean",
            "description": "Set `true` to govern a template action that declares neither `impact` nor `verify`. Its 2xx then grades `acknowledged`."
          }
        }
      },
      "UpdateActionRequest": {
        "type": "object",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "description": {
            "type": "string",
            "maxLength": 1000
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "urlTemplate": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 4096
            }
          },
          "bodyTemplate": {
            "type": "object",
            "additionalProperties": true
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "requiresApproval": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "adapter": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionAdapter"
              }
            ],
            "description": "Retarget an adapter action (same type). Needs `actions:govern`."
          },
          "impact": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionImpact"
              }
            ],
            "nullable": true,
            "description": "Declare or replace the impact. `null` removes it. Omit it to keep what the action declares. Changing what a governed action declares needs `actions:govern`."
          },
          "verify": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionVerify"
              }
            ],
            "nullable": true,
            "description": "Declare or replace the read-back. `null` removes it. Omit it to keep what the action declares. Changing what a governed action declares needs `actions:govern`."
          },
          "governed": {
            "type": "boolean",
            "description": "`false` removes every declaration and returns the action to the template executor. Needs `actions:govern`."
          }
        }
      },
      "InvokeActionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "input": {
            "type": "object",
            "additionalProperties": true
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Existing run in this API key environment to receive the automatic action_call span."
          },
          "parentSpanId": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional parent span within runId."
          },
          "retryOf": {
            "type": "string",
            "maxLength": 100,
            "pattern": "^inv_[A-Za-z0-9_-]+$",
            "description": "A failed invocation of the same action that this call deliberately retries. Needs its own Idempotency-Key. Refused while the original is unknown (resolve it first) or succeeded, and once it has already been retried."
          },
          "operationKey": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,200}$",
            "description": "Governed actions only (an adapter or a declaration). Stable operation identity: the same key with the same request returns the existing effect. The same key with a different request is a 409. Defaults to the Idempotency-Key. Different keys do not make two requests different business operations."
          },
          "previewId": {
            "type": "string",
            "pattern": "^prv_[A-Za-z0-9_-]{1,64}$",
            "description": "Governed actions only. A reviewed preview this invocation must match exactly (409 PREVIEW_MISMATCH, PREVIEW_EXPIRED or PREVIEW_ALREADY_USED otherwise)."
          },
          "dependsOn": {
            "type": "array",
            "maxItems": 10,
            "description": "Governed actions only. Effects that must already have the stated outcome. Pending and unknown never satisfy a dependency (409 DEPENDENCY_UNRESOLVED).",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "effect",
                "outcome"
              ],
              "properties": {
                "effect": {
                  "type": "string",
                  "pattern": "^eff_[A-Za-z0-9_-]{1,64}$"
                },
                "outcome": {
                  "type": "string",
                  "enum": [
                    "succeeded",
                    "failed"
                  ]
                }
              }
            }
          },
          "compensates": {
            "type": "string",
            "pattern": "^eff_[A-Za-z0-9_-]{1,64}$",
            "description": "Governed actions only. The effect this one compensates. A compensation is its own governed effect."
          }
        }
      },
      "Action": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "method",
          "urlTemplate",
          "headers",
          "bodyTemplate",
          "inputSchema",
          "requiresApproval",
          "enabled",
          "secrets",
          "currentVersionId",
          "environmentId",
          "adapter",
          "governed",
          "impact",
          "verify",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "act_01JABCDEF"
          },
          "environmentId": {
            "type": "string",
            "format": "uuid",
            "description": "The environment this action lives in. An action belongs to exactly one."
          },
          "name": {
            "type": "string",
            "example": "create-ticket"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "urlTemplate": {
            "type": "string"
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "bodyTemplate": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "requiresApproval": {
            "type": "boolean"
          },
          "enabled": {
            "type": "boolean"
          },
          "secrets": {
            "type": "array",
            "description": "Referenced secret names only; values are never returned.",
            "items": {
              "type": "string"
            }
          },
          "currentVersionId": {
            "type": "string",
            "nullable": true,
            "example": "acv_01JABCDEF",
            "description": "The immutable version this definition currently is. An agent version pins a version id, so this is what to pin to hold an action at its present definition. Null only for actions that predate versioning and have not been edited since."
          },
          "adapter": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionAdapter"
              }
            ],
            "nullable": true,
            "description": "The governed-effect adapter, or null for a template action."
          },
          "governed": {
            "type": "boolean",
            "description": "True when every invocation creates a governed effect. The action has an adapter, or it carries a declaration."
          },
          "impact": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionImpact"
              }
            ],
            "nullable": true,
            "description": "The declared impact, or null when the action declares none."
          },
          "verify": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionVerify"
              }
            ],
            "nullable": true,
            "description": "The declared read-back, or null when the action declares none."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ActionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Action"
          }
        }
      },
      "ActionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Action"
            }
          }
        }
      },
      "Invocation": {
        "type": "object",
        "required": [
          "id",
          "actionName",
          "actionVersionId",
          "status",
          "responseStatus",
          "body",
          "error",
          "durationMs",
          "approvalId",
          "decision",
          "retryOf",
          "effectId",
          "endUserId",
          "createdAt",
          "completedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "inv_01JABCDEF"
          },
          "effectId": {
            "type": "string",
            "nullable": true,
            "example": "eff_01JABCDEF",
            "description": "The governed effect this invocation created, for a governed action (an adapter or a declaration). Its outcome, evidence and recovery are at GET /api/v2/actions/effects/{id}. Null for template actions."
          },
          "endUserId": {
            "type": "string",
            "nullable": true,
            "description": "The end user the call acted for (`Anlyon-End-User`), whose own accounts it used. Null for a call with the workspace's own accounts. `erased~<hash>` once that end user is erased."
          },
          "grade": {
            "type": "string",
            "nullable": true,
            "enum": [
              "confirmed",
              "acknowledged",
              "unknown",
              "failed",
              "refused",
              "denied",
              "pending",
              null
            ],
            "description": "On invoke responses and single reads: the receipt grade of the effect this invocation created. See `Effect.grade`. Absent when the invocation has no effect, and on list reads."
          },
          "retryOf": {
            "type": "string",
            "nullable": true,
            "description": "The failed invocation this one deliberately retried."
          },
          "retriedBy": {
            "type": "string",
            "nullable": true,
            "description": "On single reads: the invocation that retried this one."
          },
          "resolution": {
            "type": "object",
            "nullable": true,
            "description": "On single reads: the operator's confirmed outcome for an invocation that was unknown.",
            "required": [
              "outcome",
              "evidence",
              "externalReference",
              "resolvedBy",
              "resolvedAt"
            ],
            "properties": {
              "outcome": {
                "type": "string",
                "enum": [
                  "succeeded",
                  "failed"
                ]
              },
              "evidence": {
                "type": "string"
              },
              "externalReference": {
                "type": "string",
                "nullable": true
              },
              "resolvedBy": {
                "type": "object",
                "required": [
                  "type",
                  "id"
                ],
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "api_key",
                      "user"
                    ]
                  },
                  "id": {
                    "type": "string"
                  }
                }
              },
              "resolvedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "actionName": {
            "type": "string"
          },
          "actionVersionId": {
            "type": "string",
            "nullable": true,
            "example": "acv_01JABCDEF",
            "description": "The immutable action version this invocation ran. Lets an audit answer which definition executed a given call rather than inferring it. Null only for invocations recorded before versioning existed."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_approval",
              "running",
              "succeeded",
              "failed",
              "unknown",
              "denied",
              "expired"
            ],
            "description": "`unknown` means the request may have reached the destination and Anlyon cannot confirm what happened  a timeout, or a socket that died after the request was written. It is deliberately distinct from `failed`, which means the call did not happen: an error before anything left, such as a blocked URL or an invalid template. **Do not retry an `unknown` invocation automatically.** Reconcile it with the destination first; retrying is how one refund becomes two. This value is additive  clients that do not know it should treat an unrecognised status as not-successful rather than as failed."
          },
          "responseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "nullable": true
          },
          "body": {
            "type": "string",
            "nullable": true,
            "description": "Redacted and truncated upstream response body."
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "durationMs": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "approvalId": {
            "type": "string",
            "nullable": true
          },
          "decision": {
            "allOf": [
              {
                "$ref": "#/components/schemas/InvocationDecision"
              }
            ],
            "nullable": true,
            "description": "Why the request was allowed or refused, when a policy, a person or expiry decided it. Persisted on the invocation, so it reads the same after the policy is edited or deleted. Null while undecided, for an invocation that ran with no gate, and on rows recorded before this field existed. For a request that was never sent, `responseStatus` and `body` stay null: no response is fabricated."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "InvocationDecision": {
        "type": "object",
        "description": "A frozen, secret-free record of one decision. Contains no policy conditions, matchers, approver identities or request input.",
        "required": [
          "source",
          "code",
          "effect",
          "explanation",
          "policy",
          "decidedAt"
        ],
        "properties": {
          "source": {
            "type": "string",
            "enum": [
              "policy",
              "human",
              "system",
              "assistant"
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "POLICY_DENIED",
              "POLICY_APPROVED",
              "HUMAN_APPROVED",
              "HUMAN_DENIED",
              "APPROVAL_EXPIRED",
              "ASSISTANT_APPROVED",
              "END_USER_ERASED"
            ]
          },
          "effect": {
            "type": "string",
            "enum": [
              "approved",
              "denied",
              "expired"
            ],
            "description": "What actually happened to the request."
          },
          "explanation": {
            "type": "string",
            "example": "Denied by policy \"refund_order_denied\", version 2. The request was not sent."
          },
          "policy": {
            "type": "object",
            "nullable": true,
            "description": "The policy that decided, as it stood at decision time. Null when no policy decided.",
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string",
                "example": "apol_01JABCDEF"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            }
          },
          "decidedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Database time the decision was committed."
          }
        }
      },
      "InvocationResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Invocation"
          }
        }
      },
      "InvocationListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invocation"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "ActionVersion": {
        "type": "object",
        "description": "An immutable snapshot of an action's request-shaping definition. Editing an action appends one; nothing ever updates one. Identity (name, workspace, environment) belongs to the action, and `enabled` is an operational switch rather than part of a definition, so neither appears here.",
        "required": [
          "id",
          "version",
          "method",
          "urlTemplate",
          "headers",
          "bodyTemplate",
          "inputSchema",
          "requiresApproval",
          "governed",
          "impact",
          "verify",
          "secrets",
          "current",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "acv_01JABCDEF",
            "description": "Pin this from an agent version's config.actions."
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "description": "Monotonic per action, starting at 1."
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "urlTemplate": {
            "type": "string"
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "bodyTemplate": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "requiresApproval": {
            "type": "boolean",
            "description": "Part of the definition, so a rollback to this version restores its approval requirement too."
          },
          "adapter": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionAdapter"
              }
            ],
            "nullable": true,
            "description": "The adapter configuration this version pins, or null for a template version."
          },
          "governed": {
            "type": "boolean",
            "description": "Whether this version is governed. A pin or a rollback restores it with the request."
          },
          "impact": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionImpact"
              }
            ],
            "nullable": true,
            "description": "The impact this version declares, or null."
          },
          "verify": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionVerify"
              }
            ],
            "nullable": true,
            "description": "The read-back this version declares, or null."
          },
          "secrets": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Secret names this version references. Names only, never values."
          },
          "current": {
            "type": "boolean",
            "description": "Whether this is the action's present definition."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ActionVersionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActionVersion"
            }
          }
        }
      },
      "ActionInvocation": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Invocation"
          },
          {
            "type": "object",
            "required": [
              "pendingApproval"
            ],
            "properties": {
              "pendingApproval": {
                "type": "boolean"
              }
            }
          }
        ]
      },
      "ActionInvocationResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ActionInvocation"
          }
        }
      },
      "ImportActionsRequest": {
        "type": "object",
        "required": [
          "spec"
        ],
        "additionalProperties": false,
        "properties": {
          "spec": {
            "type": "object",
            "additionalProperties": true,
            "description": "OpenAPI 3.x document."
          },
          "baseUrl": {
            "type": "string",
            "format": "uri"
          },
          "auth": {
            "type": "object",
            "required": [
              "headerName",
              "secretName"
            ],
            "additionalProperties": false,
            "properties": {
              "headerName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "secretName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100,
                "pattern": "^[A-Z0-9_]+$"
              },
              "valueTemplate": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500,
                "example": "Bearer {{secret}}"
              }
            }
          },
          "requiresApproval": {
            "type": "boolean",
            "default": false
          },
          "dryRun": {
            "type": "boolean",
            "default": false
          },
          "only": {
            "type": "array",
            "maxItems": 200,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            }
          },
          "governed": {
            "type": "boolean",
            "default": true,
            "description": "Import every operation that is not a GET as a governed action declaring one resource mutation. `false` imports plain template actions."
          },
          "operations": {
            "type": "object",
            "maxProperties": 200,
            "description": "Settings chosen per operation, keyed by operationId or `METHOD /path`, usually accepted from a dry run's `suggestion`. An operation not named here gets the defaults. A key that names no operation in the spec, an operation named twice, or an impact an action would not accept fails the whole request with `400` before anything is created.",
            "additionalProperties": {
              "$ref": "#/components/schemas/ImportOperationChoice"
            },
            "example": {
              "PostRefunds": {
                "requiresApproval": true,
                "impact": {
                  "dimension": "money",
                  "unit": "usd",
                  "amount": "input.amount",
                  "bound": "exact"
                }
              },
              "DELETE /v1/customers/{customer}": {
                "requiresApproval": true
              }
            }
          }
        }
      },
      "ImportOperationChoice": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "requiresApproval": {
            "type": "boolean",
            "description": "Overrides the import-wide `requiresApproval` for this operation."
          },
          "impact": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActionImpact"
              }
            ],
            "nullable": true,
            "description": "The impact to declare instead of one resource mutation. `null` imports the operation as a plain template action."
          }
        }
      },
      "ImportSuggestion": {
        "type": "object",
        "required": [
          "risk",
          "reasons",
          "requiresApproval",
          "impact",
          "impactNote"
        ],
        "description": "Suggested from the spec alone, with no model call, so the same spec always gives the same suggestion. Never applied by itself.",
        "properties": {
          "risk": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "irreversible",
              "destructive"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The signals in the spec that produced the risk and the impact."
          },
          "requiresApproval": {
            "type": "boolean",
            "description": "True for an irreversible or destructive operation."
          },
          "impact": {
            "type": "object",
            "nullable": true,
            "description": "An impact in the shape an action declares, or null when the operation changes nothing. `unit` is null for money when the spec does not fix one currency; choose it before accepting.",
            "required": [
              "dimension",
              "unit",
              "amount",
              "bound"
            ],
            "properties": {
              "dimension": {
                "type": "string",
                "example": "money"
              },
              "unit": {
                "type": "string",
                "nullable": true,
                "example": "usd"
              },
              "amount": {
                "type": "string",
                "example": "input.amount"
              },
              "bound": {
                "type": "string",
                "enum": [
                  "exact",
                  "upper_bound"
                ]
              }
            }
          },
          "impactNote": {
            "type": "string",
            "nullable": true,
            "description": "What to check before accepting the impact."
          }
        }
      },
      "ImportedAction": {
        "type": "object",
        "required": [
          "name",
          "method",
          "path",
          "urlTemplate",
          "warnings",
          "governed",
          "impact",
          "requiresApproval",
          "customized",
          "suggestion",
          "proposedVerify",
          "verifyNote"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "path": {
            "type": "string"
          },
          "urlTemplate": {
            "type": "string"
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "governed": {
            "type": "boolean",
            "description": "True when the action was imported governed. A GET never is."
          },
          "impact": {
            "type": "object",
            "nullable": true,
            "description": "What a governed imported action declares it changes. One exact resource mutation unless `operations` chose another impact for it. Null for an ungoverned action.",
            "required": [
              "dimension",
              "amount",
              "bound"
            ],
            "properties": {
              "dimension": {
                "type": "string",
                "example": "resource_mutations"
              },
              "unit": {
                "type": "string"
              },
              "amount": {
                "type": "string",
                "example": "1"
              },
              "bound": {
                "type": "string",
                "enum": [
                  "exact",
                  "upper_bound"
                ]
              }
            }
          },
          "requiresApproval": {
            "type": "boolean",
            "description": "Whether each call waits for a person's approval."
          },
          "customized": {
            "type": "boolean",
            "description": "True when `operations` named this operation."
          },
          "suggestion": {
            "$ref": "#/components/schemas/ImportSuggestion"
          },
          "proposedVerify": {
            "type": "object",
            "nullable": true,
            "description": "A read-back rule the spec makes possible for this write, or null. It is NOT on the action. Check that it reads back what the write changed, then set it as the action's `verify`.",
            "required": [
              "url",
              "status",
              "match"
            ],
            "properties": {
              "url": {
                "type": "string",
                "example": "https://api.example.com/v1/pets/{{response.id}}"
              },
              "status": {
                "type": "integer",
                "example": 200
              },
              "match": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "path",
                    "equals"
                  ],
                  "properties": {
                    "path": {
                      "type": "string",
                      "example": "name"
                    },
                    "equals": {
                      "type": "string",
                      "example": "{{input.name}}"
                    }
                  }
                }
              }
            }
          },
          "verifyNote": {
            "type": "string",
            "nullable": true,
            "description": "Why no read-back is proposed",
            "or what to check before accepting the one that is. Null for an ungoverned action.": null
          },
          "action": {
            "$ref": "#/components/schemas/Action"
          }
        }
      },
      "SkippedActionOperation": {
        "type": "object",
        "required": [
          "path",
          "method",
          "reason"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      },
      "ImportActionsResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "created",
              "skipped",
              "dryRun",
              "suggestedAllowedHosts"
            ],
            "properties": {
              "created": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ImportedAction"
                }
              },
              "skipped": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SkippedActionOperation"
                }
              },
              "dryRun": {
                "type": "boolean"
              },
              "suggestedAllowedHosts": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "example": [
                  "api.stripe.com"
                ],
                "description": "Hosts the import's credential could be limited to, from the base URL and the spec's servers. Not applied; set them as the secret's `allowedHosts`."
              }
            }
          }
        }
      },
      "CreateApprovalRequest": {
        "type": "object",
        "required": [
          "title"
        ],
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "description": {
            "type": "string",
            "maxLength": 2000
          },
          "payload": {
            "type": "object",
            "additionalProperties": true
          },
          "expiresInSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 2592000
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Existing run in this API key environment for approval lifecycle spans."
          },
          "parentSpanId": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional parent span within runId."
          }
        }
      },
      "DecideApprovalRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "note": {
            "type": "string",
            "maxLength": 1000
          }
        }
      },
      "PolicyFilePlanRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source"
        ],
        "properties": {
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 262144,
            "description": "The policy file text (YAML or JSON). apiVersion anlyon.com/policies/v1."
          }
        }
      },
      "PolicyFileApplyRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "digest"
        ],
        "properties": {
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 262144
          },
          "digest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "example": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
            "description": "The digest from the plan you reviewed."
          },
          "changeNote": {
            "type": "string",
            "maxLength": 1000,
            "description": "Recorded on every version this apply writes. Defaults to \"Applied policy file <file>\"."
          }
        }
      },
      "PolicyFileTestRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "cases"
        ],
        "properties": {
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 262144
          },
          "cases": {
            "description": "Fixture cases as YAML/JSON text (a list, or an object with `cases`), or as a list. Each case has `name`, `request` { kind, action, input, agent, user, tags } and `expect` { effect and/or policy (a key in this file, another policy id, or null) }.",
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 262144
              },
              {
                "type": "array",
                "maxItems": 200,
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            ]
          }
        }
      },
      "PolicyFileChange": {
        "type": "object",
        "required": [
          "op",
          "key",
          "name"
        ],
        "properties": {
          "op": {
            "type": "string",
            "enum": [
              "create",
              "update",
              "delete",
              "unchanged"
            ]
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "policyId": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "fields": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "For updates: the fields that change."
          },
          "after": {
            "type": "object",
            "additionalProperties": true,
            "description": "For creates and updates: the policy as the file declares it."
          }
        }
      },
      "PolicyFilePlan": {
        "type": "object",
        "required": [
          "file",
          "environmentId",
          "digest",
          "changes",
          "summary",
          "errors"
        ],
        "properties": {
          "file": {
            "type": "string"
          },
          "environmentId": {
            "type": "string",
            "format": "uuid"
          },
          "digest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$",
            "example": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
          },
          "changes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PolicyFileChange"
            }
          },
          "summary": {
            "type": "object",
            "required": [
              "create",
              "update",
              "delete",
              "unchanged"
            ],
            "properties": {
              "create": {
                "type": "integer"
              },
              "update": {
                "type": "integer"
              },
              "delete": {
                "type": "integer"
              },
              "unchanged": {
                "type": "integer"
              }
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Problems that prevent applying. Empty when the file can be applied."
          }
        }
      },
      "PolicyFileTestResult": {
        "type": "object",
        "required": [
          "file",
          "passed",
          "failed",
          "results"
        ],
        "properties": {
          "file": {
            "type": "string"
          },
          "passed": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "pass",
                "policy",
                "effect",
                "explanation"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "pass": {
                  "type": "boolean"
                },
                "policy": {
                  "type": "string",
                  "nullable": true,
                  "description": "The governing policy: a key in this file, another policy id, or null."
                },
                "effect": {
                  "type": "string",
                  "enum": [
                    "require_approval",
                    "auto_approve",
                    "auto_deny"
                  ]
                },
                "explanation": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ApprovalPolicyVersionPage": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalPolicyVersion"
            }
          },
          "pagination": {
            "type": "object",
            "required": [
              "limit",
              "nextBefore",
              "earliestVersion",
              "latestVersion"
            ],
            "properties": {
              "limit": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "nextBefore": {
                "type": "integer",
                "nullable": true,
                "description": "Pass as `before` for the next (older) page. Null on the last page."
              },
              "earliestVersion": {
                "type": "integer",
                "minimum": 1,
                "description": "The oldest retained version."
              },
              "latestVersion": {
                "type": "integer",
                "minimum": 1
              }
            }
          }
        }
      },
      "ApprovalPolicyVersion": {
        "type": "object",
        "required": [
          "policyId",
          "version",
          "operation",
          "snapshot",
          "contentHash",
          "actor",
          "changeNote",
          "createdAt"
        ],
        "properties": {
          "policyId": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "operation": {
            "type": "string",
            "enum": [
              "created",
              "updated",
              "deleted",
              "baseline"
            ]
          },
          "snapshot": {
            "type": "object",
            "additionalProperties": true,
            "description": "Immutable database row snapshot with snake_case field names. A deletion tombstone carries the next version number."
          },
          "contentHash": {
            "type": "string",
            "description": "SHA-256 of PostgreSQL snapshot jsonb text encoded as UTF-8. An integrity digest, not a signature."
          },
          "actor": {
            "type": "object",
            "nullable": true,
            "required": [
              "type",
              "id"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "api_key",
                  "user",
                  "unknown"
                ]
              },
              "id": {
                "type": "string"
              }
            }
          },
          "changeNote": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EvaluateApprovalPoliciesRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "action",
              "custom"
            ]
          },
          "actionName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Required for action contexts; forbidden for custom contexts."
          },
          "agentId": {
            "type": "string",
            "maxLength": 60,
            "nullable": true,
            "description": "Hypothetical attribution, never runtime authority."
          },
          "userId": {
            "type": "string",
            "maxLength": 200,
            "nullable": true
          },
          "payload": {
            "type": "object",
            "additionalProperties": true,
            "description": "Action input or custom payload. Amount is read from the numeric amount field; only custom requests use the tags field."
          }
        }
      },
      "PolicyEvaluation": {
        "type": "object",
        "required": [
          "evaluation",
          "environmentId",
          "decision",
          "limitations"
        ],
        "properties": {
          "evaluation": {
            "type": "string",
            "enum": [
              "policy_only"
            ]
          },
          "environmentId": {
            "type": "string"
          },
          "limitations": {
            "type": "string"
          },
          "decision": {
            "type": "object",
            "required": [
              "matched",
              "effect",
              "requiredApprovals",
              "matchedPolicyId",
              "matchedPolicyVersion",
              "matchedPolicyName",
              "matchedActionName",
              "explanation"
            ],
            "properties": {
              "matched": {
                "type": "boolean"
              },
              "effect": {
                "type": "string",
                "enum": [
                  "require_approval",
                  "auto_approve",
                  "auto_deny"
                ]
              },
              "requiredApprovals": {
                "type": "integer"
              },
              "matchedPolicyId": {
                "type": "string",
                "nullable": true
              },
              "matchedPolicyVersion": {
                "type": "integer",
                "nullable": true
              },
              "matchedPolicyName": {
                "type": "string",
                "nullable": true
              },
              "matchedActionName": {
                "type": "string",
                "nullable": true
              },
              "explanation": {
                "type": "string"
              }
            }
          }
        }
      },
      "ApprovalActor": {
        "type": "object",
        "required": [
          "type",
          "id",
          "displayName"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "api_key",
              "user"
            ]
          },
          "id": {
            "type": "string",
            "description": "Stable recorded reviewer identity. Never an API key value."
          },
          "displayName": {
            "type": "string",
            "nullable": true,
            "description": "Null when no historical display name was recorded."
          }
        }
      },
      "ApprovalVote": {
        "type": "object",
        "required": [
          "decision",
          "decidedBy",
          "note",
          "selfApproved",
          "decidedAt"
        ],
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approve",
              "deny"
            ]
          },
          "decidedBy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ApprovalActor"
              }
            ],
            "nullable": true
          },
          "note": {
            "type": "string",
            "nullable": true
          },
          "selfApproved": {
            "type": "boolean",
            "description": "True when an app acting for the decider, or an API key they created, requested the approval. Allowed only while the decider is the only member who can decide approvals in its environment; with a second one, the request answers 403 SELF_APPROVAL_NOT_ALLOWED."
          },
          "decidedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Approval": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "status",
          "title",
          "description",
          "payload",
          "decisionNote",
          "requiredApprovals",
          "approvedCount",
          "matchedPolicyId",
          "matchedPolicyVersion",
          "policyExplanation",
          "decisionOrigin",
          "endUserId",
          "decider",
          "expiresAt",
          "decidedAt",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "apr_01JABCDEF"
          },
          "kind": {
            "type": "string",
            "enum": [
              "action",
              "custom",
              "function_plan"
            ],
            "description": "`function_plan`: the writes a hosted function's plan run recorded, bound to the plan's digest in `payload.planDigest`."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "denied",
              "expired"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "payload": {
            "type": "object",
            "additionalProperties": true,
            "description": "Secret-safe review payload."
          },
          "decisionNote": {
            "type": "string",
            "nullable": true
          },
          "decidedBy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ApprovalActor"
              }
            ],
            "nullable": true,
            "description": "The recorded reviewer who finalized the decision, not all voters. Null for pending, expired, automated or unattributed decisions. Available to approval readers; not copied into invocation responses."
          },
          "votes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalVote"
            },
            "description": "Recorded votes in chronological order on detail reads, including long-poll results. Omitted on list, create and decide responses; fetch the detail to audit all reviewers."
          },
          "requiredApprovals": {
            "type": "integer",
            "minimum": 1,
            "description": "Distinct approvers needed (N-of-M), as resolved from the governing policy when the approval was created."
          },
          "approvedCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Approvals recorded so far."
          },
          "matchedPolicyId": {
            "type": "string",
            "nullable": true,
            "description": "The policy that governed this approval, as recorded when it was created. Null when no policy matched (the default gate applied) and on approvals recorded before policies existed."
          },
          "matchedPolicyVersion": {
            "type": "integer",
            "nullable": true,
            "description": "The version of that policy at the time. Null exactly when matchedPolicyId is null."
          },
          "policyExplanation": {
            "type": "string",
            "nullable": true,
            "description": "A human-readable account of how the policy was applied. Null on approvals recorded before it was kept. It is the approval's own record; an invocation carries its own `decision` and does not need this."
          },
          "decisionOrigin": {
            "type": "string",
            "nullable": true,
            "enum": [
              "human",
              "policy",
              "system",
              "unknown",
              "assistant",
              null
            ],
            "description": "Who decided. Persisted, not inferred from status. Null while pending. `unknown` marks a decision made before origin was recorded whose evidence does not settle it; it is never guessed. `assistant` is an approval by opt-in Anlyon Vigil inside the limits an admin set; it never denies."
          },
          "endUserId": {
            "type": "string",
            "nullable": true,
            "description": "The end user the gated call was made for (`Anlyon-End-User`), or null for a call with the workspace's own accounts. `erased~<hash>` once that end user is erased."
          },
          "decider": {
            "type": "string",
            "enum": [
              "team",
              "end_user"
            ],
            "description": "Who decides it. `end_user`: the end user it was made for, in your app, through /api/v2/end-users/{endUserId}/approvals (a policy with `decidedBy: end_user`). Such an approval is not in the team's inbox or Slack, and the team's decide routes answer 404 for it. Not `decidedBy`, which is the reviewer."
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "decidedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "advice": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AssistantAdvice"
              }
            ],
            "description": "Anlyon Vigil's suggestion, on dashboard (session) responses only and only for workspaces that opted in. API-key callers never receive it."
          }
        }
      },
      "ApprovalResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Approval"
          }
        }
      },
      "ApprovalListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Approval"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "ApprovalDecision": {
        "type": "object",
        "required": [
          "approval",
          "selfApproved"
        ],
        "properties": {
          "approval": {
            "$ref": "#/components/schemas/Approval"
          },
          "selfApproved": {
            "type": "boolean",
            "description": "This decision was a self-approval (see ApprovalVote.selfApproved)."
          },
          "invocation": {
            "$ref": "#/components/schemas/Invocation"
          }
        }
      },
      "ApprovalDecisionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/ApprovalDecision"
          }
        }
      },
      "AssistantAdvice": {
        "type": "object",
        "description": "Advice from opt-in Anlyon Vigil. Not a decision. `reasons` are templates over the model's numeric answers; no model-written text is shown. A missing suggestion never blocks review.",
        "required": [
          "status",
          "statusReason",
          "model",
          "recommendation",
          "risk",
          "riskLevel",
          "confidence",
          "reasons",
          "flags",
          "history",
          "auditRequested",
          "auditVerdict",
          "createdAt",
          "completedAt"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "ready",
              "failed",
              "skipped"
            ]
          },
          "statusReason": {
            "type": "string",
            "nullable": true,
            "description": "Why advice failed or was skipped, e.g. `quota_exceeded`, `timeout`, `already_decided`."
          },
          "model": {
            "type": "string",
            "nullable": true,
            "example": "vigil-1",
            "description": "Vigil's public model version. Auto-approve thresholds are calibrated per version."
          },
          "recommendation": {
            "type": "string",
            "nullable": true,
            "enum": [
              "approve",
              "deny",
              "review",
              null
            ]
          },
          "risk": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 4,
            "description": "Expected harm if approving were wrong, 0 routine to 4 critical."
          },
          "riskLevel": {
            "type": "string",
            "nullable": true,
            "enum": [
              "routine",
              "low",
              "moderate",
              "high",
              "critical",
              null
            ]
          },
          "confidence": {
            "type": "number",
            "nullable": true,
            "minimum": 0,
            "maximum": 1
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "flags": {
            "type": "object",
            "nullable": true,
            "required": [
              "injectionSuspected",
              "consistentWithHistory",
              "amountUnusual"
            ],
            "properties": {
              "injectionSuspected": {
                "type": "number",
                "nullable": true,
                "minimum": 0,
                "maximum": 1
              },
              "consistentWithHistory": {
                "type": "number",
                "nullable": true,
                "minimum": 0,
                "maximum": 1
              },
              "amountUnusual": {
                "type": "number",
                "nullable": true,
                "minimum": 0,
                "maximum": 1
              }
            }
          },
          "history": {
            "type": "object",
            "nullable": true,
            "description": "This agent and action over the last 30 days.",
            "required": [
              "approved",
              "denied",
              "maxAmount",
              "medianAmount"
            ],
            "properties": {
              "approved": {
                "type": "integer",
                "minimum": 0
              },
              "denied": {
                "type": "integer",
                "minimum": 0
              },
              "maxAmount": {
                "type": "number",
                "nullable": true
              },
              "medianAmount": {
                "type": "number",
                "nullable": true
              }
            }
          },
          "auditRequested": {
            "type": "boolean",
            "description": "This Vigil decision was sampled for a person to check."
          },
          "auditVerdict": {
            "type": "string",
            "nullable": true,
            "enum": [
              "agree",
              "disagree",
              null
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "BudgetDimensions": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "messages": {
            "type": "integer",
            "minimum": 0
          },
          "eventPublishes": {
            "type": "integer",
            "minimum": 0
          },
          "cacheLookups": {
            "type": "integer",
            "minimum": 0
          },
          "memoryOps": {
            "type": "integer",
            "minimum": 0
          },
          "actionInvokes": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "PutBudgetRequest": {
        "type": "object",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "monthlyCostCentsCap": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "dimensionCaps": {
            "$ref": "#/components/schemas/BudgetDimensions"
          },
          "alertThreshold": {
            "type": "number",
            "minimum": 0.1,
            "maximum": 1,
            "default": 0.8
          },
          "enabled": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "Budget": {
        "type": "object",
        "required": [
          "workspaceId",
          "apiKeyId",
          "monthlyCostCentsCap",
          "dimensionCaps",
          "alertThreshold",
          "enabled",
          "usage",
          "estimatedCostCents",
          "reconciliationRequired",
          "alertedAt"
        ],
        "properties": {
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "apiKeyId": {
            "type": "string",
            "format": "uuid"
          },
          "monthlyCostCentsCap": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "dimensionCaps": {
            "$ref": "#/components/schemas/BudgetDimensions"
          },
          "alertThreshold": {
            "type": "number",
            "minimum": 0.1,
            "maximum": 1
          },
          "enabled": {
            "type": "boolean"
          },
          "usage": {
            "allOf": [
              {
                "$ref": "#/components/schemas/BudgetDimensions"
              },
              {
                "type": "object",
                "required": [
                  "messages",
                  "eventPublishes",
                  "cacheLookups",
                  "memoryOps",
                  "actionInvokes"
                ]
              }
            ]
          },
          "estimatedCostCents": {
            "type": "number",
            "minimum": 0
          },
          "reconciliationRequired": {
            "type": "boolean",
            "description": "Legacy current-month usage is unknown. Budgeted admissions return 503 BUDGET_RECONCILIATION_REQUIRED until an operator imports a verified usage floor; displayed usage is incomplete while true."
          },
          "alertedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "BudgetResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Budget"
          }
        }
      },
      "BudgetListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Budget"
            }
          }
        }
      },
      "SessionMessageInput": {
        "type": "object",
        "required": [
          "role",
          "content"
        ],
        "additionalProperties": false,
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1048576
          },
          "toolCallId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "CreateSessionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "messages": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/SessionMessageInput"
            }
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Existing run in this API key environment for session-write spans."
          },
          "parentSpanId": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional parent span within runId."
          }
        }
      },
      "UpdateSessionRequest": {
        "type": "object",
        "minProperties": 1,
        "additionalProperties": false,
        "properties": {
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "AppendSessionMessagesRequest": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "role",
              "content"
            ],
            "additionalProperties": false,
            "properties": {
              "role": {
                "type": "string",
                "enum": [
                  "system",
                  "user",
                  "assistant",
                  "tool"
                ]
              },
              "content": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1048576
              },
              "toolCallId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "metadata": {
                "type": "object",
                "additionalProperties": true
              },
              "runId": {
                "type": "string",
                "maxLength": 80,
                "description": "Existing run in this API key environment for session-write spans."
              },
              "parentSpanId": {
                "type": "string",
                "maxLength": 80,
                "description": "Optional parent span within runId."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "messages"
            ],
            "additionalProperties": false,
            "properties": {
              "messages": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "$ref": "#/components/schemas/SessionMessageInput"
                }
              },
              "runId": {
                "type": "string",
                "maxLength": 80,
                "description": "Existing run in this API key environment for session-write spans."
              },
              "parentSpanId": {
                "type": "string",
                "maxLength": 80,
                "description": "Optional parent span within runId."
              }
            }
          }
        ]
      },
      "Session": {
        "type": "object",
        "required": [
          "id",
          "title",
          "metadata",
          "summary",
          "summaryUpToIndex",
          "messageCount",
          "totalTokens",
          "lastActiveAt",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "ses_01JABCDEF"
          },
          "title": {
            "type": "string",
            "nullable": true,
            "example": "Support conversation"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "summaryUpToIndex": {
            "type": "integer",
            "minimum": 0
          },
          "messageCount": {
            "type": "integer",
            "minimum": 0
          },
          "totalTokens": {
            "type": "integer",
            "minimum": 0
          },
          "lastActiveAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SessionMessage": {
        "type": "object",
        "required": [
          "index",
          "role",
          "content",
          "toolCallId",
          "tokenCount",
          "metadata",
          "createdAt"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 0
          },
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool"
            ]
          },
          "content": {
            "type": "string"
          },
          "toolCallId": {
            "type": "string",
            "nullable": true
          },
          "tokenCount": {
            "type": "integer",
            "minimum": 0
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OffsetPagination": {
        "type": "object",
        "required": [
          "total",
          "page",
          "limit",
          "totalPages",
          "hasMore"
        ],
        "properties": {
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1
          },
          "totalPages": {
            "type": "integer",
            "minimum": 0
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "SessionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Session"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "SessionMessageListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionMessage"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/OffsetPagination"
          }
        }
      },
      "SessionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Session"
          }
        }
      },
      "SessionMessageResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/SessionMessage"
          }
        }
      },
      "SessionMessagesAppendedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "sessionId",
              "appended",
              "messages"
            ],
            "properties": {
              "sessionId": {
                "type": "string"
              },
              "appended": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              },
              "messages": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SessionMessage"
                }
              }
            }
          }
        }
      },
      "DeletedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "deleted"
            ],
            "properties": {
              "deleted": {
                "type": "boolean",
                "enum": [
                  true
                ]
              }
            }
          }
        }
      },
      "SessionMessagesClearedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "sessionId",
              "deleted"
            ],
            "properties": {
              "sessionId": {
                "type": "string"
              },
              "deleted": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      },
      "SessionContext": {
        "type": "object",
        "required": [
          "sessionId",
          "summary",
          "messages",
          "tokensUsed",
          "truncated"
        ],
        "properties": {
          "sessionId": {
            "type": "string"
          },
          "summary": {
            "type": "string",
            "nullable": true
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SessionMessage"
            }
          },
          "tokensUsed": {
            "type": "integer",
            "minimum": 0
          },
          "truncated": {
            "type": "boolean"
          }
        }
      },
      "SessionContextResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/SessionContext"
          }
        }
      },
      "AssembleContextRequest": {
        "type": "object",
        "additionalProperties": false,
        "anyOf": [
          {
            "required": [
              "query"
            ]
          },
          {
            "required": [
              "sessionId"
            ]
          }
        ],
        "properties": {
          "query": {
            "type": "string",
            "minLength": 1,
            "maxLength": 8192
          },
          "maxTokens": {
            "type": "integer",
            "minimum": 100,
            "maximum": 128000,
            "default": 4000
          },
          "sessionId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "runId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Optional run to correlate session context assembly."
          },
          "parentSpanId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Optional parent span within runId."
          },
          "collections": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "items": {
              "type": "string"
            }
          },
          "filter": {
            "type": "object",
            "additionalProperties": true
          },
          "topK": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "default": 10
          },
          "include": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "memories": {
                "type": "boolean",
                "default": true
              },
              "session": {
                "type": "boolean",
                "default": true
              }
            }
          }
        }
      },
      "ContextBlock": {
        "type": "object",
        "required": [
          "type",
          "content",
          "source",
          "tokens"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "memory",
              "session"
            ]
          },
          "content": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "tokens": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "AssembledContext": {
        "type": "object",
        "required": [
          "blocks",
          "text",
          "tokensUsed",
          "maxTokens"
        ],
        "properties": {
          "blocks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContextBlock"
            }
          },
          "text": {
            "type": "string"
          },
          "tokensUsed": {
            "type": "integer",
            "minimum": 0
          },
          "maxTokens": {
            "type": "integer",
            "minimum": 100,
            "maximum": 128000
          }
        }
      },
      "AssembledContextResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/AssembledContext"
          }
        }
      },
      "PublishMessageRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Destination URL for the message",
            "example": "https://example.com/webhook"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "default": "POST",
            "description": "HTTP method to use"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Custom headers to include in the request",
            "example": {
              "Authorization": "Bearer token123",
              "Content-Type": "application/json"
            }
          },
          "body": {
            "description": "Request body (can be any JSON value)",
            "example": {
              "event": "user_created",
              "userId": 123
            }
          },
          "queue": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]+$",
            "description": "Named queue for this delivery. Anlyon-Queue header takes precedence.",
            "example": "critical"
          },
          "executeAt": {
            "type": "integer",
            "minimum": 0,
            "format": "int64",
            "description": "Unix timestamp in seconds. Cannot be combined with scheduledFor.",
            "example": 1798761599
          },
          "scheduledFor": {
            "type": "string",
            "format": "date-time",
            "deprecated": true,
            "x-anlyon-replacement": "executeAt",
            "x-anlyon-removal-date": "2027-07-13",
            "description": "Deprecated ISO 8601 delivery time retained for compatibility. Use executeAt. Cannot be combined with executeAt.",
            "example": "2024-12-31T23:59:59Z"
          },
          "maxRetries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "default": 3,
            "description": "Maximum number of retry attempts"
          },
          "contentId": {
            "type": "string",
            "description": "Optional 24-hour content-deduplication identifier. This is independent of the Idempotency-Key header.",
            "example": "user-123-welcome-email"
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "description": "URL to receive delivery status updates",
            "example": "https://example.com/callback"
          },
          "failureCallbackUrl": {
            "type": "string",
            "format": "uri",
            "description": "URL to receive failure notifications",
            "example": "https://example.com/failure-callback"
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Existing run in this API key environment for queue-delivery spans."
          },
          "parentSpanId": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional parent span within runId."
          },
          "flowControl": {
            "type": "object",
            "required": [
              "key"
            ],
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100,
                "pattern": "^[a-zA-Z0-9_-]+(?::[a-zA-Z0-9_-]+)*$",
                "example": "tenant:acme"
              },
              "rateLimit": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000,
                "example": 100
              },
              "rateLimitWindow": {
                "type": "integer",
                "minimum": 1,
                "maximum": 3600,
                "example": 60
              },
              "parallelism": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000,
                "example": 10
              }
            }
          }
        }
      },
      "PublishGroupMessageRequest": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "default": "POST"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "description": "Request body"
          },
          "queue": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "executeAt": {
            "type": "integer",
            "minimum": 0,
            "format": "int64"
          },
          "scheduledFor": {
            "type": "string",
            "format": "date-time",
            "deprecated": true,
            "x-anlyon-replacement": "executeAt",
            "x-anlyon-removal-date": "2027-07-13"
          },
          "maxRetries": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "default": 3
          },
          "contentId": {
            "type": "string",
            "description": "Optional 24-hour content-deduplication identifier."
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "failureCallbackUrl": {
            "type": "string",
            "format": "uri"
          },
          "runId": {
            "type": "string",
            "maxLength": 80,
            "description": "Existing run in this API key environment for queue-delivery spans."
          },
          "parentSpanId": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional parent span within runId."
          },
          "flowControl": {
            "type": "object",
            "required": [
              "key"
            ],
            "properties": {
              "key": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100,
                "pattern": "^[a-zA-Z0-9_-]+(?::[a-zA-Z0-9_-]+)*$"
              },
              "rateLimit": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000
              },
              "rateLimitWindow": {
                "type": "integer",
                "minimum": 1,
                "maximum": 3600
              },
              "parallelism": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1000
              }
            }
          }
        }
      },
      "CreateScheduleRequest": {
        "type": "object",
        "required": [
          "name",
          "cronExpression",
          "url"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "description": "Human-readable name for the schedule",
            "example": "Daily Report"
          },
          "cronExpression": {
            "type": "string",
            "description": "Cron expression defining the schedule",
            "example": "0 9 * * *"
          },
          "timezone": {
            "type": "string",
            "default": "UTC",
            "description": "Timezone for the cron schedule",
            "example": "America/New_York"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Destination URL",
            "example": "https://example.com/webhook"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "default": "POST"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "description": "Request body"
          }
        }
      },
      "UpdateScheduleRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "cronExpression": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "description": "Request body"
          },
          "isPaused": {
            "type": "boolean"
          }
        }
      },
      "CreateUrlGroupRequest": {
        "type": "object",
        "required": [
          "name",
          "endpoints"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "example": "Production Webhooks"
          },
          "endpoints": {
            "type": "array",
            "minItems": 1,
            "maxItems": 50,
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "example": "https://example.com/webhook"
                },
                "name": {
                  "type": "string",
                  "maxLength": 100,
                  "example": "Primary Endpoint"
                },
                "retryCount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 10,
                  "default": 3
                }
              }
            }
          }
        }
      },
      "AddEndpointRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/webhook"
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "example": "Primary Endpoint"
          },
          "retryCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "default": 3
          }
        }
      },
      "UpdateNotificationPreferencesRequest": {
        "type": "object",
        "minProperties": 1,
        "properties": {
          "emailEnabled": {
            "type": "boolean"
          },
          "webhookEnabled": {
            "type": "boolean"
          },
          "inAppEnabled": {
            "type": "boolean"
          },
          "slackEnabled": {
            "type": "boolean"
          },
          "discordEnabled": {
            "type": "boolean"
          },
          "emailRecipients": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "webhookUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "webhookSecret": {
            "type": "string",
            "maxLength": 4096,
            "nullable": true,
            "writeOnly": true,
            "description": "Set or rotate the signing secret; use null to remove it. The stored value is never returned."
          },
          "quotaAlertThresholds": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100
            }
          },
          "enabledTypes": {
            "type": "array",
            "maxItems": 15,
            "items": {
              "type": "string",
              "enum": [
                "quota_warning",
                "quota_exceeded",
                "payment_failed",
                "plan_upgraded",
                "plan_downgraded",
                "feature_enabled",
                "system_alert",
                "security_alert",
                "delivery_failure_spike",
                "api_key_expiring",
                "approval_requested",
                "budget_alert",
                "approval_expired",
                "outcome_unknown",
                "connection_broken"
              ]
            }
          }
        }
      },
      "PublicMessage": {
        "type": "object",
        "required": [
          "messageId",
          "url",
          "method",
          "headers",
          "body",
          "scheduledFor",
          "status",
          "attempts",
          "maxRetries",
          "responseStatus",
          "responseBody",
          "errorMessage",
          "deliveredAt",
          "failedAt",
          "callbackUrl",
          "failureCallbackUrl",
          "flowControlKey",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "messageId": {
            "type": "string",
            "pattern": "^msg_",
            "example": "msg_1234567890abcdef"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/webhook"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "example": "POST"
          },
          "headers": {
            "type": "object",
            "nullable": true,
            "description": "Delivery headers. Authorization, cookies, and API key values are returned as [REDACTED].",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "nullable": true,
            "description": "Request body"
          },
          "scheduledFor": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "scheduled",
              "processing",
              "delivered",
              "failed",
              "cancelled"
            ],
            "example": "delivered"
          },
          "attempts": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "maxRetries": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          },
          "responseStatus": {
            "type": "integer",
            "minimum": 100,
            "maximum": 599,
            "nullable": true
          },
          "responseBody": {
            "type": "string",
            "nullable": true
          },
          "errorMessage": {
            "type": "string",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "failedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "callbackUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "failureCallbackUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "flowControlKey": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "example": {
          "messageId": "msg_1234567890abcdef",
          "url": "https://example.com/webhook",
          "method": "POST",
          "headers": {
            "Authorization": "[REDACTED]"
          },
          "body": {
            "event": "user_created"
          },
          "scheduledFor": null,
          "status": "delivered",
          "attempts": 1,
          "maxRetries": 3,
          "responseStatus": 204,
          "responseBody": null,
          "errorMessage": null,
          "deliveredAt": "2026-07-13T12:00:01Z",
          "failedAt": null,
          "callbackUrl": null,
          "failureCallbackUrl": null,
          "flowControlKey": null,
          "createdAt": "2026-07-13T12:00:00Z",
          "updatedAt": "2026-07-13T12:00:01Z"
        }
      },
      "PublicSchedule": {
        "type": "object",
        "required": [
          "scheduleId",
          "name",
          "cronExpression",
          "timezone",
          "url",
          "method",
          "headers",
          "body",
          "isActive",
          "isPaused",
          "nextRunAt",
          "lastRunAt",
          "lastStatus",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "scheduleId": {
            "type": "string",
            "pattern": "^sch_",
            "example": "sch_1234567890abcdef"
          },
          "name": {
            "type": "string",
            "example": "Daily Report"
          },
          "cronExpression": {
            "type": "string",
            "example": "0 9 * * *"
          },
          "timezone": {
            "type": "string",
            "nullable": true,
            "example": "America/New_York"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/webhook"
          },
          "method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "example": "POST"
          },
          "headers": {
            "type": "object",
            "nullable": true,
            "description": "Delivery headers with sensitive values redacted.",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "nullable": true,
            "description": "Request body"
          },
          "isActive": {
            "type": "boolean",
            "example": true
          },
          "isPaused": {
            "type": "boolean",
            "example": false
          },
          "nextRunAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastRunAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastStatus": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "example": {
          "scheduleId": "sch_1234567890abcdef",
          "name": "Daily Report",
          "cronExpression": "0 9 * * *",
          "timezone": "UTC",
          "url": "https://example.com/webhook",
          "method": "POST",
          "headers": {},
          "body": {
            "report": "daily"
          },
          "isActive": true,
          "isPaused": false,
          "nextRunAt": "2026-07-14T09:00:00Z",
          "lastRunAt": null,
          "lastStatus": null,
          "createdAt": "2026-07-13T12:00:00Z",
          "updatedAt": "2026-07-13T12:00:00Z"
        }
      },
      "PublicUrlGroup": {
        "type": "object",
        "required": [
          "groupId",
          "name",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "groupId": {
            "type": "string",
            "pattern": "^grp_",
            "example": "grp_1234567890abcdef"
          },
          "name": {
            "type": "string",
            "example": "Production Webhooks"
          },
          "endpointCount": {
            "type": "integer",
            "minimum": 0,
            "example": 2
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicUrlGroupWithEndpoints": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PublicUrlGroup"
          },
          {
            "type": "object",
            "required": [
              "endpoints"
            ],
            "properties": {
              "endpoints": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PublicUrlGroupEndpoint"
                }
              }
            }
          }
        ],
        "example": {
          "groupId": "grp_1234567890abcdef",
          "name": "Production Webhooks",
          "endpointCount": 1,
          "endpoints": [
            {
              "id": "123e4567-e89b-12d3-a456-426614174000",
              "url": "https://example.com/webhook",
              "name": "Primary Endpoint",
              "retryCount": 3,
              "createdAt": "2026-07-13T12:00:00Z"
            }
          ],
          "createdAt": "2026-07-13T12:00:00Z",
          "updatedAt": "2026-07-13T12:00:00Z"
        }
      },
      "PublicUrlGroupEndpoint": {
        "type": "object",
        "required": [
          "id",
          "url",
          "name",
          "retryCount",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "example": "https://example.com/webhook"
          },
          "name": {
            "type": "string",
            "nullable": true,
            "example": "Primary Endpoint"
          },
          "retryCount": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "nullable": true,
            "example": 3
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicUrlGroupPublishResult": {
        "type": "object",
        "required": [
          "publishedCount",
          "failedCount",
          "messages",
          "failures"
        ],
        "properties": {
          "publishedCount": {
            "type": "integer",
            "minimum": 0,
            "example": 1
          },
          "failedCount": {
            "type": "integer",
            "minimum": 0,
            "example": 1
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "messageId",
                "endpointUrl"
              ],
              "properties": {
                "messageId": {
                  "type": "string",
                  "pattern": "^msg_",
                  "example": "msg_1234567890abcdef"
                },
                "endpointUrl": {
                  "type": "string",
                  "format": "uri",
                  "example": "https://example.com/webhook"
                }
              }
            }
          },
          "failures": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "url",
                "error"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "example": "https://unavailable.example.com/webhook"
                },
                "error": {
                  "type": "string",
                  "example": "Destination temporarily unavailable"
                }
              }
            }
          }
        }
      },
      "Notification": {
        "type": "object",
        "required": [
          "id",
          "type",
          "priority",
          "title",
          "message",
          "metadata",
          "actionUrl",
          "actionLabel",
          "isRead",
          "readAt",
          "createdAt",
          "expiresAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string",
            "enum": [
              "quota_warning",
              "quota_exceeded",
              "payment_failed",
              "plan_upgraded",
              "plan_downgraded",
              "feature_enabled",
              "system_alert",
              "security_alert",
              "delivery_failure_spike",
              "api_key_expiring",
              "approval_requested",
              "budget_alert",
              "approval_expired",
              "outcome_unknown",
              "connection_broken"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "critical"
            ]
          },
          "title": {
            "type": "string",
            "example": "Quota Warning"
          },
          "message": {
            "type": "string",
            "example": "You have used 75% of your daily message quota"
          },
          "metadata": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true
          },
          "actionUrl": {
            "type": "string",
            "nullable": true
          },
          "actionLabel": {
            "type": "string",
            "nullable": true
          },
          "isRead": {
            "type": "boolean",
            "default": false
          },
          "readAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "NotificationPreferences": {
        "type": "object",
        "required": [
          "emailEnabled",
          "webhookEnabled",
          "inAppEnabled",
          "slackEnabled",
          "discordEnabled",
          "emailRecipients",
          "webhookUrl",
          "hasWebhookSecret",
          "quotaAlertThresholds",
          "enabledTypes",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "emailEnabled": {
            "type": "boolean",
            "default": true
          },
          "webhookEnabled": {
            "type": "boolean",
            "default": false
          },
          "inAppEnabled": {
            "type": "boolean",
            "default": true
          },
          "slackEnabled": {
            "type": "boolean"
          },
          "discordEnabled": {
            "type": "boolean"
          },
          "emailRecipients": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "webhookUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "hasWebhookSecret": {
            "type": "boolean",
            "description": "Whether a signing secret is stored. The value itself is never returned."
          },
          "quotaAlertThresholds": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "example": [
              50,
              75,
              90,
              100
            ]
          },
          "enabledTypes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "quota_warning",
                "quota_exceeded",
                "payment_failed",
                "plan_upgraded",
                "plan_downgraded",
                "feature_enabled",
                "system_alert",
                "security_alert",
                "delivery_failure_spike",
                "api_key_expiring",
                "approval_requested",
                "budget_alert",
                "approval_expired",
                "outcome_unknown",
                "connection_broken"
              ]
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EndUserConnectionError": {
        "type": "object",
        "required": [
          "success",
          "error",
          "requestId"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "requestId": {
            "type": "string",
            "example": "req_0123456789abcdef0123456789abcdef"
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "example": "END_USER_NOT_CONNECTED",
                "description": "END_USER_NOT_CONNECTED, END_USER_RECONNECT_REQUIRED, or another conflict code."
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "object"
              },
              "integration": {
                "type": "string",
                "example": "gmail",
                "description": "The integration the end user needs to connect. Present on the two end-user codes."
              },
              "endUserId": {
                "type": "string",
                "example": "user_123",
                "description": "Present on the two end-user codes."
              },
              "connectUrl": {
                "type": "string",
                "format": "uri",
                "description": "A fresh connect link on the environment's default redirect URL. Absent without a default redirect URL",
                "and for an API-key integration.": null
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "description": "When connectUrl expires."
              },
              "fix": {
                "$ref": "#/components/schemas/ErrorFix"
              }
            }
          }
        }
      },
      "EndUserConnection": {
        "type": "object",
        "required": [
          "integration",
          "kind",
          "status",
          "scopes",
          "connectedAt",
          "updatedAt"
        ],
        "properties": {
          "integration": {
            "type": "string",
            "example": "gmail"
          },
          "kind": {
            "type": "string",
            "enum": [
              "oauth",
              "api_key"
            ],
            "description": "Connected by signing in",
            "or with the end user's own key.": null
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "needs_reconnect",
              "revoked"
            ],
            "description": "`needs_reconnect` once the provider refused the grant or a refresh failed for good. `revoked` is reserved: a disconnected account is deleted and not listed."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What the provider says was granted. Empty for an API key."
          },
          "connectedAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EndUserConnectionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/EndUserConnection"
          }
        }
      },
      "EndUserConnectionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EndUserConnection"
            }
          }
        }
      },
      "CreateFunctionRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$",
            "example": "refund-with-checks"
          },
          "description": {
            "type": "string",
            "maxLength": 1000,
            "example": "Refund an order after checking it was paid."
          }
        }
      },
      "FunctionBudgets": {
        "type": "object",
        "additionalProperties": false,
        "description": "Per-run budgets. When one runs out the run ends `budget_exceeded`.",
        "properties": {
          "maxActionCalls": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "example": 50,
            "description": "Action calls dispatched in one run. Default 50."
          },
          "maxCpuMs": {
            "type": "integer",
            "minimum": 1,
            "maximum": 30000,
            "example": 1000,
            "description": "CPU time in one run. Default 1000."
          },
          "maxSubrequests": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1000,
            "example": 100,
            "description": "Calls through the anlyon binding in one run",
            "refused ones included. Default 100.": null
          },
          "timeoutMs": {
            "type": "integer",
            "minimum": 100,
            "maximum": 300000,
            "example": 30000,
            "description": "Wall time of one run. Default 30000."
          }
        }
      },
      "FunctionVersion": {
        "type": "object",
        "required": [
          "id",
          "version",
          "language",
          "digest",
          "allowedActions",
          "inputSchema",
          "budgets",
          "straightThrough",
          "review",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "fnv_V1StGXR8_Z5jdHi6B-myT",
            "description": "The version id."
          },
          "version": {
            "type": "integer",
            "minimum": 1,
            "example": 1
          },
          "language": {
            "type": "string",
            "enum": [
              "javascript",
              "python"
            ]
          },
          "digest": {
            "type": "string",
            "example": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
            "description": "SHA-256 of the source."
          },
          "allowedActions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "lookup-order",
              "refund"
            ]
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true
          },
          "budgets": {
            "type": "object",
            "required": [
              "maxActionCalls",
              "maxCpuMs",
              "maxSubrequests",
              "timeoutMs"
            ],
            "properties": {
              "maxActionCalls": {
                "type": "integer",
                "example": 50
              },
              "maxCpuMs": {
                "type": "integer",
                "example": 1000
              },
              "maxSubrequests": {
                "type": "integer",
                "example": 100
              },
              "timeoutMs": {
                "type": "integer",
                "example": 30000
              }
            }
          },
          "straightThrough": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionStraightThroughPolicy"
              }
            ],
            "nullable": true
          },
          "review": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionVersionReview"
              }
            ],
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FunctionSourceFindings": {
        "type": "object",
        "required": [
          "language",
          "parsed",
          "parseError",
          "calls",
          "proposedAllowedActions",
          "computedActionNames",
          "risky",
          "writesInLoop"
        ],
        "description": "What the source says it calls and uses, read from its syntax tree. Advice for people; what a run may call is the version's allowedActions.",
        "properties": {
          "language": {
            "type": "string",
            "enum": [
              "javascript",
              "python"
            ]
          },
          "parsed": {
            "type": "boolean"
          },
          "parseError": {
            "type": "string",
            "nullable": true
          },
          "calls": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "kind",
                "action",
                "line"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "invoke",
                    "read"
                  ]
                },
                "action": {
                  "type": "string",
                  "example": "refund"
                },
                "line": {
                  "type": "integer",
                  "example": 5
                }
              }
            }
          },
          "proposedAllowedActions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "lookup-order",
              "refund"
            ]
          },
          "computedActionNames": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "kind",
                "line"
              ],
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "invoke",
                    "read"
                  ]
                },
                "line": {
                  "type": "integer"
                }
              }
            }
          },
          "risky": {
            "type": "array",
            "description": "Network, file, process, environment and eval APIs. They fail inside a function anyway.",
            "items": {
              "type": "object",
              "required": [
                "api",
                "category",
                "line"
              ],
              "properties": {
                "api": {
                  "type": "string",
                  "example": "fetch"
                },
                "category": {
                  "type": "string",
                  "enum": [
                    "network",
                    "file",
                    "process",
                    "environment",
                    "eval"
                  ]
                },
                "line": {
                  "type": "integer"
                }
              }
            }
          },
          "writesInLoop": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "action",
                "line"
              ],
              "properties": {
                "action": {
                  "type": "string",
                  "nullable": true
                },
                "line": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "FunctionVersionReview": {
        "type": "object",
        "required": [
          "ast",
          "ai"
        ],
        "description": "Advice shown to the people who approve a plan. Nothing here allows or refuses a call.",
        "properties": {
          "ast": {
            "$ref": "#/components/schemas/FunctionSourceFindings"
          },
          "ai": {
            "type": "object",
            "nullable": true,
            "description": "The AI review, for a workspace with Anlyon Vigil on. Null until it is done.",
            "required": [
              "status",
              "reason",
              "model",
              "summary",
              "purpose",
              "riskyPatterns",
              "suggestedRiskTier",
              "confidence",
              "truncated",
              "reviewedAt"
            ],
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "reviewed",
                  "skipped",
                  "failed"
                ]
              },
              "reason": {
                "type": "string",
                "nullable": true,
                "example": "assistant_disabled"
              },
              "model": {
                "type": "string",
                "nullable": true,
                "example": "vigil-1"
              },
              "summary": {
                "type": "string",
                "nullable": true
              },
              "purpose": {
                "type": "string",
                "nullable": true,
                "enum": [
                  "refunds",
                  "payments",
                  "messages",
                  "records",
                  "accounts",
                  "lookups",
                  "other"
                ]
              },
              "riskyPatterns": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "pattern",
                    "description",
                    "probability"
                  ],
                  "properties": {
                    "pattern": {
                      "type": "string",
                      "enum": [
                        "writes_in_loop",
                        "money_per_item",
                        "amount_from_input",
                        "unchecked_write"
                      ]
                    },
                    "description": {
                      "type": "string"
                    },
                    "probability": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    }
                  }
                }
              },
              "suggestedRiskTier": {
                "type": "string",
                "nullable": true,
                "enum": [
                  "routine",
                  "low",
                  "moderate",
                  "high",
                  "critical"
                ]
              },
              "confidence": {
                "type": "number",
                "nullable": true,
                "minimum": 0,
                "maximum": 1
              },
              "truncated": {
                "type": "boolean"
              },
              "reviewedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "Function": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "environmentId",
          "currentVersion",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "fn_V1StGXR8_Z5jdHi6B-myT"
          },
          "name": {
            "type": "string",
            "example": "refund-with-checks"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "environmentId": {
            "type": "string",
            "format": "uuid"
          },
          "currentVersion": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionVersion"
              }
            ],
            "nullable": true,
            "description": "Null until the first publish."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FunctionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/Function"
          }
        }
      },
      "FunctionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Function"
            }
          }
        }
      },
      "PublishFunctionVersionRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "language",
          "source"
        ],
        "properties": {
          "language": {
            "type": "string",
            "enum": [
              "javascript",
              "python"
            ]
          },
          "source": {
            "type": "string",
            "minLength": 1,
            "maxLength": 262144,
            "example": "export default async function run(input, anlyon) { return anlyon.invoke(\"refund\", { order: input.order }); }",
            "description": "One module. At most 256 KB."
          },
          "allowedActions": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]+$",
              "maxLength": 100
            },
            "example": [
              "refund"
            ],
            "description": "Action names the function may call. Each must exist and be enabled. Omitted, the list is read from the source's literal `anlyon.invoke(\"…\")` and `anlyon.read(\"…\")` calls; a source that computes an action name, or does not parse, needs it listed (`400 ALLOWED_ACTIONS_REQUIRED`)."
          },
          "inputSchema": {
            "type": "object",
            "additionalProperties": true,
            "description": "A JSON Schema the run's input must match."
          },
          "budgets": {
            "$ref": "#/components/schemas/FunctionBudgets"
          },
          "straightThrough": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionStraightThroughPolicy"
              }
            ],
            "nullable": true,
            "description": "When a run may skip the plan. Omitted or null",
            "a straight-through run reads and does not write.": null
          }
        }
      },
      "FunctionStraightThroughPolicy": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "actions",
          "maxWrites"
        ],
        "description": "Writes a straight-through run may make without a plan. Every write is still governed and receipted.",
        "properties": {
          "actions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]+$",
              "maxLength": 100
            },
            "example": [
              "send-receipt"
            ],
            "description": "Allowed actions a straight-through run may write to. Each must be in allowedActions."
          },
          "maxWrites": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500,
            "example": 1,
            "description": "Writes in one straight-through run."
          }
        }
      },
      "FunctionVersionPublishedResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "function",
              "version"
            ],
            "properties": {
              "function": {
                "$ref": "#/components/schemas/Function"
              },
              "version": {
                "$ref": "#/components/schemas/FunctionVersion"
              }
            }
          }
        }
      },
      "RunFunctionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "input": {
            "type": "object",
            "additionalProperties": true,
            "example": {
              "order": "ord_123"
            },
            "description": "Passed to `run(input",
            "anlyon)`. Checked against the version's input schema.": null
          },
          "mode": {
            "type": "string",
            "enum": [
              "plan",
              "apply",
              "straight_through"
            ],
            "default": "plan",
            "description": "What happens to writes: `plan` records them for approval, `apply` carries out an approved plan, `straight_through` sends them under the version's straight-through policy."
          },
          "planRunId": {
            "type": "string",
            "maxLength": 100,
            "example": "frn_V1StGXR8_Z5jdHi6B-myT",
            "description": "For `apply`: the approved plan run to carry out. Required with `apply`, and refused with another mode."
          }
        }
      },
      "FunctionRunCall": {
        "type": "object",
        "required": [
          "sequence",
          "action",
          "kind",
          "state",
          "invocationId",
          "refusal",
          "plannedSequence",
          "createdAt"
        ],
        "properties": {
          "sequence": {
            "type": "integer",
            "minimum": 1,
            "example": 1
          },
          "action": {
            "type": "string",
            "example": "refund"
          },
          "kind": {
            "type": "string",
            "enum": [
              "read",
              "write"
            ],
            "description": "From the action's method. A GET reads."
          },
          "state": {
            "type": "string",
            "enum": [
              "intent",
              "dispatched",
              "refused",
              "failed"
            ],
            "description": "`intent` is a write a plan run recorded and did not send."
          },
          "invocationId": {
            "type": "string",
            "nullable": true,
            "example": "inv_V1StGXR8_Z5jdHi6B-myT",
            "description": "The invocation the call became",
            "with its own receipt.": null
          },
          "refusal": {
            "type": "string",
            "nullable": true,
            "example": "ACTION_NOT_ALLOWED",
            "description": "Why the call was refused, when it was. `RUN_DIVERGED` for an apply run's write that did not match its plan."
          },
          "plannedSequence": {
            "type": "integer",
            "nullable": true,
            "example": 2,
            "description": "An apply run's write",
            "the plan run's call it matched.": null
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FunctionRunPlan": {
        "type": "object",
        "required": [
          "digest",
          "writes",
          "approval",
          "appliedByRunId"
        ],
        "description": "The writes a plan run recorded, and the approval they need.",
        "properties": {
          "digest": {
            "type": "string",
            "example": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
            "description": "Covers the version",
            "the input": null,
            "the end user and every write in order. The approval is bound to it.": null
          },
          "writes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "sequence",
                "action",
                "input"
              ],
              "properties": {
                "sequence": {
                  "type": "integer",
                  "example": 2
                },
                "action": {
                  "type": "string",
                  "example": "refund"
                },
                "input": {
                  "description": "The write's input",
                  "as it will be sent.": null
                }
              }
            }
          },
          "approval": {
            "type": "object",
            "nullable": true,
            "description": "Null when the plan has no writes. It needs no approval.",
            "required": [
              "id",
              "status",
              "decider"
            ],
            "properties": {
              "id": {
                "type": "string",
                "example": "apr_V1StGXR8_Z5jdHi6B-myT"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "approved",
                  "denied",
                  "expired"
                ]
              },
              "decider": {
                "type": "string",
                "enum": [
                  "team",
                  "end_user"
                ]
              }
            }
          },
          "appliedByRunId": {
            "type": "string",
            "nullable": true,
            "description": "The apply run that carried out the plan. A plan is applied at most once."
          }
        }
      },
      "FunctionRunReceipt": {
        "type": "object",
        "required": [
          "functionId",
          "functionVersionId",
          "digest",
          "inputDigest",
          "mode",
          "planDigest",
          "approvalId",
          "planRunId",
          "calls",
          "outcome",
          "budget",
          "finishedAt"
        ],
        "properties": {
          "functionId": {
            "type": "string",
            "example": "fn_V1StGXR8_Z5jdHi6B-myT"
          },
          "functionVersionId": {
            "type": "string",
            "example": "fnv_V1StGXR8_Z5jdHi6B-myT"
          },
          "digest": {
            "type": "string",
            "example": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
          },
          "inputDigest": {
            "type": "string",
            "example": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
          },
          "mode": {
            "type": "string",
            "enum": [
              "straight_through",
              "plan",
              "apply"
            ]
          },
          "planDigest": {
            "type": "string",
            "nullable": true,
            "description": "A plan run's plan",
            "or the approved plan an apply run carried out.": null
          },
          "approvalId": {
            "type": "string",
            "nullable": true
          },
          "planRunId": {
            "type": "string",
            "nullable": true,
            "description": "For an apply run",
            "the plan run it carried out.": null
          },
          "calls": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "sequence",
                "action",
                "kind",
                "state",
                "invocationId",
                "refusal",
                "plannedSequence"
              ],
              "properties": {
                "sequence": {
                  "type": "integer",
                  "example": 1
                },
                "action": {
                  "type": "string",
                  "example": "refund"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "read",
                    "write"
                  ]
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "intent",
                    "dispatched",
                    "refused",
                    "failed"
                  ]
                },
                "invocationId": {
                  "type": "string",
                  "nullable": true
                },
                "refusal": {
                  "type": "string",
                  "nullable": true
                },
                "plannedSequence": {
                  "type": "integer",
                  "nullable": true
                }
              }
            }
          },
          "outcome": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "budget_exceeded",
              "planned",
              "awaiting_approval",
              "diverged"
            ]
          },
          "budget": {
            "type": "string",
            "nullable": true,
            "enum": [
              "maxActionCalls",
              "maxCpuMs",
              "maxSubrequests",
              "timeoutMs"
            ]
          },
          "finishedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "FunctionRun": {
        "type": "object",
        "required": [
          "id",
          "functionId",
          "functionName",
          "functionVersionId",
          "mode",
          "status",
          "endUserId",
          "input",
          "inputDigest",
          "output",
          "error",
          "logs",
          "budget",
          "actionCalls",
          "calls",
          "plan",
          "planRunId",
          "planDigest",
          "approvalId",
          "receipt",
          "durationMs",
          "createdAt",
          "finishedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "frn_V1StGXR8_Z5jdHi6B-myT"
          },
          "functionId": {
            "type": "string",
            "example": "fn_V1StGXR8_Z5jdHi6B-myT"
          },
          "functionName": {
            "type": "string",
            "example": "refund-with-checks"
          },
          "functionVersionId": {
            "type": "string",
            "example": "fnv_V1StGXR8_Z5jdHi6B-myT"
          },
          "mode": {
            "type": "string",
            "enum": [
              "straight_through",
              "plan",
              "apply"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "succeeded",
              "failed",
              "budget_exceeded",
              "planned",
              "awaiting_approval",
              "diverged"
            ]
          },
          "endUserId": {
            "type": "string",
            "nullable": true,
            "example": "user_123",
            "description": "The end user the run acted for. Every call carried it."
          },
          "input": {
            "type": "object",
            "additionalProperties": true
          },
          "inputDigest": {
            "type": "string",
            "example": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
          },
          "output": {
            "nullable": true,
            "description": "What `run` returned",
            "when the run succeeded.": null
          },
          "error": {
            "type": "object",
            "nullable": true,
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "example": "FUNCTION_THREW"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "logs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Lines from `anlyon.log`. At most 100."
          },
          "budget": {
            "type": "string",
            "nullable": true,
            "enum": [
              "maxActionCalls",
              "maxCpuMs",
              "maxSubrequests",
              "timeoutMs"
            ],
            "description": "The budget that ended the run."
          },
          "actionCalls": {
            "type": "integer",
            "minimum": 0,
            "example": 2
          },
          "calls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FunctionRunCall"
            }
          },
          "plan": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionRunPlan"
              }
            ],
            "nullable": true,
            "description": "A plan run's plan",
            "once it has ended with one.": null
          },
          "planRunId": {
            "type": "string",
            "nullable": true,
            "description": "An apply run's plan run."
          },
          "planDigest": {
            "type": "string",
            "nullable": true,
            "description": "An apply run's approved plan digest."
          },
          "approvalId": {
            "type": "string",
            "nullable": true,
            "description": "An apply run's plan approval."
          },
          "receipt": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionRunReceipt"
              }
            ],
            "nullable": true
          },
          "durationMs": {
            "type": "integer",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "finishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "FunctionRunResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "$ref": "#/components/schemas/FunctionRun"
          }
        }
      },
      "FunctionVersionListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/FunctionVersion"
                },
                {
                  "type": "object",
                  "required": [
                    "current"
                  ],
                  "properties": {
                    "current": {
                      "type": "boolean",
                      "description": "The version runs use."
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "FunctionVersionDetailResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "allOf": [
              {
                "$ref": "#/components/schemas/FunctionVersion"
              },
              {
                "type": "object",
                "required": [
                  "current",
                  "source"
                ],
                "properties": {
                  "current": {
                    "type": "boolean",
                    "description": "The version runs use."
                  },
                  "source": {
                    "type": "string",
                    "description": "The source the version runs."
                  }
                }
              }
            ]
          }
        }
      },
      "FunctionRunListResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "functionVersionId",
                "version",
                "mode",
                "status",
                "endUserId",
                "actionCalls",
                "budget",
                "error",
                "approvalId",
                "durationMs",
                "createdAt",
                "finishedAt"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "example": "frn_V1StGXR8_Z5jdHi6B-myT"
                },
                "functionVersionId": {
                  "type": "string",
                  "example": "fnv_V1StGXR8_Z5jdHi6B-myT"
                },
                "version": {
                  "type": "integer",
                  "minimum": 1,
                  "example": 1
                },
                "mode": {
                  "type": "string",
                  "enum": [
                    "straight_through",
                    "plan",
                    "apply"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "running",
                    "succeeded",
                    "failed",
                    "budget_exceeded",
                    "planned",
                    "awaiting_approval",
                    "diverged"
                  ]
                },
                "endUserId": {
                  "type": "string",
                  "nullable": true
                },
                "actionCalls": {
                  "type": "integer",
                  "minimum": 0
                },
                "budget": {
                  "type": "string",
                  "nullable": true,
                  "enum": [
                    "maxActionCalls",
                    "maxCpuMs",
                    "maxSubrequests",
                    "timeoutMs"
                  ]
                },
                "error": {
                  "type": "object",
                  "nullable": true,
                  "required": [
                    "code",
                    "message"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                "approvalId": {
                  "type": "string",
                  "nullable": true,
                  "description": "A plan run's approval",
                  "or the approval an apply run carries out.": null
                },
                "durationMs": {
                  "type": "integer",
                  "nullable": true
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "finishedAt": {
                  "type": "string",
                  "format": "date-time",
                  "nullable": true
                }
              }
            }
          }
        }
      },
      "CreateEndUserConnectLinkRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "integration"
        ],
        "properties": {
          "integration": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "example": "gmail",
            "description": "An OAuth integration from the catalogue."
          },
          "redirectUrl": {
            "type": "string",
            "maxLength": 2048,
            "example": "https://app.example.com/settings/connections",
            "description": "Where the browser goes when consent ends. Must fall under one of the environment's allowed redirect URLs. Defaults to the environment's default redirect URL."
          }
        }
      },
      "EndUserConnectLinkResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "url",
              "expiresAt",
              "integration"
            ],
            "properties": {
              "url": {
                "type": "string",
                "format": "uri",
                "description": "Send the end user here. Works once",
                "for 10 minutes.": null
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "integration": {
                "type": "string",
                "example": "gmail"
              }
            }
          }
        }
      },
      "ConfirmEndUserConnectionRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "flowId"
        ],
        "properties": {
          "flowId": {
            "type": "string",
            "maxLength": 64,
            "example": "flw_3kTq9ZbW2xYv8RmNcPd5LsA1hGfE7j",
            "description": "The `anlyon_flow` your redirect received."
          }
        }
      },
      "ConfirmEndUserConnectionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "integration",
              "status"
            ],
            "properties": {
              "integration": {
                "type": "string",
                "example": "gmail"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active"
                ]
              }
            }
          }
        }
      },
      "SetEndUserConnectionRequest": {
        "type": "object",
        "additionalProperties": false,
        "description": "`token` for an integration connected with one key; `fields` for one whose `auth.fields` is set (a key made of several values, or a per-account host), by those names. One or the other.",
        "properties": {
          "token": {
            "type": "string",
            "minLength": 1,
            "maxLength": 4096,
            "writeOnly": true,
            "description": "The end user's own API key for the integration. Never returned."
          },
          "fields": {
            "$ref": "#/components/schemas/ConnectionFieldValues"
          }
        }
      },
      "EndUserErasureResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "connectionsDeleted",
              "approvalsCancelled",
              "countersCleared",
              "erasedAs"
            ],
            "properties": {
              "connectionsDeleted": {
                "type": "integer",
                "minimum": 0
              },
              "approvalsCancelled": {
                "type": "integer",
                "minimum": 0
              },
              "countersCleared": {
                "type": "integer",
                "minimum": 0
              },
              "erasedAs": {
                "type": "string",
                "example": "erased~5f13b7c7de7d0af85029c02dc1a63ef7",
                "description": "The one-way hash the kept records now carry in place of the id."
              }
            }
          }
        }
      },
      "DecideEndUserApprovalRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "decision"
        ],
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "approve",
              "deny"
            ]
          },
          "reason": {
            "type": "string",
            "maxLength": 1000,
            "description": "Recorded as the decision note."
          }
        }
      },
      "EndUserApprovalDecisionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "approval"
            ],
            "properties": {
              "approval": {
                "$ref": "#/components/schemas/Approval"
              },
              "invocation": {
                "$ref": "#/components/schemas/Invocation"
              }
            }
          }
        }
      },
      "CreateEndUserSessionRequest": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "ttlSeconds": {
            "type": "integer",
            "minimum": 60,
            "maximum": 3600,
            "default": 900,
            "description": "How long the token lasts. Never past the key's own expiry."
          }
        }
      },
      "EndUserSessionResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "token",
              "expiresAt",
              "endUserId",
              "capabilities"
            ],
            "properties": {
              "token": {
                "type": "string",
                "example": "eus_v1_example_session_token",
                "description": "Send as `Authorization: Bearer <token>` to /api/v2/end-user-session. Never put it in a URL or storage."
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time"
              },
              "endUserId": {
                "type": "string",
                "example": "user_123"
              },
              "capabilities": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "connections",
                    "approvals"
                  ]
                },
                "description": "`connections` lists, connects and disconnects; `approvals` lists and decides, granted only when the key has `end-users:approvals`."
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "success",
          "error",
          "requestId"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "requestId": {
            "type": "string",
            "description": "Correlation ID matching the X-Request-Id response header.",
            "example": "req_0123456789abcdef0123456789abcdef"
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "example": "VALIDATION_ERROR"
              },
              "message": {
                "type": "string",
                "example": "Invalid request data"
              },
              "details": {
                "type": "object"
              },
              "fix": {
                "$ref": "#/components/schemas/ErrorFix"
              }
            }
          }
        }
      },
      "ErrorFix": {
        "type": "object",
        "description": "How to get past this error, for a person or an agent. Present on refusals with a known next step, such as a missing scope or role, a plan or billing limit, a halted environment, or a missing secret, connected account, OAuth app or end-user header. Absent when there is no fix to give. Kept in production responses, unlike `details`.",
        "required": [
          "summary"
        ],
        "properties": {
          "summary": {
            "type": "string",
            "description": "One sentence that says what to do.",
            "example": "Log in again and approve the anlyon:secrets consent group, which grants secrets:write."
          },
          "command": {
            "type": "string",
            "description": "An exact `anlyon` CLI command that fixes it. Absent when no command does.",
            "example": "anlyon auth login --scope anlyon:secrets"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "An absolute console link where a person fixes it.",
            "example": "https://console.anlyon.com/settings/api-keys"
          },
          "docs": {
            "type": "string",
            "format": "uri",
            "description": "A docs page that explains it.",
            "example": "https://docs.anlyon.com/cli/authentication"
          }
        }
      },
      "AuditCategory": {
        "type": "string",
        "enum": [
          "approval",
          "invocation",
          "policy",
          "action",
          "access",
          "environment",
          "connection",
          "limit",
          "audit"
        ]
      },
      "AuditActor": {
        "type": "object",
        "required": [
          "type",
          "id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "user",
              "api_key",
              "oauth_client",
              "assistant",
              "policy",
              "system"
            ]
          },
          "id": {
            "type": "string",
            "nullable": true,
            "description": "User id",
            "API key id": null,
            "OAuth client id or policy id. Null for the system.": null
          },
          "onBehalfOf": {
            "type": "string",
            "nullable": true,
            "description": "For an OAuth client",
            "the user it acted for.": null
          }
        }
      },
      "AuditEvent": {
        "type": "object",
        "description": "One audit record, schema `anlyon.audit.v1`. `id` is stable across retries, redeliveries, sinks and exports: deduplicate on it. `sequence` orders records within one deployment and is not a dedup key.",
        "required": [
          "schema",
          "id",
          "sequence",
          "type",
          "category",
          "occurredAt",
          "workspaceId",
          "environmentId",
          "actor",
          "resource",
          "outcome",
          "data",
          "context"
        ],
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "anlyon.audit.v1"
            ]
          },
          "id": {
            "type": "string",
            "example": "aud_V1StGXR8Z5jdHi6BmyT4a9Qe"
          },
          "sequence": {
            "type": "integer",
            "example": 1042
          },
          "type": {
            "type": "string",
            "example": "approval.vote"
          },
          "category": {
            "$ref": "#/components/schemas/AuditCategory"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "environmentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Null for workspace-level records such as members and keys."
          },
          "actor": {
            "$ref": "#/components/schemas/AuditActor"
          },
          "resource": {
            "type": "object",
            "nullable": true,
            "required": [
              "type",
              "id"
            ],
            "properties": {
              "type": {
                "type": "string",
                "example": "approval"
              },
              "id": {
                "type": "string",
                "example": "apr_123"
              }
            }
          },
          "outcome": {
            "type": "string",
            "nullable": true,
            "example": "approve"
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "Type-specific detail. Invocation records carry a `receipt`; approval records carry the policy decision."
          },
          "context": {
            "type": "object",
            "nullable": true,
            "properties": {
              "requestId": {
                "type": "string"
              },
              "ip": {
                "type": "string"
              },
              "userAgent": {
                "type": "string"
              }
            }
          },
          "test": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Present only on a test event."
          },
          "backfilled": {
            "type": "boolean",
            "enum": [
              true
            ],
            "description": "Present only on a record created from history by the one-time backfill",
            "with the original time.": null
          },
          "endUserId": {
            "type": "string",
            "description": "Present only on a record of an act for one of your end users. `erased~<hash>` once that end user is erased."
          }
        }
      },
      "AuditEventListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            }
          },
          "pagination": {
            "type": "object",
            "required": [
              "nextBefore"
            ],
            "properties": {
              "nextBefore": {
                "type": "integer",
                "nullable": true,
                "description": "Pass as `before` for the next page. Null on the last page."
              }
            }
          }
        }
      },
      "AuditExportDocument": {
        "type": "object",
        "required": [
          "schema",
          "generatedAt",
          "workspaceId",
          "filters",
          "events",
          "count"
        ],
        "properties": {
          "schema": {
            "type": "string",
            "enum": [
              "anlyon.audit.export.v1"
            ]
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "filters": {
            "type": "object",
            "additionalProperties": true
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            }
          },
          "count": {
            "type": "integer"
          }
        }
      },
      "AuditSchemaResponse": {
        "type": "object",
        "required": [
          "success",
          "data"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "data": {
            "type": "object",
            "required": [
              "schema",
              "jsonSchema",
              "eventTypes"
            ],
            "properties": {
              "schema": {
                "type": "string",
                "enum": [
                  "anlyon.audit.v1"
                ]
              },
              "jsonSchema": {
                "type": "object",
                "additionalProperties": true
              },
              "eventTypes": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "SignOffRequired": {
        "description": "Accepted, not applied: the change loosens a guardrail, so a workspace admin has to approve it. `Location` is the request to poll.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Location": {
            "description": "The sign-off request to poll.",
            "schema": {
              "type": "string",
              "example": "/api/v2/sign-offs/sor_V1StGXR8Z5jdHi6BmyT9q"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SignOffRequiredResponse"
            }
          }
        }
      },
      "SignOffRequest": {
        "description": "Sign-off request returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SignOffRequestResponse"
            }
          }
        }
      },
      "SignOffRequestList": {
        "description": "Sign-off requests returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SignOffRequestListResponse"
            }
          }
        }
      },
      "MemoryRecord": {
        "description": "Public memory resource returned with collection and document provenance.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryResourceResponse"
            }
          }
        }
      },
      "MemoryList": {
        "description": "Non-expired memories returned with page pagination.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryListResponse"
            }
          }
        }
      },
      "MemoryRecall": {
        "description": "Ranked recall results returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryRecallResponse"
            }
          }
        }
      },
      "MemoryBatch": {
        "description": "Per-item batch remember outcomes returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryBatchResponse"
            }
          }
        }
      },
      "MemoryDeletedCount": {
        "description": "Number of matching memories deleted.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryDeletedCountResponse"
            }
          }
        }
      },
      "MemoryDeleted": {
        "description": "Memory deleted.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryDeletedResponse"
            }
          }
        }
      },
      "MemoryIngestAccepted": {
        "description": "Document ingestion accepted for asynchronous processing.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryIngestResponse"
            }
          }
        }
      },
      "MemoryFileUploaded": {
        "description": "Legacy Memory file uploaded for later ingestion.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryFileUploadResponse"
            }
          }
        }
      },
      "MemorySummary": {
        "description": "Summary memory created.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemorySummaryResponse"
            }
          }
        }
      },
      "MemoryJobQueued": {
        "description": "Asynchronous Memory job queued.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryJobQueuedResponse"
            }
          }
        }
      },
      "MemoryJobStatus": {
        "description": "Ingest, consolidate, or re-embed job state returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryJobStatusResponse"
            }
          }
        }
      },
      "MemoryCollection": {
        "description": "Memory collection returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryCollectionResponse"
            }
          }
        }
      },
      "MemoryCollectionList": {
        "description": "Memory collections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryCollectionListResponse"
            }
          }
        }
      },
      "MemoryMigrationAccepted": {
        "description": "Same-dimension collection migration accepted.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MemoryMigrationResponse"
            }
          }
        }
      },
      "Environment": {
        "description": "A single environment.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EnvironmentResponse"
            }
          }
        }
      },
      "CredentialIdentity": {
        "description": "The credential making this request, returned. Not cacheable.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Cache-Control": {
            "schema": {
              "type": "string",
              "enum": [
                "no-store"
              ]
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CredentialIdentityResponse"
            }
          }
        }
      },
      "ApprovalPolicyList": {
        "description": "Approval policies in the workspace.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApprovalPolicyListResponse"
            }
          }
        }
      },
      "ApprovalPolicyResult": {
        "description": "A single approval policy.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApprovalPolicyResponse"
            }
          }
        }
      },
      "ApprovalPolicyCreated": {
        "description": "Approval policy created.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApprovalPolicyResponse"
            }
          }
        }
      },
      "EventStream": {
        "description": "A Server-Sent Events stream. Each message has an `id:` (the resume cursor), an `event:` (the event type, e.g. `run.started`), and a JSON `data:` payload. `heartbeat` comments keep the connection alive.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "text/event-stream": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "RunStarted": {
        "description": "Run started.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunResponse"
            }
          }
        }
      },
      "RunImported": {
        "description": "OTLP trace imported as a new run in the API key's environment.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunResponse"
            }
          }
        }
      },
      "RunResult": {
        "description": "A single run.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunResponse"
            }
          }
        }
      },
      "RunWithSpansResult": {
        "description": "A run with its span tree.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunWithSpansResponse"
            }
          }
        }
      },
      "TraceExport": {
        "description": "Redacted OTLP/JSON trace export.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/TraceExportResponse"
            }
          }
        }
      },
      "RunList": {
        "description": "Runs, newest first.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunListResponse"
            }
          }
        }
      },
      "SpansIngested": {
        "description": "Spans ingested.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/IngestSpansResultResponse"
            }
          }
        }
      },
      "RunFeedbackCreated": {
        "description": "Feedback attached.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunFeedbackResponse"
            }
          }
        }
      },
      "RunFeedbackList": {
        "description": "Feedback for a run.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RunFeedbackListResponse"
            }
          }
        }
      },
      "Workflow": {
        "description": "Public workflow definition returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WorkflowResponse"
            }
          }
        }
      },
      "WorkflowList": {
        "description": "Workflows returned with page pagination.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WorkflowListResponse"
            }
          }
        }
      },
      "WorkflowRun": {
        "description": "Workflow run state returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WorkflowRunResponse"
            }
          }
        }
      },
      "WorkflowRunList": {
        "description": "Workflow runs returned with page pagination.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WorkflowRunListResponse"
            }
          }
        }
      },
      "WorkflowStepList": {
        "description": "Ordered workflow-run steps returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WorkflowStepListResponse"
            }
          }
        }
      },
      "WorkflowTriggered": {
        "description": "Workflow run accepted for asynchronous execution.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WorkflowTriggeredResponse"
            }
          }
        }
      },
      "WorkflowEventNotification": {
        "description": "Event stored and optional waiting run resumed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WorkflowEventNotificationResponse"
            }
          }
        }
      },
      "Queue": {
        "description": "User-managed queue configuration and statistics returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/QueueResponse"
            }
          }
        }
      },
      "QueueList": {
        "description": "User-managed queues returned with page pagination; system queues are excluded.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/QueueListResponse"
            }
          }
        }
      },
      "MyNotificationPreferences": {
        "description": "The calling member's own notification preferences returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "success",
                "data"
              ],
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": true
                },
                "data": {
                  "$ref": "#/components/schemas/MyNotificationPreferences"
                }
              }
            }
          }
        }
      },
      "UnreadNotificationCount": {
        "description": "Unread workspace notification count returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/UnreadNotificationCountResponse"
            }
          }
        }
      },
      "UnifiedLogList": {
        "description": "Redacted unified execution logs returned with pagination and aggregate statistics.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/UnifiedExecutionLogListResponse"
            }
          }
        }
      },
      "ExecutionLogStats": {
        "description": "Detailed log distributions and duration percentiles returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ExecutionLogStatsResponse"
            }
          }
        }
      },
      "ExecutionLogExport": {
        "description": "Attachment containing at most 10,000 matching logs.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Content-Disposition": {
            "description": "Date-stamped attachment filename.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ExecutionLogExportResponse"
            }
          },
          "text/csv": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "MessageExecutionLogList": {
        "description": "Redacted message attempt history returned in ascending timestamp order.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MessageExecutionLogListResponse"
            }
          }
        }
      },
      "ScheduleExecutionLogList": {
        "description": "Schedule execution history returned with page pagination.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ScheduleExecutionLogListResponse"
            }
          }
        }
      },
      "IntegrationList": {
        "description": "Safe integration metadata returned without stored credentials.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/IntegrationListResponse"
            }
          }
        }
      },
      "DiscordIntegrationCreated": {
        "description": "Discord integration created; the webhook URL is not returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DiscordIntegrationCreatedResponse"
            }
          }
        }
      },
      "SlackChannelList": {
        "description": "Slack channels visible to the connected bot returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SlackChannelListResponse"
            }
          }
        }
      },
      "SlackChannelUpdated": {
        "description": "Slack channel selection and auto-join result returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SlackChannelUpdatedResponse"
            }
          }
        }
      },
      "IntegrationToggled": {
        "description": "Integration activation state updated.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/IntegrationToggledResponse"
            }
          }
        }
      },
      "IntegrationEventTypesUpdated": {
        "description": "Integration event subscriptions updated.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/IntegrationEventTypesUpdatedResponse"
            }
          }
        }
      },
      "FlowControlKeyCreated": {
        "description": "Flow-control key created.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FlowControlKeyResponse"
            }
          }
        }
      },
      "FlowControlKey": {
        "description": "Flow-control configuration and live counts returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FlowControlKeyResponse"
            }
          }
        }
      },
      "FlowControlKeyList": {
        "description": "Flow-control keys and live counts returned with page pagination.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FlowControlKeyListResponse"
            }
          }
        }
      },
      "FlowControlStatus": {
        "description": "Live counters and operational state returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FlowControlStatusResponse"
            }
          }
        }
      },
      "DLQMessage": {
        "description": "Failed message diagnostics returned without tenant-internal identifiers.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DLQMessageResponse"
            }
          }
        }
      },
      "DLQMessageList": {
        "description": "Failed messages returned with page pagination.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DLQMessageListResponse"
            }
          }
        }
      },
      "DLQStats": {
        "description": "Failed-message counts and time bounds returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DLQStatsResponse"
            }
          }
        }
      },
      "DLQRetryResult": {
        "description": "Failed message reset and queued for another delivery attempt.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DLQRetryResultResponse"
            }
          }
        }
      },
      "DLQRetryAllResult": {
        "description": "Best-effort retry pass completed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DLQRetryAllResultResponse"
            }
          }
        }
      },
      "DLQClearResult": {
        "description": "DLQ permanently cleared.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DLQClearResultResponse"
            }
          }
        }
      },
      "MessageResult": {
        "description": "Mutation completed and a human-readable outcome was returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MessageResultResponse"
            }
          }
        }
      },
      "BillingQuota": {
        "description": "Current quota utilization returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingQuotaResponse"
            }
          }
        }
      },
      "BillingPlanDetails": {
        "description": "Provider-safe plan, limits, pricing, and subscription state returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingPlanDetailsResponse"
            }
          }
        }
      },
      "BillingCurrentUsage": {
        "description": "Current calendar-month usage and estimated cost returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingCurrentUsageResponse"
            }
          }
        }
      },
      "BillingPlanList": {
        "description": "Available plan comparison and the workspace current plan returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingPlanListResponse"
            }
          }
        }
      },
      "BillingUsageHistory": {
        "description": "Daily usage history and totals returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingUsageHistoryResponse"
            }
          }
        }
      },
      "BillingCostEstimate": {
        "description": "Current-month cost estimate returned in USD.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingCostEstimateResponse"
            }
          }
        }
      },
      "BillingInvoiceList": {
        "description": "Workspace invoices returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BillingInvoiceListResponse"
            }
          }
        }
      },
      "AnalyticsOverview": {
        "description": "Cross-product workspace analytics returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnalyticsOverviewResponse"
            }
          }
        }
      },
      "AgentAnalytics": {
        "description": "Agent execution analytics returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AgentAnalyticsResponse"
            }
          }
        }
      },
      "TrustControlAnalytics": {
        "description": "Action and approval analytics returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/TrustControlAnalyticsResponse"
            }
          }
        }
      },
      "DeliveryAnalytics": {
        "description": "Message, schedule, and workflow delivery analytics returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeliveryAnalyticsResponse"
            }
          }
        }
      },
      "ScheduleAnalytics": {
        "description": "Schedule statistics and chart projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ScheduleAnalyticsResponse"
            }
          }
        }
      },
      "MessageAnalytics": {
        "description": "Message delivery statistics and chart projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MessageAnalyticsResponse"
            }
          }
        }
      },
      "MessageTimeSeries": {
        "description": "Bucketed message counts and chart projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/MessageTimeSeriesResponse"
            }
          }
        }
      },
      "TopUrls": {
        "description": "Highest-volume destination URLs and chart projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/TopUrlsResponse"
            }
          }
        }
      },
      "CurrentAnalyticsUsage": {
        "description": "Current UTC-day delivery counters and chart projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CurrentAnalyticsUsageResponse"
            }
          }
        }
      },
      "AnalyticsUsageHistory": {
        "description": "Historical daily delivery counters and chart projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AnalyticsUsageHistoryResponse"
            }
          }
        }
      },
      "RecentScheduleExecutionList": {
        "description": "Recent schedule execution summaries returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/RecentScheduleExecutionListResponse"
            }
          }
        }
      },
      "ErrorDistribution": {
        "description": "Error distribution and chart projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorDistributionResponse"
            }
          }
        }
      },
      "OnboardingStatus": {
        "description": "Workspace onboarding status and progress projections returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/OnboardingStatusResponse"
            }
          }
        }
      },
      "EventTopicCreated": {
        "description": "Event topic created.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventTopicResponse"
            }
          }
        }
      },
      "EventTopic": {
        "description": "Event topic returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventTopicResponse"
            }
          }
        }
      },
      "EventTopicList": {
        "description": "Event topics returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventTopicListResponse"
            }
          }
        }
      },
      "EventSubscriptionCreated": {
        "description": "Subscription created. A generated plaintext secret is included only in this response.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventSubscriptionCreatedResponse"
            }
          }
        }
      },
      "EventSubscription": {
        "description": "Event subscription returned without its signing secret.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventSubscriptionResponse"
            }
          }
        }
      },
      "EventSubscriptionList": {
        "description": "Event subscriptions returned without signing secrets.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventSubscriptionListResponse"
            }
          }
        }
      },
      "EventSubscriptionSecret": {
        "description": "Newly rotated plaintext signing secret returned exactly once.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventSubscriptionSecretResponse"
            }
          }
        }
      },
      "EventPublishAccepted": {
        "description": "Event accepted for asynchronous fan-out.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventPublishResponse"
            }
          }
        }
      },
      "EventPublishDeduplicated": {
        "description": "Original event returned because the body idempotency key was already used for this topic.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventPublishResponse"
            }
          }
        }
      },
      "EventList": {
        "description": "Published events returned with offset pagination metadata.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventListResponse"
            }
          }
        }
      },
      "EventWithDeliveries": {
        "description": "Event and per-subscription delivery state returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EventWithDeliveriesResponse"
            }
          }
        }
      },
      "Secret": {
        "description": "Secret metadata returned; the value is never exposed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SecretResponse"
            }
          }
        }
      },
      "SecretList": {
        "description": "Secret metadata returned; values are never exposed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SecretListResponse"
            }
          }
        }
      },
      "PutSecret": {
        "description": "Secret metadata returned, with a warning when an external secret could not be read yet; the value is never exposed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PutSecretResponse"
            }
          }
        }
      },
      "SecretStore": {
        "description": "Secret store settings and health returned; the credential is never exposed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SecretStoreResponse"
            }
          }
        }
      },
      "SecretStoreList": {
        "description": "Secret stores returned; credentials are never exposed.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SecretStoreListResponse"
            }
          }
        }
      },
      "FileCreated": {
        "description": "File uploaded and ready.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FileResponse"
            }
          }
        }
      },
      "File": {
        "description": "File metadata returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FileResponse"
            }
          }
        }
      },
      "FileList": {
        "description": "Files returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FileListResponse"
            }
          }
        }
      },
      "FileUploadPresigned": {
        "description": "Presigned upload created; confirm it after the PUT succeeds.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FileUploadPresignedResponse"
            }
          }
        }
      },
      "FileDownloadUrl": {
        "description": "Temporary signed download URL returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/FileDownloadUrlResponse"
            }
          }
        }
      },
      "CacheEntryCreated": {
        "description": "Cache entry stored.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CacheEntryResponse"
            }
          }
        }
      },
      "CacheEntry": {
        "description": "Cache entry returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CacheEntryResponse"
            }
          }
        }
      },
      "CacheEntryList": {
        "description": "Cache entries returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CacheEntryListResponse"
            }
          }
        }
      },
      "CacheLookup": {
        "description": "Cache lookup result returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CacheLookupResponse"
            }
          }
        }
      },
      "CacheFlushed": {
        "description": "Cache entries deleted.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CacheFlushedResponse"
            }
          }
        }
      },
      "CacheStats": {
        "description": "Cache statistics returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CacheStatsResponse"
            }
          }
        }
      },
      "PayloadTooLarge": {
        "description": "File exceeds the deployment or workspace-plan size limit.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ActionCreated": {
        "description": "Action created.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ActionResponse"
            }
          }
        }
      },
      "Action": {
        "description": "Action returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ActionResponse"
            }
          }
        }
      },
      "ActionVersionList": {
        "description": "Action versions returned, oldest first.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ActionVersionListResponse"
            }
          }
        }
      },
      "ActionList": {
        "description": "Actions returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ActionListResponse"
            }
          }
        }
      },
      "Invocation": {
        "description": "Invocation returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InvocationResponse"
            }
          }
        }
      },
      "InvocationList": {
        "description": "Invocations returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/InvocationListResponse"
            }
          }
        }
      },
      "ActionInvocation": {
        "description": "Invocation completed or parked for approval.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ActionInvocationResponse"
            }
          }
        }
      },
      "EffectList": {
        "description": "Effects returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EffectListResponse"
            }
          }
        }
      },
      "EffectDetail": {
        "description": "Effect with evidence returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EffectDetailResponse"
            }
          }
        }
      },
      "Preview": {
        "description": "Preview returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PreviewResponse"
            }
          }
        }
      },
      "ImpactLimit": {
        "description": "Impact limit returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ImpactLimitResponse"
            }
          }
        }
      },
      "ImpactLimitList": {
        "description": "Impact limits returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ImpactLimitListResponse"
            }
          }
        }
      },
      "ActionImport": {
        "description": "Import or dry-run report returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ImportActionsResponse"
            }
          }
        }
      },
      "ApprovalCreated": {
        "description": "Approval requested.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApprovalResponse"
            }
          }
        }
      },
      "Approval": {
        "description": "Approval returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApprovalResponse"
            }
          }
        }
      },
      "ApprovalList": {
        "description": "Approvals returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApprovalListResponse"
            }
          }
        }
      },
      "ApprovalDecision": {
        "description": "Approval decision returned, with the executed invocation when applicable.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApprovalDecisionResponse"
            }
          }
        }
      },
      "Budget": {
        "description": "Budget returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BudgetResponse"
            }
          }
        }
      },
      "BudgetList": {
        "description": "Budgets returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BudgetListResponse"
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with current resource state or a concurrent decision.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "EndUserConflict": {
        "description": "A conflict with current state, or, for a call made for an end user, `END_USER_NOT_CONNECTED` (they have not connected the integration) or `END_USER_RECONNECT_REQUIRED` (the provider refused their grant, or it could not be refreshed). Nothing was sent. Those two carry `integration`, `endUserId` and, when the environment has a default redirect URL and the integration signs in with OAuth, a fresh `connectUrl` with its `expiresAt`.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/EndUserConnectionError"
            }
          }
        }
      },
      "SessionCreated": {
        "description": "Session created.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionResponse"
            }
          }
        }
      },
      "Session": {
        "description": "Session returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionResponse"
            }
          }
        }
      },
      "SessionList": {
        "description": "Sessions returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionListResponse"
            }
          }
        }
      },
      "SessionMessagesAppended": {
        "description": "Messages appended.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionMessagesAppendedResponse"
            }
          }
        }
      },
      "SessionMessage": {
        "description": "Session message returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionMessageResponse"
            }
          }
        }
      },
      "SessionMessageList": {
        "description": "Session messages returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionMessageListResponse"
            }
          }
        }
      },
      "Deleted": {
        "description": "Resource deleted.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/DeletedResponse"
            }
          }
        }
      },
      "SessionMessagesCleared": {
        "description": "Session messages cleared.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionMessagesClearedResponse"
            }
          }
        }
      },
      "SessionContext": {
        "description": "Prompt-ready session context returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SessionContextResponse"
            }
          }
        }
      },
      "AssembledContext": {
        "description": "Prompt-ready context returned.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AssembledContextResponse"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Authenticated credential lacks the required scope or workspace access.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "A required provider or platform dependency is not configured or available.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadRequest": {
        "description": "Bad Request - Invalid input data",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "Invalid request data",
                "details": {
                  "url": "Invalid URL format"
                }
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Unauthorized - Invalid or missing API key",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "AUTHENTICATION_ERROR",
                "message": "Invalid or missing API key"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Not Found - Resource does not exist",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "NOT_FOUND",
                "message": "Resource not found"
              }
            }
          }
        }
      },
      "RateLimitExceeded": {
        "description": "Too Many Requests - Rate limit exceeded. A workspace's API requests are limited per minute and per UTC clock hour by plan; `Retry-After` says when to try again, and an hourly refusal names the limit and when the count resets. Successful responses carry the same limits in `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (the minute) and `X-RateLimit-Limit-Hour`, `X-RateLimit-Remaining-Hour`, `X-RateLimit-Reset-Hour` (the hour).",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Retry-After": {
            "description": "Seconds until the window that refused the request resets.",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          "X-RateLimit-Limit-Hour": {
            "description": "The workspace's API requests per hour, when the hourly limit refused the request.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          "X-RateLimit-Remaining-Hour": {
            "description": "Requests left this hour; 0 when the hourly limit refused the request.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          "X-RateLimit-Reset-Hour": {
            "description": "When the hourly count resets, in milliseconds since the Unix epoch.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "RATE_LIMIT_EXCEEDED",
                "message": "Rate limit exceeded. Please try again later."
              }
            }
          }
        }
      },
      "RateLimitOrQuotaExceeded": {
        "description": "Too Many Requests - either the request rate limit, or the plan's cap on how many of this resource may exist. The `code` distinguishes them: `RATE_LIMIT_EXCEEDED` clears on its own, `QUOTA_EXCEEDED` does not until you remove one or upgrade.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "QUOTA_EXCEEDED",
                "message": "Free plan allows up to 10 active schedules. You have 10. Upgrade to Pay as You Go for unlimited schedules."
              }
            }
          }
        }
      },
      "QuotaExceeded": {
        "description": "Payment Required - Usage quota exceeded",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "QUOTA_EXCEEDED",
                "message": "Daily message quota exceeded. Upgrade your plan to continue."
              }
            }
          }
        }
      },
      "FeatureNotAvailable": {
        "description": "Payment Required - Feature not available on current plan",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "success": false,
              "error": {
                "code": "FEATURE_NOT_AVAILABLE",
                "message": "Schedules are not available on your current plan. Upgrade to Pay as You Go or Enterprise."
              }
            }
          }
        }
      },
      "AuditEventList": {
        "description": "Audit records, newest first.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuditEventListResponse"
            }
          }
        }
      },
      "AuditExport": {
        "description": "Streamed attachment of every matching record, oldest first.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          },
          "Content-Disposition": {
            "description": "Date-stamped attachment filename.",
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuditExportDocument"
            }
          },
          "text/csv": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "AuditSchema": {
        "description": "The v1 audit event JSON Schema and the event types by category.",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/AuditSchemaResponse"
            }
          }
        }
      }
    }
  }
}
